summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_init.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't worry if a module is already loaded when looking for a fstype to mountjamie2013-02-211-2/+6
| | | | | | | (possible in a race condition). Reviewed by: kib MFC after: 1 week
* Remove the support for using non-mpsafe filesystem modules.kib2012-10-221-1/+1
| | | | | | | | | | | | In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
* Modify vfs_register() to use a hash calculationrmacklem2011-09-131-1/+44
| | | | | | | | | | | | | | | on vfc_name to set vfc_typenum, so that vfc_typenum doesn't change when file systems are loaded in different orders. This keeps NFS file handles from changing, for file systems that use vfc_typenum in their fsid. This change is controlled via a loader.conf variable called vfs.typenumhash, since vfc_typenum will change once when this is enabled. It defaults to 1 for 9.0, but will default to 0 when MFC'd to stable/8. Tested by: hrs Reviewed by: jhb, pjd (earlier version) Approved by: re (kib) MFC after: 1 month
* Expand the scope of the sysctllock sx lock to protect the sysctl tree itself.jhb2009-02-061-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 1.1 of kern_sysctl.c the sysctl() routine wired the "old" userland buffer for most sysctls (everything except kern.vnode.*). I think to prevent issues with wiring too much memory it used a 'memlock' to serialize all sysctl(2) invocations, meaning that only one user buffer could be wired at a time. In 5.0 the 'memlock' was converted to an sx lock and renamed to 'sysctl lock'. However, it still only served the purpose of serializing sysctls to avoid wiring too much memory and didn't actually protect the sysctl tree as its name suggested. These changes expand the lock to actually protect the tree. Later on in 5.0, sysctl was changed to not wire buffers for requests by default (sysctl_handle_opaque() will still wire buffers larger than a single page, however). As a result, user buffers are no longer wired as often. However, many sysctl handlers still wire user buffers, so it is still desirable to serialize userland sysctl requests. Kernel sysctl requests are allowed to run in parallel, however. - Expose sysctl_lock()/sysctl_unlock() routines to exclusively lock the sysctl tree for a few places outside of kern_sysctl.c that manipulate the sysctl tree directly including the kernel linker and vfs_register(). - sysctl_register() and sysctl_unregister() require the caller to lock the sysctl lock using sysctl_lock() and sysctl_unlock(). The rest of the public sysctl API manage the locking internally. - Add a locked variant of sysctl_remove_oid() for internal use so that external uses of the API do not need to be aware of locking requirements. - The kernel linker no longer needs Giant when manipulating the sysctl tree. - Add a missing break to the loop in vfs_register() so that we stop looking at the sysctl MIB once we have changed it. MFC after: 1 month
* Remove VFS_VPTOFH entirely. API is already broken and it is good time topjd2007-02-161-7/+0
| | | | | | do it. Suggested by: rwatson
* Move vnode-to-file-handle translation from vfs_vptofh to vop_vptofh method.pjd2007-02-151-0/+4
| | | | | | | | | | | | | | | | This way we may support multiple structures in v_data vnode field within one file system without using black magic. Vnode-to-file-handle should be VOP in the first place, but was made VFS operation to keep interface as compatible as possible with SUN's VFS. BTW. Now Solaris also implements vnode-to-file-handle as VOP operation. VFS_VPTOFH() was left for API backward compatibility, but is marked for removal before 8.0-RELEASE. Approved by: mckusick Discussed with: many (on IRC) Tested with: ufs, msdosfs, cd9660, nullfs and zfs
* Remove duplicate security checks already performed in kern_kldload().jhb2006-06-261-7/+1
|
* Use kern_kldload() and kern_kldunload() to load and unload modules whenjhb2006-06-131-7/+5
| | | | | | | | we intend for the user to be able to unload them later via kldunload(2) instead of calling linker_load_module() and then directly adjusting the ref count on the linker file structure. This makes the resulting consumer code simpler and cleaner and better hides the linker internals making it possible to sanely lock the linker.
* Remove VFS_START(). Its original purpose involved the mfs filesystem,das2005-02-201-3/+0
| | | | | | | which is long gone. Discussed with: mckusick Reviewed by: phk
* Make various mountpoint related functions static.phk2005-02-101-2/+4
|
* Change the generated VOP_ macro implementations to improve type checkingphk2005-01-131-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and KASSERT coverage. After this check there is only one "nasty" cast in this code but there is a KASSERT to protect against the wrong argument structure behind that cast. Un-inlining the meat of VOP_FOO() saves 35kB of text segment on a typical kernel with no change in performance. We also now run the checking and tracing on VOP's which have been layered by nullfs, umapfs, deadfs or unionfs. Add new (non-inline) VOP_FOO_AP() functions which take a "struct foo_args" argument and does everything the VOP_FOO() macros used to do with checks and debugging code. Add KASSERT to VOP_FOO_AP() check for argument type being correct. Slim down VOP_FOO() inline functions to just stuff arguments into the struct foo_args and call VOP_FOO_AP(). Put function pointer to VOP_FOO_AP() into vop_foo_desc structure and make VCALL() use it instead of the current offsetoff() hack. Retire vcall() which implemented the offsetoff() Make deadfs and unionfs use VOP_FOO_AP() calls instead of VCALL(), we know which specific call we want already. Remove unneeded arguments to VCALL() in nullfs and umapfs bypass functions. Remove unused vdesc_offset and VOFFSET(). Generally improve style/readability of the generated code.
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* The remaining part of nmount/omount/rootfs mount changes. I cannot sensiblyphk2004-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | split the conversion of the remaining three filesystems out from the root mounting changes, so in one go: cd9660: Convert to nmount. Add omount compat shims. Remove dedicated rootfs mounting code. Use vfs_mountedfrom() Rely on vfs_mount.c calling VFS_STATFS() nfs(client): Convert to nmount (the simple way, mount_nfs(8) is still necessary). Add omount compat shims. Drop COMPAT_PRELITE2 mount arg compatibility. ffs: Convert to nmount. Add omount compat shims. Remove dedicated rootfs mounting code. Use vfs_mountedfrom() Rely on vfs_mount.c calling VFS_STATFS() Remove vfs_omount() method, all filesystems are now converted. Remove MNTK_WANTRDWR, handling RO/RW conversions is a filesystem task, and they all do it now. Change rootmounting to use DEVFS trampoline: vfs_mount.c: Mount devfs on /. Devfs needs no 'from' so this is clean. symlink /dev to /. This makes it possible to lookup /dev/foo. Mount "real" root filesystem on /. Surgically move the devfs mountpoint from under the real root filesystem onto /dev in the real root filesystem. Remove now unnecessary getdiskbyname(). kern_init.c: Don't do devfs mounting and rootvnode assignment here, it was already handled by vfs_mount.c. Remove now unused bdevvp(), addaliasu() and addalias(). Put the few necessary lines in devfs where they belong. This eliminates the second-last source of bogo vnodes, leaving only the lemming-syncer. Remove rootdev variable, it doesn't give meaning in a global context and was not trustworth anyway. Correct information is provided by statfs(/).
* make "ffs" and alias for "ufs" when it comes to filesystem names.phk2004-12-061-0/+2
|
* Introduce vfs_byname_kld() which will try to load the filesystemphk2004-12-031-0/+37
| | | | | | | as a module if possible. Use it so we don't have linker magic in the middle of the already complex mount code.
* Back when VOP_* was introduced, we did not have new-style structphk2004-12-011-263/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initializations but we did have lofty goals and big ideals. Adjust to more contemporary circumstances and gain type checking. Replace the entire vop_t frobbing thing with properly typed structures. The only casualty is that we can not add a new VOP_ method with a loadable module. History has not given us reason to belive this would ever be feasible in the the first place. Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc. Give coda correct prototypes and function definitions for all vop_()s. Generate a bit more data from the vnode_if.src file: a struct vop_vector and protype typedefs for all vop methods. Add a new vop_bypass() and make vop_default be a pointer to another struct vop_vector. Remove a lot of vfs_init since vop_vector is ready to use from the compiler. Cast various vop_mumble() to void * with uppercase name, for instance VOP_PANIC, VOP_NULL etc. Implement VCALL() by making vdesc_offset the offsetof() the relevant function pointer in vop_vector. This is disgusting but since the code is generated by a script comparatively safe. The alternative for nullfs etc. would be much worse. Fix up all vnode method vectors to remove casts so they become typesafe. (The bulk of this is generated by scripts)
* Simplify initialization of va_null a little bit.phk2004-09-151-13/+13
|
* Put a version element in the VFS filesystem configuration structurephk2004-07-301-2/+7
| | | | | | | | | | | | | | | | | | 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.
* Convert the vfsconf list to a TAILQ.phk2004-07-271-25/+19
| | | | | | | | Introduce vfs_byname() function to find things on it. Staticize vfs_nmount() function under the name vfs_donmount(). Various cleanups.
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-1/+2
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* do the vfsstd thing instead of messing up our VFS_SYSCTL macro.alfred2004-07-071-0/+2
|
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Remove opv_desc_vector from vfs_add_vnodeops, since it is definedcperciva2004-02-151-2/+0
| | | | | | | | and given a value, but never used. This has no effect on the resulting binaries, since gcc optimizes the variable away anyway. PR: kern/62684 Approved by: rwatson (mentor)
* Change all SYSCTLS which are readonly and have a related TUNABLEsilby2003-10-211-1/+1
| | | | | from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide more useful error messages.
* Initialize struct vfsops C99-sparsely.phk2003-06-121-0/+61
| | | | | Submitted by: hmp Reviewed by: phk
* Use __FBSDID().obrien2003-06-111-1/+2
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-8/+8
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-8/+8
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* We don't need to check the return value of malloc() againstmux2002-06-221-14/+0
| | | | NULL when the M_WAITOK flag is specified.
* More s/file system/filesystem/gtrhodes2002-05-161-4/+4
|
* These are Alexander Kabaev's VFSops fixes (see the thread 'Found: moduledillon2002-04-301-21/+82
| | | | | | | | | | | | | | | | | loading breakage'). The patch fixes serious issues with the VFS operations vector array which results in a crash when a filesystem module adding a new VOP is loaded into the kernel. Basically what was happening before was that the old operations vector was being freed and a new one allocated. The original MALLOC code tended to reuse the same address for the case and so the bug did not rear its ugly head until the new memory subsystem was emplaced. This patch replaces the temporary workaround Dave O'Brien comitted in 1.58. The patch is clean enough that I intend to MFC it to stable at some point. Submitted by: Alexander Kabaev <ak03@gte.com> MFC after: 1 week
* Commit work-around for panics when mounting FS's that are auto-loaded asobrien2002-03-251-0/+2
| | | | | | | | | | | | | | | modules (ie. procfs.ko). When the kernel loads dynamic filesystem module, it looks for any of the VOP operations specified by the new filesystem that have not been registered already by the currently known filesystems. If any of such operations exist, vfs_add_vnops function calls vfs_opv_recalc function, which rebuilds vop_t vectors for each filesystem and sets all global pointers like ufs_vnops_p, devfs_specop_p, etc to the new values and then frees the old pointers. This behavior is bad because there might be already active vnodes whose v_op fields will be left pointing to the random garbage, leading to inevitable crash soon. Submitted by: Alexander Kabaev <ak03@gte.com>
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-1/+0
| | | | | Also, remove maxsockets. If you look carefully you'll notice that the old zone allocator never honored this anyway.
* Document all functions, global and static variables, and sysctls.eivind2002-03-051-1/+23
| | | | | | | | Includes some minor whitespace changes, and re-ordering to be able to document properly (e.g, grouping of variables and the SYSCTL macro calls for them, where the documentation has been added.) Reviewed by: phk (but all errors are mine)
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* Another round of the <sys/queue.h> FOREACH transmogriffer.phk2001-02-041-2/+1
| | | | | Created with: sed(1) Reviewed by: md5(1)
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-2/+2
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Untangle vfsinit() a bit. Use seperate sysinit functions rather thanpeter2000-12-061-23/+2
| | | | having a super-function calling bits all over the place.
* Do not panic on an uninitialized VOP_xxx() call. This was meant as apeter2000-09-061-2/+2
| | | | | | | | | | | | | | | | | sanity check, but it is too easy to run into, eg: making an ACL syscall when no filesystems have the ACL implementation enabled. The original reason for the panic was that the VOP_ vector had not been assigned and therefor could not be passed down the stack.. and there was no point passing it down since nothing implemented it anyway. vop_defaultop entries could not pass it on because it had a zero (unknown) vector that was indistinguishable from another unknown VOP vector. Anyway, we can do something reasonable in this case, we shouldn't need to panic here as there is a reasonable recovery option (return EOPNOTSUPP and dont pass it down the stack). Requested by: rwatson
* The sysctl mod_xx hack is no longer required now that we have totallypeter1999-12-121-10/+0
| | | | dynamic sysctl registration.
* Move a couple of globals here where they are initialised, rather thanmsmith1999-11-011-0/+7
| | | | orphaning them in vfs_conf.c
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Removed references to a nonexistent variable. This fixes building kernelsbde1999-07-291-4/+1
| | | | without -O.
* * Register sysctl nodes before running sysinits when loading files anddfr1999-03-071-2/+21
| | | | | | | | unregister them after sysuninits when unloading. * Add code to vfs_register() to set the oid number of vfs sysctls to the type number of the filesystem. Reviewed by: bde
* * Change sysctl from using linker_set to construct its tree using SLISTs.dfr1999-02-161-46/+1
| | | | | | | | | | This makes it possible to change the sysctl tree at runtime. * Change KLD to find and register any sysctl nodes contained in the loaded file and to unregister them when the file is unloaded. Reviewed by: Archie Cobbs <archie@whistle.com>, Peter Wemm <peter@netplex.com.au> (well they looked at it anyway)
* Fix warnings related to -Wall -Wcast-qualdillon1999-01-281-2/+2
|
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-12/+12
| | | | kernel compile
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-6/+2
| | | | and local variables, goto labels, and functions declared but not defined.
* Fixed the type of vfs_modevent (a little late, to match the correspondingbde1998-11-151-2/+2
| | | | change in sys/mount.h).
OpenPOWER on IntegriCloud