aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/devfs
Commit message (Collapse)AuthorAgeFilesLines
* Slightly change the semantics of vnode labels for MAC: rather thanRobert Watson2002-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | "refreshing" the label on the vnode before use, just get the label right from inception. For single-label file systems, set the label in the generic VFS getnewvnode() code; for multi-label file systems, leave the labeling up to the file system. With UFS1/2, this means reading the extended attribute during vfs_vget() as the inode is pulled off disk, rather than hitting the extended attributes frequently during operations later, improving performance. This also corrects sematics for shared vnode locks, which were not previously present in the system. This chances the cache coherrency properties WRT out-of-band access to label data, but in an acceptable form. With UFS1, there is a small race condition during automatic extended attribute start -- this is not present with UFS2, and occurs because EAs aren't available at vnode inception. We'll introduce a work around for this shortly. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=105988
* Missed a case of _POSIX_MAC_PRESENT -> _PC_MAC_PRESENT rename.Robert Watson2002-10-201-2/+2
| | | | | | | Pointed out by: phk Notes: svn path=/head/; revision=105585
* Fix comments and one resulting code confusion about the type of thePoul-Henning Kamp2002-10-163-3/+3
| | | | | | | | | "command" argument to VOP_IOCTL. Spotted by: FlexeLint. Notes: svn path=/head/; revision=105212
* A better solution to avoiding variable sized structs in DEVFS.Poul-Henning Kamp2002-10-162-3/+5
| | | | Notes: svn path=/head/; revision=105210
* #include "opt_devfs.h" to protect against variable sized structures.Poul-Henning Kamp2002-10-161-0/+2
| | | | | | | Spotted by: FlexeLint Notes: svn path=/head/; revision=105209
* Change iov_base's type from `char *' to the standard `void *'. AllMike Barcroft2002-10-111-2/+2
| | | | | | | | uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'. Notes: svn path=/head/; revision=104908
* Treat the pathptrn field as a real pattern with the aid of fnmatch().Dima Dorfman2002-10-081-15/+1
| | | | Notes: svn path=/head/; revision=104653
* Integrate a devfs/MAC fix from the MAC tree: avoid a race condition duringRobert Watson2002-10-051-4/+3
| | | | | | | | | | | | devfs VOP symlink creation by introducing a new entry point to determine the label of the devfs_dirent prior to allocation of a vnode for the symlink. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories Notes: svn path=/head/; revision=104533
* Move the vop-vector declaration into devfs_vnops.c where it belongs.Poul-Henning Kamp2002-10-012-5/+3
| | | | Notes: svn path=/head/; revision=104278
* s/struct dev_t */dev_t */Poul-Henning Kamp2002-09-281-1/+1
| | | | Notes: svn path=/head/; revision=104113
* Fix mis-indent.Poul-Henning Kamp2002-09-281-1/+1
| | | | Notes: svn path=/head/; revision=104099
* Remove any VOP_PRINT that redundantly prints the tag.Nate Lawson2002-09-181-15/+2
| | | | | | | | | Move lockmgr_printinfo() into vprint() for everyone's benefit. Suggested by: bde Notes: svn path=/head/; revision=103559
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.Nate Lawson2002-09-141-2/+2
| | | | | | | | | | | | | | | v_tag is now const char * and should only be used for debugging. Additionally: 1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK 2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP. Suggested by: phk Reviewed by: bde, rwatson (earlier version) Notes: svn path=/head/; revision=103314
* Introduce typedefs for the member functions of struct vfsops and employPoul-Henning Kamp2002-08-131-9/+6
| | | | | | | | | | these in the main filesystems. This does not change the resulting code but makes the source a little bit more grepable. Sponsored by: DARPA and NAI Labs. Notes: svn path=/head/; revision=101777
* - Replace v_flag with v_iflag and v_vflagJeff Roberson2002-08-042-2/+2
| | | | | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS Notes: svn path=/head/; revision=101308
* Introduce support for Mandatory Access Control and extensibleRobert Watson2002-08-021-0/+11
| | | | | | | | | | | | | | kernel access control. Teach devfs how to respond to pathconf() _POSIX_MAC_PRESENT queries, allowing it to indicate to user processes that individual vnode labels are available. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=101195
* Hook up devfs_pathconf() for specfs devfs nodes, not just regularRobert Watson2002-08-011-0/+1
| | | | | | | | | | devfs nodes. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=101191
* Introduce support for Mandatory Access Control and extensibleRobert Watson2002-07-313-0/+90
| | | | | | | | | | | | | | | | | | | kernel access control. Instrument devfs to support per-dirent MAC labels. In particular, invoke MAC framework when devfs directory entries are instantiated due to make_dev() and related calls, and invoke the MAC framework when vnodes are instantiated from these directory entries. Implement vop_setlabel() for devfs, which pushes the label update into the devfs directory entry for semi-persistant store. This permits the MAC framework to assign labels to devices and directories as they are instantiated, and export access control information via devfs vnodes. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=101069
* Introduce support for Mandatory Access Control and extensibleRobert Watson2002-07-301-0/+1
| | | | | | | | | | | | | | kernel access control. Label devfs directory entries, permitting labels to be maintained on device nodes in devfs instances persistently despite vnode recycling. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=100994
* Correct misindentation of DRA_UID.Dima Dorfman2002-07-281-1/+1
| | | | Notes: svn path=/head/; revision=100804
* Unimplement panic(8) by making sure that we don't recurse into aDima Dorfman2002-07-281-5/+11
| | | | | | | | | | ruleset. If we do, that means there's a ruleset loop (10 includes 20 include 30 includes 10), which will quickly cause a double fault due to stack overflow (since "include" is implemented by recursion). (Previously, we only checked that X didn't include X.) Notes: svn path=/head/; revision=100793
* Introduce the DEVFS "rule" subsystem. DEVFS rules permit theDima Dorfman2002-07-175-1/+949
| | | | | | | | | | | | | | administrator to define certain properties of new devfs nodes before they become visible to the userland. Both static (e.g., /dev/speaker) and dynamic (e.g., /dev/bpf*, some removable devices) nodes are supported. Each DEVFS mount may have a different ruleset assigned to it, permitting different policies to be implemented for things like jails. Approved by: phk Notes: svn path=/head/; revision=100206
* Make devfs to give honour to PDIRUNLOCK flag.Semen Ustimenko2002-06-011-9/+13
| | | | | | | | Reviewed by: jeff MFC after: 1 week Notes: svn path=/head/; revision=97702
* Fix several bugs in devfs_lookupx(). When we check the nameiop toMaxime Henrion2002-05-101-3/+3
| | | | | | | | | | | | make sure it's a correct operation for devfs, do it only in the ISLASTCN case. If we don't, we are assuming that the final file will be in devfs, which is not true if another partition is mounted on top of devfs or with special filenames (like /dev/net/../../foo). Reviewed by: phk Notes: svn path=/head/; revision=96356
* Convert devfs to nmount.Maxime Henrion2002-05-021-6/+5
| | | | | | | Reviewed by: phk Notes: svn path=/head/; revision=95954
* Use vnode locking with devfs; permit VFS locking assertions to makeRobert Watson2002-04-291-0/+6
| | | | | | | | | | | sense for devfs vnodes, and reduce/remove potential races in the devfs code. Submitted by: iadowse Approved by: phk Notes: svn path=/head/; revision=95750
* Don't attempt to decvlare M_DEVFS whern MALLOC_DECLARE is not defined.Bruce Evans2002-04-211-3/+6
| | | | | | | | | | | This fixes warnings that should be errors in fstat. Reminded by: alpha tinderbox Fixed some style bugs (ones near BOF and EOF; there are many more). Notes: svn path=/head/; revision=95212
* Fixed assorted bugs in setting of timestamps in devfs_setattr().Bruce Evans2002-04-051-21/+24
| | | | | | | | | | | | | | | Setting of timestamps on devices had no effect visible to userland because timestamps for devices were set in places that are never used. This broke: - update of file change time after a change of an attribute - setting of file access and modification times. The VA_UTIMES_NULL case did not work. Revs 1.31-1.32 were supposed to fix this by copying correct bits from ufs, but had little or no effect because the old checks were not removed. Notes: svn path=/head/; revision=93886
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-6/+5
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Remove __P.Alfred Perlstein2002-03-192-21/+21
| | | | Notes: svn path=/head/; revision=92727
* Be consistent with UFS in a way how devfs_setattr() checks credentialsMaxim Konovalov2002-03-141-4/+5
| | | | | | | | | | | for chmod(2), chown(2) and utimes(2) with respect to jail(2). Reviewed by: rwatson, ru Not objected by: phk Approved by: ru Notes: svn path=/head/; revision=92270
* Add a new sysinit SI_SUB_DEVFS. Devfs hooks into the kernel at SI_ORDER_FIRST,Mike Smith2002-01-091-1/+1
| | | | | | | | | and devices can be created anytime after that. Print a warning if an atttempt is made to create a device too early. Notes: svn path=/head/; revision=89118
* Use a sysinit to initialise the devfs hooks in kern_conf.c rather than commonMike Smith2002-01-091-3/+10
| | | | | | | | | variables. Reviewed by: phk (in principle) Notes: svn path=/head/; revision=89107
* Address two minor issues: implement the _PC_NAME_MAX and _PC_PATH_MAXDima Dorfman2001-11-251-2/+29
| | | | | | | | | | | | pathconf() variables for directories, and set st_size and st_blocks (of struct stat) for directories as appropriate. Note that st_size is always set to DEV_BSIZE, since the size of the directories is not currently kept. Reviewed by: phk, bde Notes: svn path=/head/; revision=86892
* Fix "echo > /dev/null" for non-root users which broke in previous commit.Poul-Henning Kamp2001-11-041-5/+7
| | | | Notes: svn path=/head/; revision=86040
* Use vfs_timestamp() instead of getnanotime().Poul-Henning Kamp2001-11-031-3/+12
| | | | | | | | | Add magic stuff copied from ufs_setattr(). Instructed by: bde Notes: svn path=/head/; revision=85980
* Use vfs_timestamp() instead of getnanotime() directly.Poul-Henning Kamp2001-11-031-3/+3
| | | | | | | | | Fix some modes on directories and symlinks. Instructed by: bde Notes: svn path=/head/; revision=85979
* Backed out vestiges of the quick fixes for the transient breakage ofBruce Evans2001-10-132-2/+0
| | | | | | | | <sys/mount.h> in rev.1.106 of the latter (don't include <sys/socket.h> just to work around bugs in <sys/mount.h>). Notes: svn path=/head/; revision=84873
* The behaviour of whiteout'ing symlinks were too confusing, insteadPoul-Henning Kamp2001-09-301-1/+8
| | | | | | | remove them when asked to. Notes: svn path=/head/; revision=84156
* KSE Milestone 2Julian Elischer2001-09-124-55/+55
| | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=83366
* linux ls fails on DEVFS /dev because linux_getdents fails becausePoul-Henning Kamp2001-08-141-4/+22
| | | | | | | | | | | | | linux_getdents uses VOP_READDIR( ..., &ncookies, &cookies ) instead of VOP_READDIR( ..., NULL, NULL ) because it seems to need the offsets for linux_dirent and sizeof(dirent) != sizeof(linux_dirent)... PR: 29467 Submitted by: Michael Reifenberger <root@nihil.plaut.de> Reviewed by: phk Notes: svn path=/head/; revision=81620
* Support /dev/tun cloning. Ansify if_tun.c while I'm there.Brian Somers2001-06-011-1/+2
| | | | | | | | | | | | | | | | | Only tun0 -> tun32767 may now be opened as struct ifnet's if_unit is a short. It's now possible to open /dev/tun and get a handle back for an available tun device (use devname to find out what you got). The implementation uses rman by popular demand (and against my judgement) to track opened devices and uses the new dev_depends() to ensure that all make_dev()d devices go away before the module is unloaded. Reviewed by: phk Notes: svn path=/head/; revision=77589
* Don't copy the trailing zero in readlink, it confuses namei().Poul-Henning Kamp2001-05-261-1/+1
| | | | | | | PR: 27656 Notes: svn path=/head/; revision=77243
* Create a general facility for making dev_t's depend on anotherPoul-Henning Kamp2001-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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() Notes: svn path=/head/; revision=77215
* Change the way deletes are managed in DEVFS.Poul-Henning Kamp2001-05-232-42/+114
| | | | | | | | | | This fixes a number of warnings relating to removed cloned devices. It also makes it possible to recreate deleted devices with mknod(2). The major/minor arguments are ignored. Notes: svn path=/head/; revision=77050
* Change the second argument of vflush() to an integer that specifiesIan Dowse2001-05-161-12/+2
| | | | | | | | | | | | | | | | | | | | | | | the number of references on the filesystem root vnode to be both expected and released. Many filesystems hold an extra reference on the filesystem root vnode, which must be accounted for when determining if the filesystem is busy and then released if it isn't busy. The old `skipvp' approach required individual filesystem xxx_unmount functions to re-implement much of vflush()'s logic to deal with the root vnode. All 9 filesystems that hold an extra reference on the root vnode got the logic wrong in the case of forced unmounts, so `umount -f' would always fail if there were any extra root vnode references. Fix this issue centrally in vflush(), now that we can. This commit also fixes a vnode reference leak in devfs, which could result in idle devfs filesystems that refuse to unmount. Reviewed by: phk, bp Notes: svn path=/head/; revision=76688
* After a successfull poll of the cloning functions, match on thePoul-Henning Kamp2001-05-141-14/+6
| | | | | | | | | | returned dev_t rather than the original name. This allows cloning from one name to another which is useful for /dev/tty and later for the pty's. Notes: svn path=/head/; revision=76571
* Convert DEVFS from an "opt-in" to an "opt-out" option.Poul-Henning Kamp2001-05-133-5/+8
| | | | | | | | | | | | If for some reason DEVFS is undesired, the "NODEVFS" option is needed now. Pending any significant issues, DEVFS will be made mandatory in -current on july 1st so that we can start reaping the full benefits of having it. Notes: svn path=/head/; revision=76554
* Remove unneeded devfs_badop()Poul-Henning Kamp2001-05-061-10/+0
| | | | | | | Noticed by: rwatson Notes: svn path=/head/; revision=76320
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inMark Murray2001-05-013-14/+17
| | | | | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations) Notes: svn path=/head/; revision=76166