#
353783 |
|
20-Oct-2019 |
kevans |
MFC r353128-r353129: fully initialize cloned devices w/ make_dev_args
r353128: kern_conf: fully initialize cloned devices with make_dev_args, too
Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if you are operating on cloned devices.
clone_create must be called prior to the make_dev* family to create/return the device on the clonelist as needed. This device is later returned early in newdev(), prior to si_drv{0,1,2} initialization.
This patch simply breaks out of the loop if we've found a device and finishes init.
r353129: Remove the remnants of SI_CHEAPCLONE
SI_CHEAPCLONE was introduced in r66067 for use with cloned bpfs. It was later also used in tty, tun, tap at points. The rough timeline for being removed in each of these is as follows:
- r181690: bpf switched to use cdevpriv API by ed@ - r181905: ed@ rewrote the TTY later to be mpsafe - r204464: kib@ removes it from tun/tap, declaring it unused
I've not yet been able to dig up any other consumers in the intervening 9 years. It is no longer set on any devices in the tree and leaves an interesting situation in make_dev_sv where we're ok with the device already being set SI_NAMED.
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
293346 |
|
07-Jan-2016 |
kib |
Provide yet another KPI for cdev creation, make_dev_s(9).
Immediate problem fixed by the new KPI is the long-standing race between device creation and assignments to cdev->si_drv1 and cdev->si_drv2, which allows the window where cdevsw methods might be called with si_drv1,2 fields not yet set. Devices typically checked for NULL and returned spurious errors to usermode, and often left some methods unchecked.
The new function interface is designed to be extensible, which should allow to add more features to make_dev_s(9) without inventing yet another name for function to create devices, while maintaining KPI and even KBI backward-compatibility.
Reviewed by: hps, jhb Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D4746
|
#
280345 |
|
22-Mar-2015 |
hselasky |
Fix for out of order device destruction notifications when using the delist_dev() function. In addition to this change: - add a proper description of this function - add a proper witness assert inside this function - switch a nearby line to use the "cdp" pointer instead of cdev2priv()
MFC after: 3 days
|
#
277391 |
|
19-Jan-2015 |
kib |
Stop enforcing additional reference on all cdevs, which was introduced in r277199. Acquire the neccessary reference in delist_dev_locked() and inform destroy_devl() about it using CDP_UNREF_DTR flag.
Fix some style nits, add asserts.
Discussed with: hselasky Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
277199 |
|
14-Jan-2015 |
hselasky |
Avoid race with "dev_rel()" when using the recently added "delist_dev()" function. Make sure the character device structure doesn't go away until the end of the "destroy_dev()" function due to concurrently running cleanup code inside "devfs_populate()".
MFC after: 1 week Reported by: dchagin@
|
#
277179 |
|
14-Jan-2015 |
hselasky |
Add a kernel function to delist our kernel character devices, so that the device name can be re-used right away in case we are destroying the character devices in the background.
MFC after: 4 days Reported by: dchagin@
|
#
275856 |
|
17-Dec-2014 |
gleb |
Adjust printf format specifiers for dev_t and ino_t in kernel.
ino_t and dev_t are about to become uint64_t.
Reviewed by: kib, mckusick
|
#
256885 |
|
22-Oct-2013 |
mav |
Remove global device lock acquisition from dev_relthread(), replacing it with atomics on per-device data.
|
#
244584 |
|
22-Dec-2012 |
jh |
Reject spaces and double quotation marks in device names. devctl(4) and devd(8) can't handle names with such characters properly.
PR: bin/144736, kern/161912 Discussed with: imp, kib, pjd
|
#
239791 |
|
28-Aug-2012 |
ed |
Remove unused SI_* flags.
The SI_DEVOPEN, SI_CONSOPEN and SI_CANDELETE flags are not used by any piece of code in the tree.
|
#
239335 |
|
16-Aug-2012 |
jhb |
Remove D_NEEDGIANT from dead_devsw. biofinish() (and thus dead_strategy) does not need Giant.
MFC after: 1 month
|
#
235899 |
|
24-May-2012 |
mav |
MFprojects/zfsd: Hide warning behind bootverbose. Average user has nothing to do about it.
|
#
231386 |
|
10-Feb-2012 |
ed |
Remove unneeded newline. It fits in 80 columns now.
Pointed out by: jh
|
#
231379 |
|
10-Feb-2012 |
ed |
Merge si_name and __si_namebuf.
The si_name pointer always points to the __si_namebuf member inside the same object. Remove it and rename __si_namebuf to si_name.
|
#
228804 |
|
22-Dec-2011 |
jhb |
Use TASK_INITIALIZER() for dev_dtr_task rather than a dedicated SYSINIT().
|
#
227444 |
|
11-Nov-2011 |
kib |
Style.
MFC after: 1 week
|
#
227443 |
|
11-Nov-2011 |
kib |
Guard against the unlikely case of the alias path containing the '%' symbols.
Reported by: arundel MFC after: 1 week
|
#
224521 |
|
30-Jul-2011 |
kib |
Fix the devmtx lock leak from make_dev(9) when the old device cloning failed due to invalid or duplicated path being generated.
Reviewed by: jh Approved by: re (kensmith) MFC after: 1 week
|
#
223085 |
|
14-Jun-2011 |
gibbs |
sys/sys/conf.h: sys/kern/kern_conf.c: Add make_dev_physpath_alias(). This interface takes the parent cdev of the alias, an old alias cdev (if any) to replace with the newly created alias, and the physical path string. The alias is visiable as a symlink to the parent, with the same name as the parent, rooted at physpath in devfs.
Note: make_dev_physpath_alias() has hard coded knowledge of the Solaris style prefix convention for physical path data, "id1,". In the future, I expect the convention to change to allow "physical path quality" to be reported in the prefix. For example, a physical path based on NewBus topology would be of "lower quality" than a physical path reported by a device enclosure.
Sponsored by: Spectra Logic Corporation
|
#
222086 |
|
18-May-2011 |
kib |
The CDP_ACTIVE flag is cleared at the beginning of destroy_devl(), and destroy_devl() drops dev_mtx. The protection against the race with dev_rel(), introduced in r163328, should be extended to cover destroy_devl() calls for the children of the destroyed dev.
Reported and tested by: joerg MFC after: 1 week
|
#
221397 |
|
03-May-2011 |
ae |
Add make_dev_alias_p() function. It is similar to make_dev_alias(), but it may return an error like make_dev_p() does.
Reviewed by: kib (previous version) MFC after: 2 weeks
|
#
216371 |
|
11-Dec-2010 |
hselasky |
Fix race in devfs by using LIST_FIRST() instead of LIST_FOREACH_SAFE() when freeing the devfs private data entries.
Reviewed by: kib MFC after: 3 days Approved by: thompsa (mentor)
|
#
214917 |
|
07-Nov-2010 |
jh |
Add missing curly brackets. By chance, the missing brackets didn't alter the code behavior.
Submitted by: Lucius Windschuh
|
#
213526 |
|
07-Oct-2010 |
jh |
Check the device name validity on device registration.
A new function prep_devname() sanitizes a device name by removing leading and redundant sequential slashes. The function returns an error for names which already exist or are considered invalid.
A new flag MAKEDEV_CHECKNAME for make_dev_p(9) and make_dev_credf(9) indicates that the caller is prepared to handle an error related to the device name. An invalid name triggers a panic if the flag is not specified.
Document the MAKEDEV_CHECKNAME flag in the make_dev(9) manual page.
Idea from: kib Reviewed by: kib
|
#
210924 |
|
06-Aug-2010 |
kib |
Add "show cdev" ddb command.
In collaboration with: pho MFC after: 1 month
|
#
210923 |
|
06-Aug-2010 |
kib |
Add new make_dev_p(9) flag MAKEDEV_ETERNAL to inform devfs that created cdev will never be destroyed. Propagate the flag to devfs vnodes as VV_ETERNVALDEV. Use the flags to avoid acquiring devmtx and taking a thread reference on such nodes.
In collaboration with: pho MFC after: 1 month
|
#
209244 |
|
17-Jun-2010 |
ed |
Remove the unit argument from the recently added make_dev_p().
New code that creates character devices shouldn't use device unit numbers, but only si_drv[12] to hold pointer to per-device data. Make this function more future proof by removing the unit number argument.
Discussed with: kib
|
#
209237 |
|
16-Jun-2010 |
jh |
Correct the function name in a KASSERT.
|
#
209106 |
|
12-Jun-2010 |
kib |
Add another variation of make_dev(9), make_dev_p(9), that is allowed to fail and can return useful error code.
Requested by: jh Reviewed by: imp, jh MFC after: 3 weeks
|
#
209105 |
|
12-Jun-2010 |
kib |
When make_dev_credf(MAKEDEV_WAITOK) is called, use devctl_notify_f(M_WAITOK) for devfs notifications.
Suggested by: jh Reviewed by: imp, jh MFC after: 3 weeks
|
#
207729 |
|
06-May-2010 |
kib |
Add MAKEDEV_NOWAIT flag to make_dev_credf(9), to create a device node in a no-sleep context. If resource allocation cannot be done without sleep, make_dev_credf() fails and returns NULL.
Reviewed by: jh MFC after: 2 weeks
|
#
204412 |
|
27-Feb-2010 |
kib |
Fix several style issues. Define make_dev_credv() as static to match declaration.
MFC after: 3 days
|
#
201223 |
|
29-Dec-2009 |
rnoland |
Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also changes the type of offset to vm_ooffset_t.
Purge d_mmap2().
All driver modules will need to be rebuilt since D_VERSION is also bumped.
Reviewed by: jhb@ MFC after: Not in this lifetime...
|
#
201145 |
|
28-Dec-2009 |
antoine |
(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument. Fix some wrong usages. Note: this does not affect generated binaries as this argument is not used.
PR: 137213 Submitted by: Eygene Ryabinkin (initial version) MFC after: 1 month
|
#
196615 |
|
28-Aug-2009 |
jhb |
Extend the device pager to support different memory attributes on different pages in an object. - Add a new variant of d_mmap() currently called d_mmap2() which accepts an additional in/out parameter that is the memory attribute to use for the requested page. - A driver either uses d_mmap() or d_mmap2() for all requests but not both. The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate that the driver provides a d_mmap2() handler instead of d_mmap(). This is done to make the change ABI compatible with existing drivers and MFC'able to 7 and 8.
Submitted by: alc MFC after: 1 month
|
#
193275 |
|
01-Jun-2009 |
jhb |
Add an extension to the character device interface that allows character device drivers to use arbitrary VM objects to satisfy individual mmap() requests. - A new d_mmap_single(cdev, &foff, objsize, &object, prot) callback is added to cdevsw. This function is called for each mmap() request. If it returns ENODEV, then the mmap() request will fall back to using the device's device pager object and d_mmap(). Otherwise, the method can return a VM object to satisfy this entire mmap() request via *object. It can also modify the starting offset into this object via *foff. This allows device drivers to use the file offset as a cookie to identify specific VM objects. - vm_mmap_vnode() has been changed to call vm_mmap_cdev() directly when mapping V_CHR vnodes. This avoids duplicating all the cdev mmap handling code and simplifies some of vm_mmap_vnode(). - D_VERSION has been bumped to D_VERSION_02. Older device drivers using D_VERSION_01 are still supported.
MFC after: 1 month
|
#
192535 |
|
21-May-2009 |
attilio |
Move the M_WAITOK flag in notify() into an M_NOWAIT one in order to match the behaviour alredy present with the further malloc() call in devctl_notify(). This fixes a bug in the CAM layer where the camisr handler finished to call camperiphfree() (and subsequently destroy_dev() resulting in a new dev notify) while the xpt lock is held.
PR: kern/130330 Tested by: Riccardo Torrini <riccardo dot torrini at esaote dot com>
|
#
191118 |
|
15-Apr-2009 |
ed |
Remove dead code from devtoname().
In the good old days it was possible to have dev_t's that referred to nonexistent devices. In these cases devtoname() automatically generated names. This is no longer possible, so remove this dead code.
Discussed with: kib
|
#
191116 |
|
15-Apr-2009 |
ed |
Remove unneeded variable and casting from newdev().
Remove the `udev' variable, which has a different type than the original function argument and si_drv0. The `udev' name is also misleading, because it is not the number returned by dev2udev(). Rename this argument to `unit'. It is the same number as returned by dev2unit().
|
#
191115 |
|
15-Apr-2009 |
ed |
Don't use si_drv0 directly.
We should still access si_drv0 using dev2unit(). Also change the KASSERT() to really print the udev instead of the unit number. I suspect it's still useful to print the unit number, especially for devices that use clone lists, so keep the unit number in the panic string.
|
#
189450 |
|
06-Mar-2009 |
kib |
Extract the no_poll() and vop_nopoll() code into the common routine poll_no_poll(). Return a poll_no_poll() result from devfs_poll_f() when filedescriptor does not reference the live cdev, instead of ENXIO.
Noted and tested by: hps MFC after: 1 week
|
#
185373 |
|
27-Nov-2008 |
kib |
Explicitely note that destroy_dev() sleeps.
Requested by: ed (some time ago), Jaakko Heinonen <jh saunalahti fi>
|
#
183406 |
|
27-Sep-2008 |
ed |
Move uminor() and umajor() to the same place as userspace minor() and major().
The uminor() and umajor() functions have the same use in kernel space as the minor() and major() functions in userspace. If we ever get rid of the minor() function in kernel space, we could decide to just expose minor() and major() to kernel space, making uminor() and umajor() redundant.
There are two reasons why we want to have uminor() and umajor() in <sys/types.h>:
- Having them close together prevents them from diverting. Even though it's unlikely the definitions will change, it's a good habit to have them at the same place.
- They don't really belong in kern_conf.c. kern_conf.c has been liberated from dealing with device major and minor number handling.
The device_ids(9) manpage now lists the wrong #include's, because it should only list <sys/types.h> now. I'm leaving it as it is now, because I wonder if we should document them anyway. We're probably better off documenting minor(3) and major(3).
|
#
183397 |
|
27-Sep-2008 |
ed |
Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere.
This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware.
Reviewed by: kib
|
#
183382 |
|
26-Sep-2008 |
ed |
Rename the `minor' argument of make_dev(9) to `unit'.
To prevent any further confusion about device minor and unit numbers, we'd better just refer to device unit numbers. Many people still think the numbers we show inside devfs have any relation to the numbers passed to make_dev(9), which is not the case.
Discussed with: kib
|
#
183381 |
|
26-Sep-2008 |
ed |
Remove unit2minor() use from kernel code.
When I changed kern_conf.c three months ago I made device unit numbers equal to (unneeded) device minor numbers. We used to require bitshifting, because there were eight bits in the middle that were reserved for a device major number. Not very long after I turned dev2unit(), minor(), unit2minor() and minor2unit() into macro's. The unit2minor() and minor2unit() macro's were no-ops.
We'd better not remove these four macro's from the kernel, because there is a lot of (external) code that may still depend on them. For now it's harmless to remove all invocations of unit2minor() and minor2unit().
Reviewed by: kib
|
#
181905 |
|
20-Aug-2008 |
ed |
Integrate the new MPSAFE TTY layer to the FreeBSD operating system.
The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following:
- Improved driver model:
The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers.
If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver.
- Improved hotplugging:
With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc).
The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly.
- Improved performance:
One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters.
Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING.
Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan
|
#
180445 |
|
11-Jul-2008 |
kib |
Make it atomic for the devfs_populate_loop() to see the setting of SI_ALIAS flag and initialization of the si_parent when alias is created. Assert that supplied parent device is not NULL.
Both situations could cause NULL dereference in the devfs_populate_loop() when creating a symlink for SI_ALIAS'ed device. Namely, cdp->cdp_c.si_parent may be NULL.
Reported by: mav MFC after: 2 weeks
|
#
179828 |
|
16-Jun-2008 |
kib |
Struct cdev is always the member of the struct cdev_priv. When devfs needed to promote cdev to cdev_priv, the si_priv pointer was followed.
Use member2struct() to calculate address of the wrapping cdev_priv. Rename si_priv to __si_reserved.
Tested by: pho Reviewed by: ed MFC after: 2 weeks
|
#
179757 |
|
12-Jun-2008 |
ed |
Turn dev2unit(), minor(), unit2minor() and minor2unit() into macro's.
Now that we got rid of the minor-to-unit conversion and the constraints on device minor numbers, we can convert the functions that operate on minor and unit numbers to simple macro's. The unit2minor() and minor2unit() macro's are now no-ops.
The ZFS code als defined a macro named `minor'. Change the ZFS code to use umajor() and uminor() here, as it is the correct approach to do this. Also add $FreeBSD$ to keep SVN happy.
Approved by: philip (mentor), pjd
|
#
179726 |
|
11-Jun-2008 |
ed |
Don't enforce unique device minor number policy anymore.
Except for the case where we use the cloner library (clone_create() and friends), there is no reason to enforce a unique device minor number policy. There are various drivers in the source tree that allocate unr pools and such to provide minor numbers, without using them themselves.
Because we still need to support unique device minor numbers for the cloner library, introduce a new flag called D_NEEDMINOR. All cdevsw's that are used in combination with the cloner library should be marked with this flag to make the cloning work.
This means drivers can now freely use si_drv0 to store their own flags and state, making it effectively the same as si_drv1 and si_drv2. We still keep the minor() and dev2unit() routines around to make drivers happy.
The NTFS code also used the minor number in its hash table. We should not do this anymore. If the si_drv0 field would be changed, it would no longer end up in the same list.
Approved by: philip (mentor)
|
#
179413 |
|
29-May-2008 |
ed |
Remove the distinction between device minor and unit numbers.
Even though we got rid of device major numbers some time ago, device drivers still need to provide unique device minor numbers to make_dev(). These numbers are only used inside the kernel. They are not related to device major and minor numbers which are visible in devfs. These are actually based on the inode number of the device.
It would eventually be nice to remove minor numbers entirely, but we don't want to be too agressive here.
Because the 8-15 bits of the device number field (si_drv0) are still reserved for the major number, there is no 1:1 mapping of the device minor and unit numbers. Because this is now unused, remove the restrictions on these numbers.
The MAXMAJOR definition was actually used for two purposes. It was used to convert both the userspace and kernelspace device numbers to their major/minor pair, which is why it is now named UMINORMASK.
minor2unit() and unit2minor() have now become useless. Both minor() and dev2unit() now serve the same purpose. We should eventually remove some of them, at least turning them into macro's. If devfs would become completely minor number unaware, we could consider using si_drv0 directly, just like si_drv1 and si_drv2.
Approved by: philip (mentor)
|
#
179248 |
|
23-May-2008 |
kib |
Assert that si_threadcount > 0 before decrementing it. This helps catching the improper use of the dev_refthread/dev_relthread.
Tested by: pho MFC after: 1 week
|
#
179175 |
|
21-May-2008 |
kib |
Implement the per-open file data for the cdev.
The patch does not change the cdevsw KBI. Management of the data is provided by the functions int devfs_set_cdevpriv(void *priv, cdevpriv_dtr_t dtr); int devfs_get_cdevpriv(void **datap); void devfs_clear_cdevpriv(void); All of the functions are supposed to be called from the cdevsw method contexts.
- devfs_set_cdevpriv assigns the priv as private data for the file descriptor which is used to initiate currently performed driver operation. dtr is the function that will be called when either the last refernce to the file goes away, the device is destroyed or devfs_clear_cdevpriv is called. - devfs_get_cdevpriv is the obvious accessor. - devfs_clear_cdevpriv allows to clear the private data for the still open file.
Implementation keeps the driver-supplied pointers in the struct cdev_privdata, that is referenced both from the struct file and struct cdev, and cannot outlive any of the referee.
Man pages will be provided after the KPI stabilizes.
Reviewed by: jhb Useful suggestions from: jeff, antoine Debugging help and tested by: pho MFC after: 1 month
|
#
178991 |
|
14-May-2008 |
kib |
Add the devctl notifications for the cdev create/destroy events.
Based on the submission by: Andriy Gapon <avg icyb net ua> MFC after: 2 weeks
|
#
177858 |
|
02-Apr-2008 |
kib |
Add two missed chunks from the rev. 1.210, for the giant_read() and giant_ioctl().
PR: kern/122287 MFC after: 3 days
|
#
177301 |
|
17-Mar-2008 |
kib |
Fix two races in the handling of the d_gianttrick for the D_NEEDGIANT drivers.
In the giant_XXX wrappers for the device methods of the D_NEEDGIANT drivers, do not dereference the cdev->si_devsw. It is racing with the destroy_devl() clearing of the si_devsw. Instead, use the dev_refthread() and return ENXIO for the destroyed device. [1]
The check for the D_INIT in the prep_cdevsw() was not synchronized with the call of the fini_cdevsw() in destroy_devl(), that under rapid device creation/destruction may result in the use of uninitialized cdevsw [2]. Change the protocol for the prep_cdevsw(), requiring it to be called under dev_mtx, where the check for D_INIT is done.
Do not free the memory allocated for the gianttrick cdevsw while holding the dev_mtx, put it into the free list to be freed later. Reuse the d_gianttrick pointer to keep the size and layout of the struct cdevsw (requested by phk). Free the memory in the dev_unlock_and_free(), and do all the free after the dev_mtx is dropped (suggested by jhb).
Reported by: bsdimp + many [1], pho [2] Reviewed by: phk, jhb Tested by: pho MFC after: 1 week
|
#
174280 |
|
04-Dec-2007 |
thompsa |
Apply a workaround for the unkillable jail problem where some devices created within the jail are never freed. si_cred is only used by the MAC framework so make the cred reference conditional on it being compiled in, this is not a fix and will need to be reviewed for any new consumers of si_cred.
This will quell some user complaint when using jails with a default kernel.
Reviewed by: rwatson MFC after: 3 days
|
#
171251 |
|
05-Jul-2007 |
kib |
Revert destroy_dev() to the state before destroy_dev_sched() was introduced. Attempt to spawn destroy_dev_sched() from it causes inadmissible races.
Requested by: tegge Approved by: re (kensmith)
|
#
171202 |
|
04-Jul-2007 |
kib |
Since cdev mutex is after system map mutex in global lock order, free() shall not be called while holding cdev mutex. devfs_inos unrhdr has cdev as mutex, thus creating this LOR situation.
Postpone calling free() in kern/subr_unit.c:alloc_unr() and nested functions until the unrhdr mutex is dropped. Save the freed items on the ppfree list instead, and provide the clean_unrhdrl() and clean_unrhdr() functions to clean the list. Call clean_unrhdrl() after devfs_create() calls immediately before dropping cdev mutex. devfs_create() is the only user of the alloc_unrl() in the tree.
Reviewed by: phk Tested by: Peter Holm LOR: 80 Approved by: re (kensmith)
|
#
171188 |
|
03-Jul-2007 |
kib |
Rev. 1.204 and 1.205 got an erronous version of destroy_dev() that calls destroy_dev_sched() with cdev mutex locked. Commit the code that was actually tested.
Pointy hat to: kib Approved by: re (implicit)
|
#
171182 |
|
03-Jul-2007 |
kib |
Automatically detect deadlock condition in destroy_dev(), that is, if destroy_dev() is called from csw method, and no d_purge driver method is provided. Transform the direct call to destroy_dev() into destroy_dev_sched().
Reviewed by: njl (programming interface) Debugging help and testing by: Peter Holm Approved by: re (kensmith)
|
#
171181 |
|
03-Jul-2007 |
kib |
Since rev. 1.199 of sys/kern/kern_conf.c, the thread that calls destroy_dev() from d_close() cdev method would self-deadlock. devfs_close() bump device thread reference counter, and destroy_dev() sleeps, waiting for si_threadcount to reach zero for cdev without d_purge method.
destroy_dev_sched() could be used instead from d_close(), to schedule execution of destroy_dev() in another context. The destroy_dev_sched_drain() function can be used to drain the scheduled calls to destroy_dev_sched(). Similarly, drain_dev_clone_events() drains the events clone to make sure no lingering devices are left after dev_clone event handler deregistered.
make_dev_credf(MAKEDEV_REF) function should be used from dev_clone event handlers instead of make_dev()/make_dev_cred() to ensure that created device has reference counter bumped before cdev mutex is dropped inside make_dev().
Reviewed by: tegge (early versions), njl (programming interface) Debugging help and testing by: Peter Holm Approved by: re (kensmith)
|
#
170950 |
|
19-Jun-2007 |
kib |
devfs_free() calls free_unr(), that may sleep. Postpone call to devfs_free() after cdev mutex is dropped. Reuse cdp_list link for queuing devices awaiting deletion in the cdevp_free_list.
Reported by: Hans Petter Selasky <hselasky c2i net> Tested by: Peter Holm Approved by: re (kensmith) MFC after: 2 weeks
|
#
170152 |
|
31-May-2007 |
kib |
Revert UF_OPENING workaround for CURRENT. Change the VOP_OPEN(), vn_open() vnode operation and d_fdopen() cdev operation argument from being file descriptor index into the pointer to struct file.
Proposed and reviewed by: jhb Reviewed by: daichi (unionfs) Approved by: re (kensmith)
|
#
166438 |
|
02-Feb-2007 |
bms |
Use int instead of u_int for the 'extra' argument to the clone_create() KPI. This fixes a signedness bug in unit number comparisons.
Submitted by: imp, Landon Fuller PR: kern/105228 MFC after: 2 weeks
|
#
163529 |
|
20-Oct-2006 |
kib |
Fix the race between devfs_fp_check and devfs_reclaim. Derefence the vnode' v_rdev and increment the dev threadcount , as well as clear it (in devfs_reclaim) under the dev_lock().
Reviewed by: tegge Approved by: pjd (mentor)
|
#
163328 |
|
13-Oct-2006 |
tegge |
Wait for thread count to reach zero in destroy_devl() even when no purge method is defined, to avoid memory being modified after free.
Temporarily increase refcount in destroy_devl() to avoid a double free if dev_rel() is called while waiting for thread count to reach zero.
|
#
158684 |
|
17-May-2006 |
phk |
Make the printfs relating to purging threads from a device less intrusive.
|
#
154266 |
|
12-Jan-2006 |
alfred |
Novel idea, don't print a string if it is NULL!
This protects people from loading _really_ old modules, like say from 5.x to a 6.x or 7.x system, like for instance right after an upgrade.
|
#
154029 |
|
04-Jan-2006 |
bz |
Minor whitespace cleanup.
|
#
151450 |
|
18-Oct-2005 |
jhb |
Move the initialization of the devmtx into the mutex_init() function called during early init before cninit().
Tested on: i386, alpha, sparc64 Reviewed by: phk, imp Reported by: Divacky Roman xdivac02 at stud dot fit dot vutbr dot cz MFC after: 1 week
|
#
150793 |
|
01-Oct-2005 |
phk |
Make sure the clone lists are sorted in the right order.
Explosion triggered by: pjd MFC: 3 days
|
#
150342 |
|
19-Sep-2005 |
phk |
Rewamp DEVFS internals pretty severely [1].
Give DEVFS a proper inode called struct cdev_priv. It is important to keep in mind that this "inode" is shared between all DEVFS mountpoints, therefore it is protected by the global device mutex.
Link the cdev_priv's into a list, protected by the global device mutex. Keep track of each cdev_priv's state with a flag bit and of references from mountpoints with a dedicated usecount.
Reap the benefits of much improved kernel memory allocator and the generally better defined device driver APIs to get rid of the tables of pointers + serial numbers, their overflow tables, the atomics to muck about in them and all the trouble that resulted in.
This makes RAM the only limit on how many devices we can have.
The cdev_priv is actually a super struct containing the normal cdev as the "public" part, and therefore allocation and freeing has moved to devfs_devs.c from kern_conf.c.
The overall responsibility is (to be) split such that kern/kern_conf.c is the stuff that deals with drivers and struct cdev and fs/devfs handles filesystems and struct cdev_priv and their private liason exposed only in devfs_int.h.
Move the inode number from cdev to cdev_priv and allocate inode numbers properly with unr. Local dirents in the mountpoints (directories, symlinks) allocate inodes from the same pool to guarantee against overlaps.
Various other fields are going to migrate from cdev to cdev_priv in the future in order to hide them. A few fields may migrate from devfs_dirent to cdev_priv as well.
Protect the DEVFS mountpoint with an sx lock instead of lockmgr, this lock also protects the directory tree of the mountpoint.
Give each mountpoint a unique integer index, allocated with unr. Use it into an array of devfs_dirent pointers in each cdev_priv. Initially the array points to a single element also inside cdev_priv, but as more devfs instances are mounted, the array is extended with malloc(9) as necessary when the filesystem populates its directory tree.
Retire the cdev alias lists, the cdev_priv now know about all the relevant devfs_dirents (and their vnodes) and devfs_revoke() will pick them up from there. We still spelunk into other mountpoints and fondle their data without 100% good locking. It may make better sense to vector the revoke event into the tty code and there do a destroy_dev/make_dev on the tty's devices, but that's for further study.
Lots of shuffling of stuff and churn of bits for no good reason[2].
XXX: There is still nothing preventing the dev_clone EVENTHANDLER from being invoked at the same time in two devfs mountpoints. It is not obvious what the best course of action is here.
XXX: comment out an if statement that lost its body, until I can find out what should go there so it doesn't do damage in the meantime.
XXX: Leave in a few extra malloc types and KASSERTS to help track down any remaining issues.
Much testing provided by: Kris Much confusion caused by (races in): md(4)
[1] You are not supposed to understand anything past this point.
[2] This line should simplify life for the peanut gallery.
|
#
150148 |
|
15-Sep-2005 |
phk |
Retire unused dev_named() function.
|
#
149324 |
|
20-Aug-2005 |
phk |
Properly un-giant-trick the cdevsw in fini_cdevsw()
Tripped over by: Huang wen hui <huang@gddsn.org.cn>
|
#
149177 |
|
17-Aug-2005 |
phk |
Handle device drivers with D_NEEDGIANT in a way which does not penalize the 'good' drivers: Allocate a shadow cdevsw and populate it with wrapper functions which grab Giant
|
#
149147 |
|
16-Aug-2005 |
phk |
Remove stale comment.
|
#
149144 |
|
16-Aug-2005 |
phk |
Create a new internal .h file to communicate very private stuff from kern_conf.c to devfs.
For now just two prototypes, more to come.
|
#
147982 |
|
14-Jul-2005 |
rwatson |
When devfs cloning takes place, provide access to the credential of the process that caused the clone event to take place for the device driver creating the device. This allows cloned device drivers to adapt the device node based on security aspects of the process, such as the uid, gid, and MAC label.
- Add a cred reference to struct cdev, so that when a device node is instantiated as a vnode, the cloning credential can be exposed to MAC.
- Add make_dev_cred(), a version of make_dev() that additionally accepts the credential to stick in the struct cdev. Implement it and make_dev() in terms of a back-end make_dev_credv().
- Add a new event handler, dev_clone_cred, which can be registered to receive the credential instead of dev_clone, if desired.
- Modify the MAC entry point mac_create_devfs_device() to accept an optional credential pointer (may be NULL), so that MAC policies can inspect and act on the label or other elements of the credential when initializing the skeleton device protections.
- Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(), so that the pty clone credential is exposed to the MAC Framework.
While currently primarily focussed on MAC policies, this change is also a prerequisite for changes to allow ptys to be instantiated with the UID of the process looking up the pty. This requires further changes to the pty driver -- in particular, to immediately recycle pty nodes on last close so that the credential-related state can be recreated on next lookup.
Submitted by: Andrew Reisse <andrew.reisse@sparta.com> Obtained from: TrustedBSD Project Sponsored by: SPAWAR, SPARTA MFC after: 1 week MFC note: Merge to 6.x, but not 5.x for ABI reasons
|
#
144385 |
|
31-Mar-2005 |
phk |
cdev (still) needs per instance uid/gid/mode
Add unlocked version of dev_ref()
Clean up various stuff in sys/conf.h
|
#
144384 |
|
31-Mar-2005 |
phk |
Rename dev_ref() to dev_refl()
|
#
144292 |
|
29-Mar-2005 |
phk |
Remove the global cdev hash and use the cdevsw list instead.
Don't remove the now unused element from cdev yet, wait until we have a better reason to bump the version.
There is now no longer any upper limit on how many device drivers a FreeBSD kernel can have.
|
#
144281 |
|
29-Mar-2005 |
phk |
Remove the global cdev hash and use the cdevsw list instead.
Don't remove the now unused element from cdev yet, wait until we have a better reason to bump the version.
|
#
144279 |
|
29-Mar-2005 |
phk |
Privatize major().
|
#
143748 |
|
17-Mar-2005 |
phk |
Kill MAJOR_AUTO
|
#
143746 |
|
17-Mar-2005 |
phk |
Prepare for the final onslaught on devices:
Move uid/gid/mode from cdev to cdevsw.
Add kind field to use for devd(8) later.
Bump both D_VERSION and __FreeBSD_version
|
#
143639 |
|
15-Mar-2005 |
phk |
Remove findcdev().
|
#
143631 |
|
15-Mar-2005 |
phk |
Rename cdev->si_udev to cdev->si_drv0 to reflect the new nature of the field.
|
#
143381 |
|
10-Mar-2005 |
phk |
Try to fix the mess I made of devname, with the minimal subset of the larger minor/major patch which was posted for testing.
|
#
143282 |
|
08-Mar-2005 |
phk |
Fix signedness of minor2unit().
|
#
142726 |
|
27-Feb-2005 |
phk |
Also handle d_maj hints from cloning drivers correctly.
|
#
142724 |
|
27-Feb-2005 |
phk |
Whine about any drivers which hardcode the device major number.
|
#
142702 |
|
27-Feb-2005 |
phk |
Use dynamic major number allocation for /dev/console, there is no longer any benefit from hard wiring it.
Remove special hack used to wire major to zero despite zero having a different magic meaning as well.
|
#
142242 |
|
22-Feb-2005 |
phk |
Reap more benefits from DEVFS:
List devfs_dirents rather than vnodes off their shared struct cdev, this saves a pointer field in the vnode at the expense of a field in the devfs_dirent. There are often 100 times more vnodes so this is bargain. In addition it makes it harder for people to try to do stypid things like "finding the vnode from cdev".
Since DEVFS handles all VCHR nodes now, we can do the vnode related cleanup in devfs_reclaim() instead of in dev_rel() and vgonel(). Similarly, we can do the struct cdev related cleanup in dev_rel() instead of devfs_reclaim().
rename idestroy_dev() to destroy_devl() for consistency.
Add LIST_ENTRY de_alias to struct devfs_dirent. Remove v_specnext from struct vnode. Change si_hlist to si_alist in struct cdev. String new devfs vnodes' devfs_dirent on si_alist when we create them and take them off in devfs_reclaim().
Fix devfs_revoke() accordingly. Also don't clear fields devfs_reclaim() will clear when called from vgone();
Let devfs_reclaim() call dev_rel() instead of vgonel().
Move the usecount tracking from dev_rel() to devfs_reclaim(), and let dev_rel() take a struct cdev argument instead of vnode.
Destroy SI_CHEAPCLONE devices in dev_rel() (instead of devfs_reclaim()) when they are no longer used. (This should maybe happen in devfs_close() instead.)
|
#
142232 |
|
22-Feb-2005 |
phk |
Make dev_ref() require the dev_lock() to be held and use it from devfs instead of directly frobbing the si_refcount.
|
#
140969 |
|
29-Jan-2005 |
phk |
Use MAXMINOR
|
#
140964 |
|
29-Jan-2005 |
phk |
Typo.
|
#
140963 |
|
29-Jan-2005 |
phk |
Add MAXMINOR #define, we should have had this long time ago.
Add minor2unit() in addition to dev2unit() and unit2minor().
If it wasn't such a hazzle we should redefine minor numbers in the kernel without the gap for the major number, but it's not worth the bother (yet).
|
#
140733 |
|
24-Jan-2005 |
phk |
Fix a list corruption issue in cloning device management using the western strategy ("allocate first, ask questions later") so we can extend the devmtx coverage to the clone list.
|
#
136947 |
|
25-Oct-2004 |
phk |
Get rid of the magic "stash" of cdev structures, we no longer call make_dev() before malloc works.
|
#
136014 |
|
01-Oct-2004 |
phk |
Fix a LOR relating to freeing cdevs.
|
#
135934 |
|
29-Sep-2004 |
green |
Account for alias devices when tearing them down in destroy_dev() so we don't panic on a NULL cdev->si_devsw.
|
#
135844 |
|
27-Sep-2004 |
phk |
Used cached cdevsw pointer.
|
#
135843 |
|
27-Sep-2004 |
phk |
Add cdevsw->d_purge() support.
This device method shall wake up any threads sleeping in the device driver and make the depart the drivers code for good.
|
#
135726 |
|
24-Sep-2004 |
phk |
Remove the cdevsw() function which is now unused.
|
#
135712 |
|
24-Sep-2004 |
phk |
Hold threadref while we throb cdevsw in devtoname()
|
#
135704 |
|
24-Sep-2004 |
phk |
Introduce dev_re[lf]thread() functions.
dev_refthread() will return the cdevsw pointer or NULL. If the return value is non-NULL a threadcount is held which much be released with dev_relthread(). If the returned cdevsw is NULL no threadcount is held on the device.
|
#
135600 |
|
23-Sep-2004 |
phk |
Do not refcount the cdevsw, but rather maintain a cdev->si_threadcount of the number of threads which are inside whatever is behind the cdevsw for this particular cdev.
Make the device mutex visible through dev_lock() and dev_unlock(). We may want finer granularity later.
Replace spechash_mtx use with dev_lock()/dev_unlock().
|
#
135138 |
|
13-Sep-2004 |
phk |
Create struct snapdata which contains the snapshot fields from cdev and the previously malloc'ed snapshot lock.
Malloc struct snapdata instead of just the lock.
Replace snapshot fields in cdev with pointer to snapdata (saves 16 bytes).
While here, give the private readblock() function a vnode argument in preparation for moving UFS to access GEOM directly.
|
#
134501 |
|
29-Aug-2004 |
pjd |
Add a missing '\n'.
|
#
133741 |
|
15-Aug-2004 |
jmg |
Add locking to the kqueue subsystem. This also makes the kqueue subsystem a more complete subsystem, and removes the knowlege of how things are implemented from the drivers. Include locking around filter ops, so a module like aio will know when not to be unloaded if there are outstanding knotes using it's filter ops.
Currently, it uses the MTX_DUPOK even though it is not always safe to aquire duplicate locks. Witness currently doesn't support the ability to discover if a dup lock is ok (in some cases).
Reviewed by: green, rwatson (both earlier versions)
|
#
131996 |
|
11-Jul-2004 |
phk |
Better descriptions of the cdev malloc class and mutex.
|
#
130936 |
|
22-Jun-2004 |
le |
Fix a few spelling mistakes in comments and clean them up a bit.
|
#
130640 |
|
17-Jun-2004 |
phk |
Second half of the dev_t cleanup.
The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev()
Various minor adjustments including handling of userland access to kernel space struct cdev etc.
|
#
130585 |
|
16-Jun-2004 |
phk |
Do the dreaded s/dev_t/struct cdev */ Bump __FreeBSD_version accordingly.
|
#
129943 |
|
01-Jun-2004 |
phk |
Introduce a ttyioctl() cdevsw default function.
|
#
126849 |
|
11-Mar-2004 |
phk |
Correctly account for extra bits in unit numbers when looking for next free unit.
|
#
126845 |
|
11-Mar-2004 |
phk |
Add clone_setup() function rather than rely on lazy initialization.
Requested by: rwatson
|
#
126156 |
|
23-Feb-2004 |
phk |
Fix two oversights here: don't trash the freelist, and properly cleanup the cdevsw{}.
Submitted by: tegge
|
#
126082 |
|
21-Feb-2004 |
phk |
Device megapatch 6/6:
This is what we came here for: Hang dev_t's from their cdevsw, refcount cdevsw and dev_t and generally keep track of things a lot better than we used to:
Hold a cdevsw reference around all entrances into the device driver, this will be necessary to safely determine when we can unload driver code.
Hold a dev_t reference while the device is open.
KASSERT that we do not enter the driver on a non-referenced dev_t.
Remove old D_NAG code, anonymous dev_t's are not a problem now.
When destroy_dev() is called on a referenced dev_t, move it to dead_cdevsw's list. When the refcount drops, free it.
Check that cdevsw->d_version is correct. If not, set all methods to the dead_*() methods to prevent entrance into driver. Print warning on console to this effect. The device driver may still explode if it is also incompatible with newbus, but in that case we probably didn't get this far in the first place.
|
#
126081 |
|
21-Feb-2004 |
phk |
Device megapatch 5/6:
Remove the unused second argument from udev2dev().
Convert all remaining users of makedev() to use udev2dev(). The semantic difference is that udev2dev() will only locate a pre-existing dev_t, it will not line makedev() create a new one.
Apart from the tiny well controlled windown in D_PSEUDO drivers, there should no longer be any "anonymous" dev_t's in the system now, only dev_t's created with make_dev() and make_dev_alias()
|
#
126080 |
|
21-Feb-2004 |
phk |
Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION.
Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
|
#
126078 |
|
21-Feb-2004 |
phk |
Device megapatch 3/6:
Add missing D_TTY flags to various drivers.
Complete asserts that dev_t's passed to ttyread(), ttywrite(), ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty pointer.
Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default cdevsw methods for D_TTY drivers and remove the explicit initializations in various drivers cdevsw structures.
|
#
126077 |
|
21-Feb-2004 |
phk |
Device megapatch 2/6:
This commit adds a couple of functions for pseudodrivers to use for implementing cloning in a manner we will be able to lock down (shortly).
Basically what happens is that pseudo drivers get a way to ask for "give me the dev_t with this unit number" or alternatively "give me a dev_t with the lowest guaranteed free unit number" (there is unfortunately a lot of non-POLA in the exact numeric value of this number, just live with it for now)
Managing the unit number space this way removes the need to use rman(9) to do so in the drivers this greatly simplifies the code in the drivers because even using rman(9) they still needed to manage their dev_t's anyway.
I have taken the if_tun, if_tap, snp and nmdm drivers through the mill, partly because they (ab)used makedev(), but mostly because together they represent three different problems for device-cloning:
if_tun and snp is the plain case: just give me a device.
if_tap has two kinds of devices, with a flag for device type.
nmdm has paired devices (ala pty) can you can clone either of them.
|
#
125850 |
|
15-Feb-2004 |
bde |
Fixed style bugs near previous commit (mainly formatting errors and missing parentheses). Use default handling (trap to debugger) for udev2dev(x, 1) since it is an error and doesn't happen anywhere in the sys tree except in bogusly commented out code in coda.
|
#
125846 |
|
15-Feb-2004 |
phk |
Split the initialization of the cdevsw into a separate function.
|
#
125800 |
|
14-Feb-2004 |
phk |
Remove the check which used to protect us against make_dev() being called until DEVFS had a chance to initialize. Since DEVFS is mandatory and things over in that department coincidentally works from without any initialization now, this is safe.
|
#
120560 |
|
28-Sep-2003 |
phk |
Retire revoke_and_destroy_dev() with extreme prejudice.
|
#
120529 |
|
27-Sep-2003 |
phk |
Make life a little bit easier for cloning device drivers.
|
#
120514 |
|
27-Sep-2003 |
phk |
Introduce no_poll() default method for device drivers. Have it do exactly the same as vop_nopoll() for consistency and put a comment in the two pointing at each other.
Retire seltrue() in favour of no_poll().
Create private default functions in kern_conf.c instead of public ones.
Change default strategy to return the bio with ENODEV instead of doing nothing which would lead the bio stranded.
Retire public nullopen() and nullclose() as well as the entire band of public no{read,write,ioctl,mmap,kqfilter,strategy,poll,dump} funtions, they are the default actions now.
Move the final two trivial functions from subr_xxx.c to kern_conf.c and retire the now empty subr_xxx.c
|
#
120506 |
|
27-Sep-2003 |
phk |
The present defaults for the open and close for device drivers which provide no methods does not make any sense, and is not used by any driver.
It is a pretty hard to come up with even a theoretical concept of a device driver which would always fail open and close with ENODEV.
Change the defaults to be nullopen() and nullclose() which simply does nothing.
Remove explicit initializations to these from the drivers which already used them.
|
#
116182 |
|
10-Jun-2003 |
obrien |
Use __FBSDID().
|
#
115541 |
|
31-May-2003 |
phk |
Remove return after panic.
Found by: FlexeLint
|
#
113441 |
|
13-Apr-2003 |
phk |
Since dynamic allocation of device major numbers so far have not resulted in any earthquakes, civil wars or early onset hair-loss, I think we can do without the printf announcing the assigned number.
|
#
112035 |
|
09-Mar-2003 |
phk |
Add one little hack to allow us to make MAJOR_AUTO be zero:
Let the console driver ask for major 256 and magically change this to mean zero.
|
#
111815 |
|
03-Mar-2003 |
phk |
Gigacommit to improve device-driver source compatibility between branches:
Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values.
This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386.
Approved by: re(scottl)
|
#
111760 |
|
02-Mar-2003 |
phk |
Explicitly initialize all cdevsw methods with the relevant nofoo() function if they are NULL.
|
#
111735 |
|
02-Mar-2003 |
phk |
NO_GEOM cleanup:
Remove cdevsw->d_size() implementation. No longer needed.
|
#
111730 |
|
02-Mar-2003 |
phk |
NODEVFS cleanup:
Replace devfs_{create,destroy} hooks with direct function calls.
|
#
111626 |
|
27-Feb-2003 |
phk |
Add the flip-side check: If a driver wants a particular major#, make sure it is marked as allocated in reserved_majors[]. Whine if it wasn't.
|
#
111622 |
|
27-Feb-2003 |
phk |
Add support for allocating a device driver major number on demand.
To do this, initialize the d_maj member of the cdevsw to MAJOR_AUTO. When the cdevsw is first passed to make_dev() a free major number will be assigned.
Until we have a bit more experience with this a printf will announce this fact.
Major numbers are not reclaimed, so loading/unloading the same device driver which uses MAJOR_AUTO will eventually deplete the pool of free major numbers and the system will panic when it can not allocate one. Still undecided who to invonvenience with the solution to this.
|
#
111600 |
|
27-Feb-2003 |
phk |
NODEVFS cleanup:
Remove cdevsw_add() and cdevsw_remove(), they served us well for a long time. Bump __FreeBSD_version to 500104 to mark this.
|
#
111220 |
|
21-Feb-2003 |
phk |
NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.
Dumper_t takes a void * as first arg which is more general than the dev_t taken by d_dump_t. (Remember: we could have net-dumpers if somebody wrote us one!)
Define the convention for GEOM controlled disk devices to be that the first argument to the dumper function is the struct disk pointer.
Change device drivers accordingly.
|
#
111179 |
|
20-Feb-2003 |
phk |
Add a dead_cdevsw which does its best to return ENXIO if at all possible.
In devsw() return dead_cdevsw instead of NULL in case the dev_t does not have a si_devsw.
This may improve our survival chances with devices which go away unexpectedly.
|
#
111146 |
|
19-Feb-2003 |
phk |
Add M_WAITOK
|
#
110318 |
|
04-Feb-2003 |
phk |
Implement proper bounds-checking and truncation of device names, this has become an issue now that end-user controlable attributes can become devices names with the geom_vol_ffs class.
|
#
110317 |
|
04-Feb-2003 |
phk |
Pave the road to removing the fixed size limit on device nodes:
Change the si_name of dev_t's to be a char * and put a private buffer for holding the name at then end of the struct.
Initialize si_name to point to the private buffer.
Put a KASSERT in geom_disk to prevent overrun on the fake dev_t we still have to generate for the disk_drivers.
|
#
110115 |
|
30-Jan-2003 |
phk |
NO_GEOM cleanup: unifdef;
|
#
110060 |
|
29-Jan-2003 |
phk |
NODEVFS cleanup: Remove cdevsw[].
This implicitly removes the need for major numbers, but a number of drivers still know things they shouldn't need to, and we need to consider if there are applications which cache major(+minor) gleaned from stat(2) and rely on it being constant over reboots before we start assigning random majors.
|
#
109563 |
|
20-Jan-2003 |
phk |
disk_dev_synth() is a NO_GEOM hack.
|
#
109527 |
|
19-Jan-2003 |
phk |
Mark more code #ifdef NODEVFS
|
#
109526 |
|
19-Jan-2003 |
phk |
Originally when DEVFS was added, a global variable "devfs_present" was used to control code which were conditional on DEVFS' precense since this avoided the need for large-scale source pollution with #include "opt_geom.h"
Now that we approach making DEVFS standard, replace these tests with an #ifdef to facilitate mechanical removal once DEVFS becomes non-optional.
No functional change by this commit.
|
#
108365 |
|
28-Dec-2002 |
phk |
Remove unused cdevsw_ALLOCSTART macro.
|
#
104523 |
|
05-Oct-2002 |
green |
Don't allow dev_stdclone(9) to accept minors larger than the system is able to handle (0xffffff).
|
#
104043 |
|
27-Sep-2002 |
phk |
Rename struct specinfo to the more appropriate struct cdev.
Agreed on: jake, rwatson, jhb
|
#
103722 |
|
20-Sep-2002 |
phk |
Assert my copyright on this file (using the default 2-clause BSD).
The vast majority of the contents is from my keyboard and no significant pieces remain of the former copyright holders code.
|
#
103101 |
|
08-Sep-2002 |
phk |
Fix a logic bug in the struct dev_t allocation code.
Spotted by: Neelkanth Natu <neelnatu@yahoo.com>
|
#
95446 |
|
25-Apr-2002 |
bde |
Break the following implementation of panic(3):
#!bin/sh
# Original version of this by Michael Reifenberger # <root@nihil.plaut.de>.
mdconfig -d -u 11 >/dev/null 2>&1 dd if=/dev/zero of=zz bs=1m count=1
while : do mdconfig -a -t vnode -f zz -u 11 fdisk -f - -iv /dev/md11 <<EOF1 g c1 h64 s32 p 1 165 0 2048 a 1 EOF1 mdconfig -d -u 11 done
Garbage pointers in __si_u were not cleared by destroy_dev(). Not clearing si_disk made the above fatal because the disk layer uses si_disk as a flag to indicate that the dev_t has been completely initialized. disk_destroy() clears si_disk for the parent dev_t but doesn't get called for children.
Not fixed: - setting the undocumented sysctl debug.free_devt should cause more complete destruction of the dev_t including clearing of __si_u, but actually causes the above to panic a little earlier. - the loop leaks 10 memory allocations per iteration (4 DEVFS, 2 devbuf and 4 dev_t).
Reviewed by: timeout by MAINTAINER after 3 months
|
#
91998 |
|
10-Mar-2002 |
phk |
Make the proposed name arg to dev_stdclone() const.
|
#
90737 |
|
16-Feb-2002 |
green |
(Doing that whole test-immediately-after-commit-thing like obrien sez:) Forgot to include lock.h and mutex.h for GIANT_REQUIRED.
|
#
90736 |
|
16-Feb-2002 |
green |
Add revoke_and_destroy_dev(), to be used by devices which decide when they choose to destroy themselves without regard to whether or not they are open.
|
#
89118 |
|
09-Jan-2002 |
msmith |
Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST, and devices can be created anytime after that.
Print a warning if an atttempt is made to create a device too early.
|
#
86462 |
|
16-Nov-2001 |
phk |
Back out the previous fix to the leading zero problem, I hadn't noticed it in there already. That should teach me to check exit code from cvsup.
|
#
86461 |
|
16-Nov-2001 |
phk |
Reject leading zeros in dev_stdclone().
PR: 32019 Submitted by: fenner
|
#
86431 |
|
15-Nov-2001 |
fenner |
Do not allow leading zeros on device names in dev_stdclone().
PR: kern/32019 Reviewed by: phk
|
#
85624 |
|
28-Oct-2001 |
phk |
Fix a problem in the disk related hack where device nodes for a physically non-existent disk in a legacy /dev on a DEVFS system would panic the system if stat(2)'ed.
Do not whine about anonymous device nodes not having a si_devsw, they're not supposed to.
|
#
85603 |
|
27-Oct-2001 |
phk |
Nudge the axe a bit closer to cdevsw[]:
Make it a panic to repeat make_dev() or destroy_dev(), this check should maybe be neutered when -current goes -stable.
Whine if devsw() is called on anon dev_t's in a devfs system.
Make a hack to avoid our lazy-eval disk code triggering the above whine.
Fix the multiple make_dev() in disk code by making ${disk}${unit}s${slice} an alias/symlink to ${disk}${unit}s${slice}c
|
#
85539 |
|
26-Oct-2001 |
phk |
Make cdevsw[] static.
|
#
85076 |
|
17-Oct-2001 |
jlemon |
Add dev_named(dev, name), which is similar in spirit to devtoname(). This function returns success if the device is known by either 'name' or any of its aliases.
|
#
83366 |
|
12-Sep-2001 |
julian |
KSE Milestone 2 Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process.
Sorry john! (your next MFC will be a doosie!)
Reviewed by: peter@freebsd.org, dillon@freebsd.org
X-MFC after: ha ha ha ha
|
#
81068 |
|
02-Aug-2001 |
imp |
Make the fmt arguments to make_dev and make_dev_alias const char *.
Approved on IRC as long as it didn't cause a large number of warnings by: phk
MFC After: 700 hours
|
#
77215 |
|
26-May-2001 |
phk |
Create a general facility for making dev_t's depend on another dev_t. The dev_depends(dev_t, dev_t) function is for tying them to each other.
When destroy_dev() is called on a dev_t, all dev_t's depending on it will also be destroyed (depth first order).
Rewrite the make_dev_alias() to use this dependency facility.
kern/subr_disk.c: Make the disk mini-layer use dependencies to make sure all relevant dev_t's are removed when the disk disappears.
Make the disk mini-layer precreate some magic sub devices which the disk/slice/label code expects to be there.
kern/subr_disklabel.c: Remove some now unneeded variables.
kern/subr_diskmbr.c: Remove some ancient, commented out code.
kern/subr_diskslice.c: Minor cleanup. Use name from dev_t instead of dsname()
|
#
75519 |
|
14-Apr-2001 |
brian |
Call strlen() once instead of twice.
|
#
74522 |
|
20-Mar-2001 |
phk |
Add a KASSERT on unit2minor() so that we catch it if people try to pass us unit numbers which doesn't fit in 24 bits.
|
#
73942 |
|
07-Mar-2001 |
mckusick |
Fixes to track snapshot copy-on-write checking in the specinfo structure rather than assuming that the device vnode would reside in the FFS filesystem (which is obviously a broken assumption with the device filesystem).
|
#
71920 |
|
02-Feb-2001 |
brian |
KASSERT that the minor number passed to make_dev() is valid.
|
#
71342 |
|
21-Jan-2001 |
phk |
Convert a Debugger(3) to a panic(9) and a EINVAL.
Reminded by: bde
|
#
69781 |
|
08-Dec-2000 |
dwmalone |
Convert more malloc+bzero to malloc+M_ZERO.
Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
|
#
69774 |
|
08-Dec-2000 |
phk |
Staticize some malloc M_ instances.
|
#
68585 |
|
10-Nov-2000 |
jhb |
Axe some unused variables.
|
#
68063 |
|
31-Oct-2000 |
phk |
Deprecate devsw->d_bmaj entirely.
This removes support for booting current kernels with very old bootblocks.
Device driver writers: Please remove initializations for the d_bmaj field in your cdevsw{}.
|
#
67905 |
|
29-Oct-2000 |
phk |
Allow all users to access the dev -> devname sysctl.
|
#
66067 |
|
19-Sep-2000 |
phk |
Rename lminor() to dev2unit(). This function gives a linear unit number which hides the 'hole' in the minor bits.
Introduce unit2minor() to do the reverse operation.
Fix some some make_dev() calls which didn't use UID_* or GID_* macros.
Kill the v_hashchain alias macro, it hides the real relationship.
Introduce experimental SI_CHEAPCLONE flag set it on cloned bpfs.
|
#
65747 |
|
11-Sep-2000 |
phk |
revent multiple make_dev() calls on the same dev_t and similar bogosities. A couple of new warnings may be emitted during boot if drivers DTWT.
Tested by: George Cox <gjvc@gjvc.com>
|
#
65632 |
|
09-Sep-2000 |
phk |
Add code to devname(3) so it can find the names of devices which were not present when dev_mkdb(8) was run.
First the dev_mkdb(8) database is searched, this caters for non-DEVFS cases where people have renamed a device.
If that fails we ask the kernel using sysctl kern.devname if the device driver has put a name in the dev_t. This covers DEVFS cloned devices.
If that also fails we format a string which isn't entirely useless.
|
#
65374 |
|
02-Sep-2000 |
phk |
Avoid the modules madness I inadvertently introduced by making the cloning infrastructure standard in kern_conf. Modules are now the same with or without devfs support.
If you need to detect if devfs is present, in modules or elsewhere, check the integer variable "devfs_present".
This happily removes an ugly hack from kern/vfs_conf.c.
This forces a rename of the eventhandler and the standard clone helper function.
Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include like <sys/queue.h>
Remove all #includes of opt_devfs.h they no longer matter.
|
#
64880 |
|
20-Aug-2000 |
phk |
Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)
Remove old DEVFS support fields from dev_t.
Make uid, gid & mode members of dev_t and set them in make_dev().
Use correct uid, gid & mode in make_dev in disk minilayer.
Add support for registering alias names for a dev_t using the new function make_dev_alias(). These will show up as symlinks in DEVFS.
Use makedev() rather than make_dev() for MFSs magic devices to prevent DEVFS from noticing this abuse.
Add a field for DEVFS inode number in dev_t.
Add new DEVFS in fs/devfs.
Add devfs cloning to: disk minilayer (ie: ad(4), sd(4), cd(4) etc etc) md(4), tun(4), bpf(4), fd(4)
If DEVFS add -d flag to /sbin/inits args to make it mount devfs.
Add commented out DEVFS to GENERIC
|
#
60938 |
|
26-May-2000 |
jake |
Back out the previous change to the queue(3) interface. It was not discussed and should probably not happen.
Requested by: msmith and others
|
#
60833 |
|
23-May-2000 |
jake |
Change the way that the queue(3) structures are declared; don't assume that the type argument to *_HEAD and *_ENTRY is a struct.
Suggested by: phk Reviewed by: phk Approved by: mdodd
|
#
60281 |
|
09-May-2000 |
phk |
Change the "bdev-whiner" to whine when open is attempted and extend the deadline a month.
|
#
58573 |
|
25-Mar-2000 |
kris |
Reword warning to make it clearer (I read it as "remove block devices created before 2000-06-01" which is obviously not what was intended :-)
|
#
58447 |
|
21-Mar-2000 |
phk |
Whine at users who still have block devices in /dev, give them until june 1st to fix their system.
|
#
56465 |
|
23-Jan-2000 |
bp |
Backout previous commit. It was a mistake.
|
#
56459 |
|
23-Jan-2000 |
bp |
Replace non obvious number with SPECNAMELEN constant.
Reviewed by: phk
|
#
55414 |
|
04-Jan-2000 |
phk |
Be more careful about NOUDEV and NODEV.
Submitted by: bde
|
#
53899 |
|
29-Nov-1999 |
phk |
Report swapdevices as cdevs rather than bdevs.
Remove unused dev2budev() function.
|
#
53896 |
|
29-Nov-1999 |
phk |
Remove the now unused chrtoblk() function.
|
#
53006 |
|
08-Nov-1999 |
peter |
Zap devsw_module_handler().
|
#
53000 |
|
08-Nov-1999 |
phk |
Rename remove_dev() to destroy_dev().
Nagged about by: msmith
|
#
52965 |
|
07-Nov-1999 |
phk |
Remove the devsw magic from DEV_MODULE()
|
#
51927 |
|
04-Oct-1999 |
phk |
A little step further in the dev_t cleanups:
Refuse to register a bmajor if the D_DISK flag is not set in cdevsw.
A little bit of cleanup while here.
|
#
51225 |
|
13-Sep-1999 |
bde |
Const'ify devtoname() and d_name. This exposes some errors (2 non-benign).
Handle negative minor numbers properly in devtoname().
|
#
50549 |
|
29-Aug-1999 |
phk |
Add dev_t freeing code. Controlled by sysctl debug.free_devt, default is off.
|
#
50522 |
|
28-Aug-1999 |
phk |
Put a brief comment on a couple of #defines.
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
50254 |
|
23-Aug-1999 |
phk |
Convert DEVFS hooks in (most) drivers to make_dev().
Diskslice/label code not yet handled.
Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers)
Add the correct hook for devfs to kern_conf.c
The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases.
A few drivers had minor additional cleanups performed relating to cdevsw registration.
A few drivers don't register a cdevsw{} anymore, but only use make_dev().
|
#
50092 |
|
20-Aug-1999 |
julian |
First small steps at merging DEVFS and PHK's Dev_t stuff.
|
#
49982 |
|
17-Aug-1999 |
billf |
Welcome devtoname(), to most likely be used when printing information about a dev_t.
printf("%x", dev) now becomes printf("%s", devtoname(dev)) because printing actual information about the device is much more useful then printing a pointer to an address that would never help the developer debug.
Submitted by: phk, bde
|
#
49826 |
|
15-Aug-1999 |
phk |
Introduce lminor(dev_t dev), which returns a linear minor number, ie: hides the fact that the major number is stuck in the middle.
|
#
49679 |
|
13-Aug-1999 |
phk |
The bdevsw() and cdevsw() are now identical, so kill the former.
|
#
49535 |
|
08-Aug-1999 |
phk |
Decommision miscfs/specfs/specdev.h. Most of it goes into <sys/conf.h>, a few lines into <sys/vnode.h>.
Add a few fields to struct specinfo, paving the way for the fun part.
|
#
49504 |
|
07-Aug-1999 |
grog |
cdevsw_remove: place correct value in bmaj2cmaj. This had caused warnings of the following nature on reloading a kld:
WARNING: "vinum" is usurping "console"'s bmaj
This only applies to cases where "console" is mentioned.
Broken-by: grog
|
#
48949 |
|
20-Jul-1999 |
green |
Fix a REALLY embarrassing mistake. Don't look; I warned you.
|
#
48948 |
|
20-Jul-1999 |
green |
Make a dev2budev() function, and use it. This refixes pstat (working, broken, working, broken, working) and savecore (working, working, broken, working, working).
Sorta Reviewed by: phk
|
#
48936 |
|
20-Jul-1999 |
phk |
Now a dev_t is a pointer to struct specinfo which is shared by all specdev vnodes referencing this device.
Details: cdevsw->d_parms has been removed, the specinfo is available now (== dev_t) and the driver should modify it directly when applicable, and the only driver doing so, does so: vn.c. I am not sure the logic in checking for "<" was right before, and it looks even less so now.
An intial pool of 50 struct specinfo are depleted during early boot, after that malloc had better work. It is likely that fewer than 50 would do.
Hashing is done from udev_t to dev_t with a prime number remainder hash, experiments show no better hash available for decent cost (MD5 is only marginally better) The prime number used should not be close to a power of two, we use 83 for now.
Add new checkalias2() to get around the loss of info from dev2udev() in bdevvp();
The aliased vnodes are hung on a list straight of the dev_t, and speclisth[SPECSZ] is unused. The sharing of struct specinfo means that the v_specnext moves into the vnode which grows by 4 bytes.
Don't use a VBLK dev_t which doesn't make sense in MFS, now we hang a dummy cdevsw on B/Cmaj 253 so that things look sane.
Storage overhead from all of this is O(50k).
Bump __FreeBSD_version to 400009
The next step will add the stuff needed so device-drivers can start to hang things from struct specinfo
|
#
48892 |
|
19-Jul-1999 |
phk |
[click] Now all dev_t's in the kernel have their char device major.
Only know casualy of this is swapinfo/pstat which should be fixes the right way: Store the actual pathname in the kernel like mount does. [Volounteers sought for this task]
The road map from here is roughly: expand struct specinfo into struct based dev_t. Add dev_t registration facilities for device drivers and start to use them.
|
#
48864 |
|
17-Jul-1999 |
phk |
Use 256 as magic in bmaj2cmaj[]. Treat BLK/CHR dev_t more correctly.
|
#
48859 |
|
17-Jul-1999 |
phk |
I have not one single time remembered the name of this function correctly so obviously I gave it the wrong name. s/umakedev/makeudev/g
|
#
48557 |
|
04-Jul-1999 |
phk |
Remove cmaj and bmaj args from DEV_DRIVER_MODULE.
|
#
48510 |
|
03-Jul-1999 |
phk |
Warn about drivers which take over other drivers cdevsw entries, but still grant them squatters right.
|
#
48240 |
|
26-Jun-1999 |
dfr |
* Call cdevsw_remove from the MOD_UNLOAD event. * Fix a couple of warnings while I'm here.
|
#
48211 |
|
25-Jun-1999 |
grog |
Add function cdevsw_remove, the opposite of cdevsw_add: remove an entry in cdevsw (and bdevsw if appropriate).
Reviewed-by: phk
|
#
47687 |
|
01-Jun-1999 |
dt |
|| vs && confusion in cdevsw_add().
|
#
47680 |
|
01-Jun-1999 |
phk |
Introduce the makebdev() function, it does the same as the makedev() function for now, but that will change.
|
#
47640 |
|
31-May-1999 |
phk |
Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing.
cdevsw_add() will print an message if the d_maj field looks bogus.
Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL.
Move bdevsw() and devsw() functions to kern/kern_conf.c
Bump __FreeBSD_version to 400006
This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions
if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.
I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
|
#
47300 |
|
18-May-1999 |
luoqi |
Avoid negative numbers in dev_t manipulation. This should fix recent MFS related crashes.
|
#
47069 |
|
12-May-1999 |
phk |
braino.
|
#
47066 |
|
12-May-1999 |
phk |
Produce compiler warning if dev_t and udev_t is confused.
|
#
47028 |
|
11-May-1999 |
phk |
Divorce "dev_t" from the "major|minor" bitmap, which is now called udev_t in the kernel but still called dev_t in userland.
Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev()
For now they're functions, they will become in-line functions after one of the next two steps in this process.
Return major/minor/makedev to macro-hood for userland.
Register a name in cdevsw[] for the "filedescriptor" driver.
In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device.
In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang).
A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that.
Without DEVT_FASCIST I belive this patch is a no-op.
Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result.
Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
|
#
46792 |
|
09-May-1999 |
phk |
Unconfuse DEV_MODULE() and DEV_DRIVER_MODULE() about the difference between a major number for a dev_t.
|
#
46775 |
|
09-May-1999 |
phk |
Peter beat me to half this patch, but didn't do the other half:
set d_bmaj
don't cast a dev_t to int before comparing to NODEV
|
#
46774 |
|
09-May-1999 |
peter |
Comment advising ordering of cdevsw_add and bdevsw_add is obsolete (no bdevsw_add any more).
|
#
46676 |
|
08-May-1999 |
phk |
I got tired of seeing all the cdevsw[major(foo)] all over the place.
Made a new (inline) function devsw(dev_t dev) and substituted it.
Changed to the BDEV variant to this format as well: bdevsw(dev_t dev)
DEVFS will eventually benefit from this change too.
|
#
46635 |
|
07-May-1999 |
phk |
Continue where Julian left off in July 1998:
Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline) function.
Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention to the order of the cmaj/bmaj arguments!)
Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE (ditto!)
(Next step will be to convert all bdev dev_t's to cdev dev_t's before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
|
#
44975 |
|
23-Mar-1999 |
dfr |
Call the module's unload handler before removing the device from the cdevsw list. This allows a handler to veto the load without losing its place in the list.
PR: kern/10653
|
#
43301 |
|
27-Jan-1999 |
dillon |
Fix warnings in preparation for adding -Wall -Wcast-qual to the kernel compile
|
#
41153 |
|
14-Nov-1998 |
wollman |
My changes to the new device interface:
- Interface wth the new resource manager. - Allow for multiple drivers implementing a single devclass. - Remove ordering dependencies between header files. - Style cleanup. - Add DEVICE_SUSPEND and DEVICE_RESUME methods. - Move to a single-phase interrupt setup scheme.
Kernel builds on the Alpha are brken until Doug gets a chance to incorporate these changes on that side.
Agreed to in principle by: dfr
|
#
40648 |
|
25-Oct-1998 |
phk |
Nitpicking and dusting performed on a train. Removes trivial warnings about unused variables, labels and other lint.
|
#
37389 |
|
04-Jul-1998 |
julian |
There is no such thing any more as "struct bdevsw".
There is only cdevsw (which should be renamed in a later edit to deventry or something). cdevsw contains the union of what were in both bdevsw an cdevsw entries. The bdevsw[] table stiff exists and is a second pointer to the cdevsw entry of the device. it's major is in d_bmaj rather than d_maj. some cleanup still to happen (e.g. dsopen now gets two pointers to the same cdevsw struct instead of one to a bdevsw and one to a cdevsw).
rawread()/rawwrite() went away as part of this though it's not strictly the same patch, just that it involves all the same lines in the drivers.
cdroms no longer have write() entries (they did have rawwrite (?)). tapes no longer have support for bdev operations.
Reviewed by: Eivind Eklund and Mike Smith Changes suggested by eivind.
|
#
37172 |
|
26-Jun-1998 |
phk |
Remove isdisk() hacks.
|
#
37153 |
|
25-Jun-1998 |
phk |
Remove bdevsw_add(), change the only two users to use bdevsw_add_generic(). Extend cdevsw to be superset of bdevsw. Remove non-functional bdev lkm support. Teach wcd what the open() args mean.
|
#
36735 |
|
07-Jun-1998 |
dfr |
This commit fixes various 64bit portability problems required for FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change.
The prototype FreeBSD/alpha machdep will follow in a couple of days time.
|
#
31352 |
|
22-Nov-1997 |
bde |
Staticized.
|
#
29888 |
|
27-Sep-1997 |
kato |
Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW bits of the mnt_flag. The sysctl variables, vfs.foo.doclusterread and vfs.foo.doclusterwrite are deleted. Only mount option can control clustered I/O from userland. 2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR and D_CLUSTERW bits of the d_flags member in the block device switch table. If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR / MNT_NOCLUSTERW bits will be set. In this case, MNT_NOCLUSTERR and MNT_NOCLUSTERW cannot be cleared from userland. 3. Vnode driver disables both clustered read and write. 4. Union filesystem disables clutered write.
Reviewed by: bde
|
#
29690 |
|
21-Sep-1997 |
julian |
urk, fix spelling error in comment I just fixed.
|
#
29688 |
|
21-Sep-1997 |
julian |
Fix a comment.
|
#
29361 |
|
14-Sep-1997 |
peter |
Various select -> poll changes
|
#
27845 |
|
02-Aug-1997 |
bde |
Removed unused #includes.
|
#
26358 |
|
02-Jun-1997 |
julian |
tiny spelling fix in comment
|
#
22975 |
|
22-Feb-1997 |
peter |
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not ready for it yet.
|
#
22521 |
|
10-Feb-1997 |
dyson |
This is the kernel Lite/2 commit. There are some requisite userland changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes.
The system boots and can mount UFS filesystems.
Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed.
Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
|
#
20174 |
|
06-Dec-1996 |
bde |
Fixed a null pointer panic in ADDENTRY(). Unloading the lkm and joy modules sort of works now. Their devswitch entries aren't cleaned up, so accessing them after they have been unloaded causes a panic in spec_open().
Submitted by: durian@plutotech.com (Mike Durian), IIRC
|
#
19229 |
|
28-Oct-1996 |
phk |
init_main.c: pass -d to init if DEVFS_ROOT kern_conf.c: gd driver is a disk. vfs_subr.c: include opt_devfs.h
|
#
17675 |
|
19-Aug-1996 |
julian |
for kern_conf.c, start allocating dynamic major numbers half way through the range rather than possibly colliding with fixed elements. Increase the size of the arrays to take this into account.. remember that each element in the array is now only 1 ponter so this isn't that much..
also note a possible bug in debugging code in uipc_socket2.c (add XXX)
|
#
17264 |
|
23-Jul-1996 |
phk |
Make a "DWIM" function for adding [bc]devsw entries for bdev drivers.
Saves about 280 butes of source per driver, 56 bytes in object size and another 56 bytes moves from data to bss.
No functional change intended nor expected.
GENERIC should be about one k smaller now :-)
|
#
12968 |
|
22-Dec-1995 |
phk |
kern_conf.c: remove a now unused variable. vfs_cache.c: Fix a very rare probelm in the vnode-cache. Submitted by: Terry Lambert <terry@lambert.org>
|
#
12954 |
|
21-Dec-1995 |
julian |
i386/i386/conf.c is no longer needed.. remove it from files.i386 redistribute a few last routines to beter places and shoot the file
I haven't act actually 'deleted' the file yet togive people time to have done a config.. I.e. they are likely to have done one in a week or so so I'll remove it then.. it's now empty. makes the question of a USL copyright rather moot.
|
#
12813 |
|
13-Dec-1995 |
julian |
devsw tables are now arrays of POINTERS to struct [cb]devsw seems to work hre just fine though I can't check every file that changed due to limmited h/w, however I've checked enught to be petty happy withe hte code..
WARNING... struct lkm[mumble] has changed so it might be an idea to recompile any lkm related programs
|
#
12675 |
|
08-Dec-1995 |
julian |
Pass 3 of the great devsw changes most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter)
If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :)
pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
|
#
12543 |
|
30-Nov-1995 |
julian |
A pair of really tiny patches that not only allow it all to compile but also IT ACTUALLY WORKS! FreeBSD with options JREMOD now runs with no entries in the devsw tables prior to the devices puting their own entries there..
Thanks to bde and terry for thoughts and comments. next stop 'Real' devfs support in devices.
|
#
12520 |
|
29-Nov-1995 |
julian |
#ifdef out nearly the entire file of conf.c when JREMOD is defined add a few safety checks in specfs because now it's possible to get entries in [cd]devsw[] which are ALL NULL so it's better to discover this BEFORE jumping into the d_open() entry..
more check to come later.. this getsthe code to the stage where I can start testing it, even if I haven't caught every little error case... I guess I'll find them quick enough..
|
#
11170 |
|
04-Oct-1995 |
julian |
fix REALLY STUPID bug/typo don't look at the diffs.. it's too embarassing :)
|
#
11127 |
|
02-Oct-1995 |
julian |
actually compiles.. (previous commit was to just get it into the tree)
|
#
11126 |
|
02-Oct-1995 |
julian |
Obtained from: well it has a relationship with the LKM code..
This is a place for all things to do with conf.c and conf.h that are not machine specific. Other things that are at present in i386/isa/conf.c might migrate into here.. It's the first small step in cleaning up the device interface to make it more dynamic and to assist in more modular drivers (i.e. both loadable via LKMs and linked in.. e.g able to add a device without having to edit conf.c)
this code is not yet used and the whole thing will be conditionally compiled in for a while till proven useful :)
|