summaryrefslogtreecommitdiffstats
path: root/sys/fs/devfs/devfs_vnops.c
Commit message (Collapse)AuthorAgeFilesLines
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* NODEVFS cleanup: remove #ifdefs.phk2003-01-291-2/+0
|
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Even if the permissions deny it, a process should be allowed tophk2003-01-131-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | access its controlling terminal. In essense, history dictates that any process is allowed to open /dev/tty for RW, irrespective of credential, because by definition it is it's own controlling terminal. Before DEVFS we relied on a hacky half-device thing (kern/tty_tty.c) which did the magic deep down at device level, which at best was disgusting from an architectural point of view. My first shot at this was to use the cloning mechanism to simply give people the right tty when they ask for /dev/tty, that's why you get this, slightly counter intuitive result: syv# ls -l /dev/tty `tty` crw--w---- 1 u1 tty 5, 0 Jan 13 22:14 /dev/tty crw--w---- 1 u1 tty 5, 0 Jan 13 22:14 /dev/ttyp0 Trouble is, when user u1 su(1)'s to user u2, he cannot open /dev/ttyp0 anymore because he doesn't have permission to do so. The above fix allows him to do that. The interesting side effect is that one was previously only able to access the controlling tty by indirection: date > /dev/tty but not by name: date > `tty` This is now possible, and that feels a lot more like DTRT. PR: 46635 MFC candidate: could be.
* Since Jeffr made the std* functions the default in rev 1.63 ofphk2003-01-041-6/+0
| | | | | | | kern/vfs_defaults.c it is wrong for the individual filesystems to use the std* functions as that prevents override of the default. Found by: src/tools/tools/vop_table
* Trim left-over and unused vop_refreshlabel() bits from devfs.rwatson2002-12-281-23/+0
| | | | Reported by: bde
* Remove dm_root entry from struct devfs_mount. It's never set, and isrwatson2002-12-091-2/+2
| | | | | | | | | | | | unused. Replace it with a dm_mount back-pointer to the struct mount that the devfs_mount is associated with. Export that pointer to MAC Framework entry points, where all current policies don't use the pointer. This permits the SEBSD port of SELinux's FLASK/TE to compile out-of-the-box on 5.0-CURRENT with full file system labeling support. Approved by: re (murray) Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Slightly change the semantics of vnode labels for MAC: rather thanrwatson2002-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
* Missed a case of _POSIX_MAC_PRESENT -> _PC_MAC_PRESENT rename.rwatson2002-10-201-2/+2
| | | | Pointed out by: phk
* Fix comments and one resulting code confusion about the type of thephk2002-10-161-1/+1
| | | | | | "command" argument to VOP_IOCTL. Spotted by: FlexeLint.
* Change iov_base's type from `char *' to the standard `void *'. Allmike2002-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 *'.
* Integrate a devfs/MAC fix from the MAC tree: avoid a race condition duringrwatson2002-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
* Move the vop-vector declaration into devfs_vnops.c where it belongs.phk2002-10-011-2/+3
|
* Fix mis-indent.phk2002-09-281-1/+1
|
* Remove any VOP_PRINT that redundantly prints the tag.njl2002-09-181-15/+2
| | | | | | Move lockmgr_printinfo() into vprint() for everyone's benefit. Suggested by: bde
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.njl2002-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)
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-1/+1
| | | | | | | | | | | | | | | - 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
* Introduce support for Mandatory Access Control and extensiblerwatson2002-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
* Hook up devfs_pathconf() for specfs devfs nodes, not just regularrwatson2002-08-011-0/+1
| | | | | | | devfs nodes. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-0/+67
| | | | | | | | | | | | | | | | 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
* Introduce the DEVFS "rule" subsystem. DEVFS rules permit thedd2002-07-171-0/+20
| | | | | | | | | | | 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
* Make devfs to give honour to PDIRUNLOCK flag.semenu2002-06-011-9/+13
| | | | | Reviewed by: jeff MFC after: 1 week
* Fix several bugs in devfs_lookupx(). When we check the nameiop tomux2002-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
* Use vnode locking with devfs; permit VFS locking assertions to makerwatson2002-04-291-0/+6
| | | | | | | | sense for devfs vnodes, and reduce/remove potential races in the devfs code. Submitted by: iadowse Approved by: phk
* Fixed assorted bugs in setting of timestamps in devfs_setattr().bde2002-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.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-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@
* Remove __P.alfred2002-03-191-14/+14
|
* Be consistent with UFS in a way how devfs_setattr() checks credentialsmaxim2002-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
* Address two minor issues: implement the _PC_NAME_MAX and _PC_PATH_MAXdd2001-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
* Fix "echo > /dev/null" for non-root users which broke in previous commit.phk2001-11-041-5/+7
|
* Use vfs_timestamp() instead of getnanotime().phk2001-11-031-3/+12
| | | | | | Add magic stuff copied from ufs_setattr(). Instructed by: bde
* Backed out vestiges of the quick fixes for the transient breakage ofbde2001-10-131-1/+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>).
* The behaviour of whiteout'ing symlinks were too confusing, insteadphk2001-09-301-1/+8
| | | | remove them when asked to.
* KSE Milestone 2julian2001-09-121-38/+38
| | | | | | | | | | | | | | 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
* linux ls fails on DEVFS /dev because linux_getdents fails becausephk2001-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
* Support /dev/tun cloning. Ansify if_tun.c while I'm there.brian2001-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
* Don't copy the trailing zero in readlink, it confuses namei().phk2001-05-261-1/+1
| | | | PR: 27656
* Change the way deletes are managed in DEVFS.phk2001-05-231-41/+113
| | | | | | | 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.
* After a successfull poll of the cloning functions, match on thephk2001-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.
* Convert DEVFS from an "opt-in" to an "opt-out" option.phk2001-05-131-5/+4
| | | | | | | | | 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.
* Remove unneeded devfs_badop()phk2001-05-061-10/+0
| | | | Noticed by: rwatson
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-6/+7
| | | | | | | | | | | 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)
* Add a vop_stdbmap(), and make it part of the default vop vector.phk2001-04-291-23/+0
| | | | | | Make 7 filesystems which don't really know about VOP_BMAP rely on the default vector, rather than more or less complete local vop_nopbmap() implementations.
* add this ridiculous include foo so it will compile againmjacob2001-04-231-0/+2
|
* Remove a debug printf.phk2001-02-181-3/+1
|
* At the point in time where most devices are created, we don't know whatphk2001-02-021-0/+15
| | | | | time it is because boottime is not yet initialized. Finagle the relevant fields when we get the chance.
* Only superuser can create symlinks.phk2001-02-021-2/+5
| | | | | Give symlinks mode 755 by default to avoid triggering alert eyes. (the mode isn't use on symlinks)
* Fix two minor nits.phk2001-01-301-1/+4
| | | | Existences revealed, but no details offered by: bp
* staticize.phk2000-12-081-2/+2
|
* Move suser() and suser_xxx() prototypes and a related #define fromphk2000-10-291-1/+0
| | | | | | | | | <sys/proc.h> to <sys/systm.h>. Correctly document the #includes needed in the manpage. Add one now needed #include of <sys/systm.h>. Remove the consequent 48 unused #includes of <sys/proc.h>.
OpenPOWER on IntegriCloud