summaryrefslogtreecommitdiffstats
path: root/sys/fs/pseudofs/pseudofs.h
Commit message (Collapse)AuthorAgeFilesLines
* Add procfs to jail-mountable filesystems.mm2012-02-291-2/+6
| | | | | Reviewed by: jamie MFC after: 1 week
* Make sure all intermediate variables holding mount flags (mnt_flag)mckusick2012-01-171-1/+1
| | | | | | | and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC after: 2 weeks
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* Remove the thread argument from the FSD (File-System Dependent) parts ofattilio2009-05-111-11/+7
| | | | | | | | | | | | | | | | | the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation.
* Make pseudofs (and consequently procfs, linprocfs and linsysfs) MPSAFE.des2007-04-151-15/+42
|
* Further pseudofs improvements:des2007-04-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | The pfs_info mutex is only needed to lock pi_unrhdr. Everything else in struct pfs_info is modified only while Giant is held (during vfs_init() / vfs_uninit()); add assertions to that effect. Simplify pfs_destroy somewhat. Remove superfluous arguments from pfs_fileno_{alloc,free}(), and the assertions which were added in the previous commit to ensure they were consistent. Assert that Giant is held while the vnode cache is initialized and destroyed. Also assert that the cache is empty when it is destroyed. Rename the vnode cache mutex for consistency. Fix a long-standing bug in pfs_getattr(): it would uncritically return the node's pn_fileno as st_ino. This would result in st_ino being 0 if the node had not previously been visited by readdir(), and also in an incorrect st_ino for process directories and any files contained therein. Correct this by abstracting the fileno manipulations previously done in pfs_readdir() into a new function, pfs_fileno(), which is used by both pfs_getattr() and pfs_readdir().
* Add a flag to struct pfs_vdata to mark the vnode as dead (e.g. process-des2007-04-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | specific nodes when the process exits) Move the vnode-cache-walking loop which was duplicated in pfs_exit() and pfs_disable() into its own function, pfs_purge(), which looks for vnodes marked as dead and / or belonging to the specified pfs_node and reclaims them. Note that this loop is still extremely inefficient. Add a comment in pfs_vncache_alloc() explaining why we have to purge the vnode from the vnode cache before returning, in case anyone should be tempted to remove the call to cache_purge(). Move the special handling for pfstype_root nodes into pfs_fileno_alloc() and pfs_fileno_free() (the root node's fileno must always be 2). This also fixes a bug where pfs_fileno_free() would reclaim the root node's fileno, triggering a panic in the unr code, as that fileno was never allocated from unr to begin with. When destroying a pfs_node, release its fileno and purge it from the vnode cache. I wish we could put off the call to pfs_purge() until after the entire tree had been destroyed, but then we'd have vnodes referencing freed pfs nodes. This probably doesn't matter while we're still under Giant, but might become an issue later. When destroying a pseudofs instance, destroy the tree before tearing down the fileno allocator. In pfs_mount(), acquire the mountpoint interlock when required. MFC after: 3 weeks
* Whitespace nits.des2007-04-051-1/+1
|
* Add a pn_destroy field to pfs_node. This field points to a destructordes2007-03-121-3/+16
| | | | | | | | | | | | | function which is called from pfs_destroy() before the node is reclaimed. Modify pfs_create_{dir,file,link}() to accept a pointer to a destructor function in addition to the usual attr / fill / vis pointers. This breaks both the programming and binary interfaces between pseudofs and its consumers. It is believed that there are no pseudofs consumers outside the source tree, so that the impact of this change is minimal. Submitted by: Aniruddha Bohra <bohra@cs.rutgers.edu>
* Restore the ability to mount procfs and fdescfs filesystems via thekbyanc2006-05-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | mount(2) system call: * Add cmount hook to fdescfs and pseudofs (and, by extension, procfs and linprocfs). This (mostly) restores the ability to mount these filesystems using the old mount(2) system call (see below for the rest of the fix). * Remove not-NULL check for the data argument from the mount(2) entry point. Per the mount(2) man page, it is up to the individual filesystem being mounted to verify data. Or, in the case of procfs, etc. the filesystem is free to ignore the data parameter if it does not use it. Enforcing data to be not-NULL in the mount(2) system call entry point prevented passing NULL to filesystems which ignored the data pointer value. Apparently, passing NULL was common practice in such cases, as even our own mount_std(8) used to do it in the pre-nmount(2) world. All userland programs in the tree were converted to nmount(2) long ago, but I've found at least one external program which broke due to this (presumably unintentional) mount(2) API change. One could argue that external programs should also be converted to nmount(2), but then there isn't much point in keeping the mount(2) interface for backward compatibility if it isn't backward compatible.
* - Update vfs_root implementations to match the new prototype. None ofjeff2005-03-241-2/+2
| | | | | | | | these filesystems will support shared locks until they are explicitly modified to do so. Careful review must be done to ensure that this is safe for each individual filesystem. Sponsored by: Isilon Systems, Inc.
* Use subr_unitphk2005-03-191-1/+1
|
* Put a version element in the VFS filesystem configuration structurephk2004-07-301-5/+4
| | | | | | | | | | | | | | | | | | and refuse initializing filesystems with a wrong version. This will aid maintenance activites on the 5-stable branch. s/vfs_mount/vfs_omount/ s/vfs_nmount/vfs_mount/ Name our filesystems mount function consistently. Eliminate the namiedata argument to both vfs_mount and vfs_omount. It was originally there to save stack space. A few places abused it to get hold of some credentials to pass around. Effectively it is unused. Reorganize the root filesystem selection code.
* Make VFS_ROOT() and vflush() take a thread argument.alfred2004-07-121-1/+2
| | | | | | This is to allow filesystems to decide based on the passed thread which vnode to return. Several filesystems used curthread, they now use the passed thread.
* Constify, and add an API function to find a named node in a directory.des2003-12-071-3/+4
|
* Initialize struct vfsops C99-sparsely.phk2003-06-121-15/+6
| | | | | Submitted by: hmp Reviewed by: phk
* Rename vfs_stdsync function to vfs_stdnosync which matches morekan2003-03-111-1/+1
| | | | | | | | | | | | | closely what function is really doing. Update all existing consumers to use the new name. Introduce a new vfs_stdsync function, which iterates over mount point's vnodes and call FSYNC on each one of them in turn. Make nwfs and smbfs use this new function instead of rolling their own identical sync implementations. Reviewed by: jeff
* Get rid of caddr_t.des2003-03-021-1/+1
|
* Slightly change the semantics of vnode labels for MAC: rather thanrwatson2002-10-261-10/+0
| | | | | | | | | | | | | | | | | | | | | "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
* '&' not used for pointers to functions.phk2002-10-201-2/+2
| | | | Spotted by: FlexeLint
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-011-0/+10
| | | | | | | | | | | | | | | kernel access control. Modify pseudofs so that it can support synthetic file systems with the multilabel flag set. In particular, implement vop_refreshlabel() as pn_refreshlabel(). Implement pfs_refreshlabel() to invoke this, and have it fall back to the mount label if the file system does not implement pn_refreshlabel() for the node. Otherwise, permit the file system to determine how the service is provided. Approved by: des Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Gratuitous whitespace cleanup.des2002-06-061-9/+9
|
* Convert the pseudofs framework to nmount (thus procfs and linprocfs).mux2002-05-021-6/+6
| | | | Reviewed by: des (some time ago), phk
* Part I: Update extended attribute API and ABI:rwatson2002-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | o Modify the system call syntax for extattr_{get,set}_{fd,file}() so as not to use the scatter gather API (which appeared not to be used by any consumers, and be less portable), rather, accepts 'data' and 'nbytes' in the style of other simple read/write interfaces. This changes the API and ABI. o Modify system call semantics so that extattr_get_{fd,file}() return a size_t. When performing a read, the number of bytes read will be returned, unless the data pointer is NULL, in which case the number of bytes of data are returned. This changes the API only. o Modify the VOP_GETEXTATTR() vnode operation to accept a *size_t argument so as to return the size, if desirable. If set to NULL, the size will not be returned. o Update various filesystems (pseodofs, ufs) to DTRT. These changes should make extended attributes more useful and more portable. More commits to rebuild the system call files, as well as update userland utilities to follow. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Add VOP_GETEXTATTR(9) passthrough support to pseudofs.green2001-12-111-0/+13
| | | | | Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Add support for a last-close handler.des2001-11-271-1/+11
| | | | | Revert the module version bumps; they're quite pointless as long as the only pseudofs consumer is linprocfs, which is in the tree.
* Reduce the number of #include dependencies by declaring some of the structsdes2001-11-031-1/+15
| | | | used in pseudofs.h as opaque structs.
* Add VOP_IOCTL support, and fix a bug that would cause a panic if a file ordes2001-10-261-1/+11
| | | | symlink lacked a filler function.
* Switch to dynamic rather than static initialization.des2001-10-191-33/+39
| | | | | This makes it possible (in theory) for nodes to be added and / or removed from pseudofs filesystems at runtime.
* Add a PFS_DISABLED flag; pfs_visible() automatically returns 0 if it is setdes2001-10-021-0/+7
| | | | | on the node in question. Also add two API functions for setting and clearing this flag; setting it also reclaims all vnodes associated with the node.
* YA pseudofs megacommit, part 1:des2001-10-011-14/+24
| | | | | | | | | | | | | | | | - Add a third callback to the pfs_node structure. This one simply returns non-zero if the specified requesting process is allowed to access the specified node for the specified target process. This is used in addition to the usual permission checks, e.g. when certain files don't make sense for certain (system) processes. - Make sure that pfs_lookup() and pfs_readdir() don't yap about files which aren't pfs_visible(). Also check pfs_visible() before performing reads and writes, to prevent the kind of races reported in SA-00:77 and SA-01:55 (fork a child, open /proc/child/ctl, have that child fork a setuid binary, and assume control of it). - Add some more trace points.
* pseudofs.h:des2001-09-301-3/+4
| | | | | | | | | | | | | | | | - Rearrange the flag constants a little to simplify specifying and testing for readability and writeability. pseudofs_vnops.c: - Track the aforementioned change. - Add checks to pfs_open() to prevent opening read-only files for writing or vice versa (pfs_{read,write} would block the actual reads and writes, but it's still a bug to allow the open() to succeed). Also, return EOPNOTSUPP if the caller attempts to lock the file. - Add more trace points.
* Pseudofs take 2:des2001-09-291-22/+34
| | | | | | | | | | | | | | | | | | | | | | | | | - Remove hardcoded uid, gid, mode from struct pfs_node; make pfs_getattr() smart enough to get it right most of the time, and allow for callbacks to handle the remaining cases. Rework the definition macros to match. - Add lots of (conditional) debugging output. - Fix a long-standing bug inherited from procfs: don't pretend to be a read-only file system. Instead, return EOPNOTSUPP for operations we truly can't support and allow others to fail silently. In particular, pfs_lookup() now treats CREATE as LOOKUP. This may need more work. - In pfs_lookup(), if the parent node is process-dependent, check that the process in question still exists. - Implement pfs_open() - its only current function is to check that the process opening the file can see the process it belongs to. - Finish adding support for writeable nodes. - Bump module version number. - Introduce lots of new bugs.
* Clean up my source tree to avoid getting hit too badly by the next KSE ordes2001-09-251-2/+13
| | | | | whatever mega-commit. This goes some way towards adding support for writeable files (needed by procfs).
* KSE Milestone 2julian2001-09-121-6/+6
| | | | | | | | | | | | | | 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
* Whoops, some of my test code snuck in here.des2001-06-101-1/+1
|
* Argh. Fix braino in previous commit.des2001-06-101-1/+1
|
* Add a 'flags' argument to the PFS_PROCDIR macro.des2001-06-101-2/+2
|
* Add support for process-dependent directories. This means that save fordes2001-06-101-12/+10
| | | | the lack of a man page, pseudofs is mostly complete now.
* Let pseudofs into the warmth of the FreeBSD CVS repo.des2001-04-071-0/+181
It's not finished yet (I still have to find a way to implement process- dependent nodes without consuming too much memory, and the permission system needs tightening up), but it's becoming hard to work on without a repo (I've accidentally almost nuked it once already), and it works (except for the lack of process-dependent nodes, that is). I was supposed to commit this a week ago, but timed out waiting for jkh to reply to some questions I had. Pass him a spoonful of bad karma :)
OpenPOWER on IntegriCloud