summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
Commit message (Collapse)AuthorAgeFilesLines
* Rework the kernel environment subsystem. We now convert the staticmux2002-04-171-3/+8
| | | | | | | | | | | | | | | | | environment needed at boot time to a dynamic subsystem when VM is up. The dynamic kernel environment is protected by an sx lock. This adds some new functions to manipulate the kernel environment : freeenv(), setenv(), unsetenv() and testenv(). freeenv() has to be called after every getenv() when you have finished using the string. testenv() only tests if an environment variable is present, and doesn't require a freeenv() call. setenv() and unsetenv() are self explanatory. The kenv(2) syscall exports these new functionalities to userland, mainly for kenv(1). Reviewed by: peter
* Centralize the "bootdev" and "dumpdev" variables. They are still prettyphk2002-03-311-0/+1
| | | | | bogus all things considered, but at least now they don't camouflage as being MD variables.
* Move the mount of the root filesystem to happen in the init process beforephk2002-03-081-5/+2
| | | | | | | the exec if /sbin/init. This allows the scheduler to get started and kthreads a chance to run before we start filesystem operations.
* Document all functions, global and static variables, and sysctls.eivind2002-03-051-0/+8
| | | | | | | | 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)
* Remove the use of _PATH_DEV in the example.obrien2001-11-241-2/+2
| | | | | | | | | | | | The kernel certainly doesn't use _PATH_DEV or even /dev/ to find the device. It cannot, since "/" has not been mounted. Maybe the only affect of using /dev/ is that it gets put in the mounted-from name for "/", so that mount(8), etc., display an absolute path before "/" has been remounted. Many have never bothered typing the full path, and code that constructs a path in rootdevnames[] never bothered to construct a full path, so the example shouldn't have it. Submitted by: bde
* We only have slices on i386 and IA-64.obrien2001-11-201-1/+5
|
* KSE Milestone 2julian2001-09-121-3/+3
| | | | | | | | | | | | | | 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
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-2/+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)
* 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
|
* Reviewed by: jlemonadrian2001-03-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | An initial tidyup of the mount() syscall and VFS mount code. This code replaces the earlier work done by jlemon in an attempt to make linux_mount() work. * the guts of the mount work has been moved into vfs_mount(). * move `type', `path' and `flags' from being userland variables into being kernel variables in vfs_mount(). `data' remains a pointer into userspace. * Attempt to verify the `type' and `path' strings passed to vfs_mount() aren't too long. * rework mount() and linux_mount() to take the userland parameters (besides data, as mentioned) and pass kernel variables to vfs_mount(). (linux_mount() already did this, I've just tidied it up a little more.) * remove the copyin*() stuff for `path'. `data' still requires copyin*() since its a pointer into userland. * set `mount->mnt_statf_mntonname' in vfs_mount() rather than in each filesystem. This variable is generally initialised with `path', and each filesystem can override it if they want to. * NOTE: f_mntonname is intiailised with "/" in the case of a root mount.
* Change and clean the mutex lock interface.bmilekic2001-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Add `_PATH_DEVZERO'.obrien2000-12-091-1/+2
| | | | Use _PATH_* where where possible.
* Remove unneeded #include <sys/proc.h> lines.phk2000-10-291-1/+0
|
* Convert lockmgr locks from using simple locks to using mutexes.jasone2000-10-041-2/+2
| | | | | | Add lockdestroy() and appropriate invocations, which corresponds to lockinit() and must be called to clean up after a lockmgr lock is no longer needed.
* Avoid the modules madness I inadvertently introduced by making thephk2000-09-021-58/+1
| | | | | | | | | | | | | | | | | | cloning infrastructure standard in kern_conf. Modules are now the same with or without devfs support. If you need to detect if devfs is present, in modules or elsewhere, check the integer variable "devfs_present". This happily removes an ugly hack from kern/vfs_conf.c. This forces a rename of the eventhandler and the standard clone helper function. Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include like <sys/queue.h> Remove all #includes of opt_devfs.h they no longer matter.
* Fix panic when removing open device (found by bp@)phk2000-08-241-0/+20
| | | | | | | | | | | | Implement subdirs. Build the full "devicename" for cloning functions. Fix panic when deleted device goes away. Collaps devfs_dir and devfs_dirent structures. Add proper cloning to the /dev/fd* "device-"driver. Fix a bug in make_dev_alias() handling which made aliases appear multiple times. Use devfs_clone to implement getdiskbyname() Make specfs maintain the stat(2) timestamps per dev_t
* Make a trip to Pointy-Hats-R-Us and actually include the header thatmsmith2000-05-221-0/+2
| | | | | | defines ROOTDEVNAME. Submitted by: "Jeffrey S. Sharp" <jss@subatomix.com>
* Split the logic ofgreen2000-03-201-11/+48
| | | | | | | | | | | | | | | | | static int setrootbyname(char *name); out into dev_t getdiskbyname(char *name); This makes it easy to create a new DDB command, which is the big reason for the change. You can now do the following in DDB: Example rc.conf entry: dumpdev="/dev/ad0s1b" # Device name to crashdump to (if enabled). db> show disk/ad0s1b dev_t = 0xc0b7ea00 db> p *dumpdev c0b7ea00
* Change the mountroot prompt to something that doesn't look at all like amsmith2000-02-171-1/+1
| | | | | | | | firmware prompt. Several sleepy folk mistook the '>>>' for the SRM prompt, which was never the desired idea. Submitted by: Andrew Gallatin <gallatin@cs.duke.edu> Approved by: jkh
* Put on asbestos suit and put a splcam() around the 'Mounting root from..'peter1999-12-121-0/+3
| | | | | message to stop it splitting. Every single scsi machine I've seen seems to reliably collide with this and it's rather annoying.
* Scan cdevs for potential root devices, rather than bdevs.phk1999-12-081-6/+7
|
* Make BOOTP work again.dillon1999-11-291-1/+1
| | | | Submitted by: Doug Ambrisko <ambrisko@whistle.com>
* Use the correct mounted-from path when allocating the root mount, if we knowmsmith1999-11-281-7/+7
| | | | | | | | | | | what it is. Be more correct in unbusying the mountpoint (especially before freeing it). Remove support for mounting 'r' devices as root. You don't mount 'r' devices anywhere else, and they're going away anyway. Submitted by: bde
* Retire MFS_ROOT and MFS_ROOT_SIZE options from the MFS implementation.phk1999-11-261-0/+4
| | | | | | | | | | | | | | | | | Add MD_ROOT and MD_ROOT_SIZE options to the md driver. Make the md driver handle MFS_ROOT and MFS_ROOT_SIZE options for compatibility. Add md driver to GENERIC, PCCARD and LINT. This is a cleanup which removes the need for some of the worse hacks in MFS: We really want to have a rootvnode but MFS on a preloaded image doesn't really have one. md is a true device, so it is less trouble. This has been tested with make release, and if people remember to add the "md" pseudo-device to their kernels, PicoBSD should be just fine as well. If people have no other use for MFS, it can be removed from the kernel.
* If vfs_mountroot_try() isn't given a path to try mounting, return a silentmsmith1999-11-211-1/+1
| | | | | error rather than complaining about it verbosely. No path is not really a failure, but the diagnostic was confusing and unuseful.
* struct mountlist and struct mount.mnt_list have no business beingphk1999-11-201-1/+1
| | | | | | | | | | a CIRCLEQ. Change them to TAILQ_HEAD and TAILQ_ENTRY respectively. This removes ugly mp != (void*)&mountlist comparisons. Requested by: phk Submitted by: Jake Burkholder jake@checker.org PR: 14967
* Ignore leading 'r' in base of root device name.phk1999-11-081-0/+2
|
* Clean up a couple of initialisations in order to suppress a correctmsmith1999-11-061-2/+4
| | | | but un-useful warning.
* Guard against freeing NULL if vfs_mountroot_try is called with NULLmsmith1999-11-051-2/+4
| | | | as an argument (this is legal to make other code simpler).
* Expand the sscanf buffer to 32 bytes to make room for the expandedmsmith1999-11-051-1/+1
| | | | | | | pattern, with some space left over to avoid this mistake next time it's improved. Submitted by: luoqi
* Allow vfs names to include the digits 0-9 as well as the letters a-z.msmith1999-11-041-1/+1
| | | | | | This should let 'cd9660' filesystems be allowed. Submitted by: ghelmer
* Re-implement the handing of RB_CDROM in a machine-independant fashion.msmith1999-11-041-0/+24
| | | | | | We currently only search SCSI and IDE CDROMs; if there's felt to be a need for supporting the very old and rare soundcard etc. drives for this application they can be trivially added.
* Make MFS work with the new root filesystem search process.msmith1999-11-031-8/+10
| | | | | | | | | | | | | | | | | In order to achieve this, root filesystem mount is moved from SI_ORDER_FIRST to SI_ORDER_SECOND in the SI_SUB_MOUNT_ROOT sysinit group. Now, modules which wish to usurp the default root mount can use SI_ORDER_FIRST. A compiled-in or preloaded MFS filesystem will become the root filesystem unless the vfs.root.mountfrom environment variable refers to a valid bootable device. This will normally only be the case when the kernel and MFS image have been loaded from a disk which has a valid /etc/fstab file. In this case, the variable should be manually overridden in the loader, or the kernel booted with -a. In either case "mfs:" should be supplied as the new value. Also fix a typo in one DFLTROOT case that would not have compiled.
* This is a complete rewrite of vfs_conf.c, which changes the way the rootmsmith1999-11-011-158/+270
| | | | | | | | | | | | | | filesystem is discovered. Preference is given to using the kernel environment variable vfs.root.mountfrom, which is set by the loader according to the contents of /etc/fstab. Changes in the MD code provide fallback mechanisms for systems not using the loader. A more robust fallback path is also provided, with the last recourse being to prompt on the console for a root device. These changes drastically simplify the machine-dependant parts of the root configuration process. In addition, support for CDROM root devices has been removed; it was a nasty hack and didn't work.
* Fix BOOTP root FS mounts. Also cleanup vfs_getnewfsid() and collapsedillon1999-09-191-1/+21
| | | | | | | | | | addaliasu() into addalias() (no operational change) and clarify comments relating to a trick that vclean() uses. The fix to BOOTP is yet another hack. Actually, rootfsid handling is already a major hack. The whole thing needs to be cleaned up. Reviewed by: David Greenman <dg@root.com>, Alan Cox <alc@cs.rice.edu>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix warnings in last commit (dev_t is not an int, and not even intpeter1999-07-031-3/+3
| | | | compatable in arg lists on the Alpha)
* Be more informative and try to ask the user in some instances if we can'tphk1999-07-031-3/+3
| | | | figure out the root device.
* I'm tired of having a 'hanging root device'.. This isn't a "fix", justpeter1999-06-261-1/+4
| | | | | a workaround for a specific case where cam interrupts right in the middle of this printf.
* Back out my previous change (phk didn't like it) in favour of settingjb1999-05-241-8/+1
| | | | | rootdev in the mfs initialisation code iff MFS_ROOT (which Bruce doesn't like). Damned if I do - damned if I don't.
* Make MFS_ROOT work again. MFS_ROOT means that rootdev is not set.jb1999-05-231-2/+10
| | | | | Broken by: phk Problem ignored by: phk
* Remove the SLICE code.sos1998-09-141-5/+1
| | | | | This clearly needs alot more thought, and we dont need this to hunt us down in 3.0-RELEASE.
* Pass lists of possible root devices and their names up to thebde1998-06-091-16/+28
| | | | | | | | | | | | | | | | | | | | | | | machine-independent code and try mounting the devices in the lists instead of guessing alternative root devices in a machine- dependent way. autoconf.c: Reject preposterous slice numbers instead of silently converting them to COMPATIBILITY_SLICE. Don't forget to force slice = COMPATIBILITY_SLICE in the floppy device name. Eliminated most magic numbers and magic device names in setroot(). Fixed dozens of style bugs. vfs_conf.c: Put the actual root device name instead of "root_device" in the mount struct if the actual name is available. This is useful after booting with -s. If it were set in all cases then it could be used to do mount(8)'s ROOTSLICE_HUNT and fsck(8)'s hotroot guess better.
* Make the devfs SLICE option a standard type option.julian1998-04-201-1/+2
| | | | (hopefully it will go away eventually anyhow)
* Add changes and code to implement a functional DEVFS.julian1998-04-191-2/+5
| | | | | | | | | | | | | | | | | | | | | This code will be turned on with the TWO options DEVFS and SLICE. (see LINT) Two labels PRE_DEVFS_SLICE and POST_DEVFS_SLICE will deliniate these changes. /dev will be automatically mounted by init (thanks phk) on bootup. See /sys/dev/slice/slice.4 for more info. All code should act the same without these options enabled. Mike Smith, Poul Henning Kamp, Soeren, and a few dozen others This code does not support the following: bad144 handling. Persistance. (My head is still hurting from the last time we discussed this) ATAPI flopies are not handled by the SLICE code yet. When this code is running, all major numbers are arbitrary and COULD be dynamically assigned. (this is not done, for POLA only) Minor numbers for disk slices ARE arbitray and dynamically assigned.
* If the root mount fails from a device that is not the compatability slicemsmith1998-03-111-1/+13
| | | | | | | | | | | | | | | | of a disk, because that slice does not exist, try again mounting from the compatability slice. This handles the case where a disk has been initialised by 'disklabel auto', which places a bogus and invalid slice entry on the disk. The bootstrap is not smart enough to reject this slice, and pretends to boot from it. Believing the the bootstrap at this point is unwise. Booting from non-'wd' disks thus prepared is still broken, as 'disklabel -rwB xdN auto' does not initialise the disk type field, and the bootstrap mistakenly claims that the disk is handled by 'wd'. Behaviour is now consistent with DEVFS expected characteristics.
* Staticize.eivind1998-02-091-2/+2
|
* Make the BOOTP family new-style options (in opt_bootp.h)eivind1998-01-091-1/+3
|
* Cleanup my last patch herejulian1997-12-011-43/+32
| | | | Reviewed by: sef@kthrup.com and phk@freebsd.org
OpenPOWER on IntegriCloud