summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Add a dead_cdevsw which does its best to return ENXIO if at all possible.phk2003-02-201-3/+53
| | | | | | | 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.
* Add M_WAITOKphk2003-02-191-1/+1
|
* Implement proper bounds-checking and truncation of device names, this hasphk2003-02-041-4/+10
| | | | | become an issue now that end-user controlable attributes can become devices names with the geom_vol_ffs class.
* Pave the road to removing the fixed size limit on device nodes:phk2003-02-041-0/+2
| | | | | | | | | | 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.
* NO_GEOM cleanup: unifdef;phk2003-01-301-8/+0
|
* NODEVFS cleanup: Remove cdevsw[].phk2003-01-291-31/+0
| | | | | | | | 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.
* disk_dev_synth() is a NO_GEOM hack.phk2003-01-201-0/+4
|
* Mark more code #ifdef NODEVFSphk2003-01-191-1/+6
|
* Originally when DEVFS was added, a global variable "devfs_present"phk2003-01-191-3/+4
| | | | | | | | | | | | 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.
* Remove unused cdevsw_ALLOCSTART macro.phk2002-12-281-2/+0
|
* Don't allow dev_stdclone(9) to accept minors larger than the system isgreen2002-10-051-0/+2
| | | | able to handle (0xffffff).
* Rename struct specinfo to the more appropriate struct cdev.phk2002-09-271-6/+6
| | | | Agreed on: jake, rwatson, jhb
* Assert my copyright on this file (using the default 2-clause BSD).phk2002-09-201-11/+4
| | | | | The vast majority of the contents is from my keyboard and no significant pieces remain of the former copyright holders code.
* Fix a logic bug in the struct dev_t allocation code.phk2002-09-081-5/+5
| | | | Spotted by: Neelkanth Natu <neelnatu@yahoo.com>
* Break the following implementation of panic(3):bde2002-04-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #!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
* Make the proposed name arg to dev_stdclone() const.phk2002-03-101-1/+1
|
* (Doing that whole test-immediately-after-commit-thing like obrien sez:)green2002-02-161-0/+2
| | | | Forgot to include lock.h and mutex.h for GIANT_REQUIRED.
* Add revoke_and_destroy_dev(), to be used by devices which decide whengreen2002-02-161-0/+13
| | | | | they choose to destroy themselves without regard to whether or not they are open.
* Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST,msmith2002-01-091-1/+19
| | | | | | and devices can be created anytime after that. Print a warning if an atttempt is made to create a device too early.
OpenPOWER on IntegriCloud