summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
Commit message (Collapse)AuthorAgeFilesLines
* Reap more benefits from DEVFS:phk2005-02-221-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.)
* Make dev_ref() require the dev_lock() to be held and use it fromphk2005-02-221-2/+1
| | | | devfs instead of directly frobbing the si_refcount.
* Use MAXMINORphk2005-01-291-5/+5
|
* Typo.phk2005-01-291-1/+1
|
* Add MAXMINOR #define, we should have had this long time ago.phk2005-01-291-3/+9
| | | | | | | | 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).
* Fix a list corruption issue in cloning device management using thephk2005-01-241-16/+41
| | | | | western strategy ("allocate first, ask questions later") so we can extend the devmtx coverage to the clone list.
* Get rid of the magic "stash" of cdev structures, we no longer callphk2004-10-251-31/+3
| | | | make_dev() before malloc works.
* Fix a LOR relating to freeing cdevs.phk2004-10-011-2/+16
|
* Account for alias devices when tearing them down in destroy_dev() so wegreen2004-09-291-3/+3
| | | | don't panic on a NULL cdev->si_devsw.
* Used cached cdevsw pointer.phk2004-09-271-2/+4
|
* Add cdevsw->d_purge() support.phk2004-09-271-9/+19
| | | | | This device method shall wake up any threads sleeping in the device driver and make the depart the drivers code for good.
* Remove the cdevsw() function which is now unused.phk2004-09-241-8/+0
|
* Hold threadref while we throb cdevsw in devtoname()phk2004-09-241-6/+10
|
* Introduce dev_re[lf]thread() functions.phk2004-09-241-0/+25
| | | | | | | 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.
* Do not refcount the cdevsw, but rather maintain a cdev->si_threadcountphk2004-09-231-36/+17
| | | | | | | | | | 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().
* Create struct snapdata which contains the snapshot fields from cdevphk2004-09-131-1/+0
| | | | | | | | | | | 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.
* Add a missing '\n'.pjd2004-08-301-2/+2
|
* Add locking to the kqueue subsystem. This also makes the kqueue subsystemjmg2004-08-151-7/+1
| | | | | | | | | | | | | 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)
* Better descriptions of the cdev malloc class and mutex.phk2004-07-111-2/+2
|
* Fix a few spelling mistakes in comments and clean them up a bit.le2004-06-221-5/+5
|
* Second half of the dev_t cleanup.phk2004-06-171-34/+28
| | | | | | | | | | | 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.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-38/+38
| | | | Bump __FreeBSD_version accordingly.
* Introduce a ttyioctl() cdevsw default function.phk2004-06-011-0/+1
|
* Correctly account for extra bits in unit numbers when looking forphk2004-03-111-3/+3
| | | | next free unit.
* Add clone_setup() function rather than rely on lazy initialization.phk2004-03-111-9/+13
| | | | Requested by: rwatson
* Fix two oversights here: don't trash the freelist, and properly cleanupphk2004-02-231-1/+4
| | | | | | the cdevsw{}. Submitted by: tegge
* Device megapatch 6/6:phk2004-02-211-31/+152
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Device megapatch 5/6:phk2004-02-211-9/+12
| | | | | | | | | | | | 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()
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | 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.
* Device megapatch 3/6:phk2004-02-211-0/+8
| | | | | | | | | | | | 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.
* Device megapatch 2/6:phk2004-02-211-8/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fixed style bugs near previous commit (mainly formatting errors andbde2004-02-151-16/+13
| | | | | | 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.
* Split the initialization of the cdevsw into a separate function.phk2004-02-151-7/+14
|
* Remove the check which used to protect us against make_dev() beingphk2004-02-141-19/+0
| | | | | | 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.
* Retire revoke_and_destroy_dev() with extreme prejudice.phk2003-09-281-13/+0
|
* Make life a little bit easier for cloning device drivers.phk2003-09-271-0/+9
|
* Introduce no_poll() default method for device drivers. Have itphk2003-09-271-14/+75
| | | | | | | | | | | | | | | | | | | | 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
* The present defaults for the open and close for device drivers whichphk2003-09-271-2/+2
| | | | | | | | | | | | | | 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.
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Remove return after panic.phk2003-05-311-2/+0
| | | | Found by: FlexeLint
* Since dynamic allocation of device major numbers so far have notphk2003-04-131-1/+0
| | | | | resulted in any earthquakes, civil wars or early onset hair-loss, I think we can do without the printf announcing the assigned number.
* Add one little hack to allow us to make MAJOR_AUTO be zero:phk2003-03-091-0/+2
| | | | | Let the console driver ask for major 256 and magically change this to mean zero.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-14/+12
| | | | | | | | | | | | | 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)
* Explicitly initialize all cdevsw methods with the relevant nofoo() functionphk2003-03-021-0/+11
| | | | if they are NULL.
* NO_GEOM cleanup:phk2003-03-021-8/+1
| | | | Remove cdevsw->d_size() implementation. No longer needed.
* NODEVFS cleanup:phk2003-03-021-9/+3
| | | | Replace devfs_{create,destroy} hooks with direct function calls.
* Add the flip-side check: If a driver wants a particular major#, makephk2003-02-271-0/+9
| | | | sure it is marked as allocated in reserved_majors[]. Whine if it wasn't.
* Add support for allocating a device driver major number on demand.phk2003-02-271-2/+15
| | | | | | | | | | | | | | | 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.
* NODEVFS cleanup:phk2003-02-271-22/+0
| | | | | Remove cdevsw_add() and cdevsw_remove(), they served us well for a long time. Bump __FreeBSD_version to 500104 to mark this.
* NO_GEOM cleanup:phk2003-02-211-1/+1
| | | | | | | | | | | | | 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.
OpenPOWER on IntegriCloud