History log of /freebsd-9.3-release/sbin/mount/mount.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 225341 02-Sep-2011 jhb

Clear the mountprog variable after each mountfs() call so that mountprog
options don't leak over into subsequent mounts listed in /etc/fstab.
While here, fix a memory leak in debug mode.

Reported by: rank1seeker @ gmail
Approved by: re (kib)
MFC after: 1 week


# 224503 29-Jul-2011 mckusick

Update to -r224294 to ensure that only one of MNT_SUJ or MNT_SOFTDEP
is set so that mount can revert back to using MNT_NOWAIT when doing
getmntinfo.

Approved by: re (kib)


# 224294 24-Jul-2011 mckusick

Move the MNTK_SUJ flag in mnt_kern_flag to MNT_SUJ in mnt_flag
so that it is visible to userland programs. This change enables
the `mount' command with no arguments to be able to show if a
filesystem is mounted using journaled soft updates as opposed
to just normal soft updates.

Approved by: re (bz)


# 222832 07-Jun-2011 delphij

Add a special mount option "failok" to indicate that the administrator wants
the system to proceed to boot without bailing out into single user mode,
even when the file system can not be successfully mounted.

This option is implemented in mount(8) and not passed into kernel.

MFC after: 1 month


# 221124 27-Apr-2011 rmacklem

This patch changes head so that the default NFS client is now the new
NFS client (which I guess is no longer experimental). The fstype "newnfs"
is now "nfs" and the regular/old NFS client is now fstype "oldnfs".
Although mounts via fstype "nfs" will usually work without userland
changes, an updated mount_nfs(8) binary is needed for kernels built with
"options NFSCL" but not "options NFSCLIENT". Updated mount_nfs(8) and
mount(8) binaries are needed to do mounts for fstype "oldnfs".
The GENERIC kernel configs have been changed to use options
NFSCL and NFSD (the new client and server) instead of NFSCLIENT and NFSSERVER.
For kernels being used on diskless NFS root systems, "options NFSCL"
must be in the kernel config.
Discussed on freebsd-fs@.


# 213298 30-Sep-2010 jh

Fix printing of the "rw" mount option in fstab(5) format (-p option).
fstab(5) format requires that one of "rw", "rq" or "ro" is always
specified.

PR: bin/123021
Reviewed by: keramida, rodrigc
MFC after: 2 weeks


# 204840 07-Mar-2010 bz

As statfs.f_flags are uint64_t the local variables should be as well.
We'll start noticing this with the next flag introduced as the lower
32bit are all used.
As this is old code we might need to do a full tree sweep one day, unless
changing our strategy to use a different `API' for getting/setting flags
along with the rest of the statfs data.

While here compare to 0 explicitly [1].

Suggested by: kib [1]
Reviewed by: kib
MFC after: 5 days


# 200796 21-Dec-2009 trasz

Implement NFSv4 ACL support for UFS.

Reviewed by: rwatson


# 197200 14-Sep-2009 pjd

Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1)
does. This is not POLA violation, because there is no single file system in the
base that use MNT_IGNORE currently, although ZFS snapshots will be mounted with
MNT_IGNORE after next commit.

Reviewed by: kib
MFC after: 3 days


# 192930 27-May-2009 rmacklem

Add support for the experimental nfs client to mount_nfs. The
experimental client is used when the fstype is "newnfs" or the "nfsv4"
option is specified. It includes the addition of the option:
gssname - to specify a client side initiator host based principal name
which is specific to NFSv4.
It also includes a change to mount.c, so that it knows about
mount_newnfs, but not mount_nfs4.

Reviewed by: dfr
Approved by: kib (mentor)


# 189397 05-Mar-2009 rodrigc

Add a -o mountprog parameter to mount which explicitly allows
an alternative program to be used for mounting a file system.
Ideally, all file systems
should be converted to pass string arguments to nmount(), so that
/sbin/mount can handle them. However, certain file systems such as FUSE have
not done this, and want to have their own userland mount programs.

For example, to mount an NTFS file system with the FUSE NTFS driver:

mount -t ntfs -o mountprog=/usr/local/bin/ntfs-3g /dev/acd0 /mnt

or via an fstab entry:

/dev/acd0 /mnt ntfs ro,noauto,mountprog=/usr/local/bin/ntfs-3g 0 0

PR: 120784
Requested by: Dominic Fandrey


# 187130 13-Jan-2009 obrien

r187093 failed to keep the lifetime of the pointer suitable for reentrancy.
Fix that. Also move the current buffer size into the 'cpa' structure.


# 187093 12-Jan-2009 obrien

Use a dynamically grown buffer for building the argv for the sub-mounts.
Also fix RCSid spamage.

Inspired by patch from: Christoph Mallon <christoph.mallon@gmx.de>


# 187035 10-Jan-2009 obrien

Explicitly check each mount argv building assignment for buffer over flowing.

Reviewed by: imp (earlier version of patch)


# 186505 26-Dec-2008 obrien

style(9)


# 186504 26-Dec-2008 obrien

Make the sub-'argc' static to make it harder to overwrite thru a buffer
overflow.


# 186291 18-Dec-2008 obrien

Be a little bit more pestimistic in argument handling - check if we've
overflown our internal buffer (though after the fact), and s/strncpy/strlcpy/

Reviewed by: rodrigc
Obtained from: Juniper Networks


# 182570 31-Aug-2008 matteo

Don't return always 0. Return what we get from exec_mountprog or
mount_fs.

PR: bin/125154
MFC after: 1 day


# 175964 04-Feb-2008 matteo

Fix mount -p and mount -u -ocurrent on gjournaled FS

PR: bin/120162
Submitted by: Niki Denev
MFC after: 1 week


# 175949 03-Feb-2008 matteo

Fix printing of unionfs mounts when using the -p option

PR: bin/75585
MFC after: 1 week


# 171023 25-Jun-2007 rafan

- Remove UMAP filesystem. It was disconnected from build three years ago,
and it is seriously broken.

Discussed on: freebsd-arch@
Approved by: re (mux)


# 168698 13-Apr-2007 phk

Align -p output in TAB built columns suitable for /etc/fstab.


# 166526 06-Feb-2007 rodrigc

Print warning that "-t msdos" is deprecated and being converted to
"-t msdosfs". The conversion has been happening since 1.43, but
no equivalent conversion happens in "umount -t", which led to some
confusion with some users.

PR: 79296
Submitted by: Nobuhiro Yasutomi <nobuhiro yasutomi nifty ne jp>


# 166439 02-Feb-2007 pjd

Use pidfile(3) API to restart mountd(8) on success mount.
This why we won't kill random process if there is a stale PID in
/var/run/mountd.pid.


# 164266 13-Nov-2006 rodrigc

Fix debugging output of '-d', to more accurately reflect if
we exec an external mount program, or just call nmount()
to mount a filesystem.

Noticed by: kris


# 163843 31-Oct-2006 pjd

Teach mount(8) about MNT_GJOURNAL flag.
MNT_GJOURNAL flag is not a mount-time flag, but it is needed to show
'gjournal' option in mount(8) output.

Sponsored by: home.pl


# 163672 24-Oct-2006 ru

Two tiny style fixes.


# 163671 24-Oct-2006 ru

Revert rev. 1.86 by jmallett@ as it breaks "ro" mounts specified
in /etc/fstab.

This has been happening due to the priority inversion; options
specified on the command line should take precedence over options
from fstab over default "noro" option, but since both the default
"noro" and options specified on the command line (-w, -r, -o ...)
were put into the same "options" variable, "noro" took precedence
over fstab "ro" (this is easily visible with "mount -d").

PR: bin/100164


# 160303 12-Jul-2006 des

Teach mount(8) about a 'late' keyword, which means the file system should
not be mounted unless the -l flag was specified.

Add an rc script, mountlate, which basically runs 'mount -a -l'. It runs
after DAEMON but before LOGIN.

This is useful for things like loopback mounts, because mountcritremote
runs before mountd / nfsd (since /usr might be a remote file system), so
an attempt to mount a loopback network file system in mountcritremote will
fail.

Also add a progress message to mountcritlocal, for the sake of symmetry
with similar messages in mountcritremote and mountlate.

Reviewed by: freebsd-rc
MFC after: 3 weeks


# 159473 09-Jun-2006 jmallett

Minor style tweaks while nearby. Namely ANSIfy and parens on return values.


# 159472 09-Jun-2006 jmallett

Rather than using specified_ro to parse the options list an extra time, and
keeping a flag to check whether we actually wanted to mount the filesystem
readonly, setup the options list so that we start off by assuming rw is what's
desired and let later flags change that.


# 159177 02-Jun-2006 rodrigc

Fix "mount -u -o ro".

Requested by: maxim


# 158400 10-May-2006 maxim

o Extend rev. 1.75 and restore an ability to specify a non-default
quota files location.

Submitted by: Kostik Belousov


# 156229 03-Mar-2006 keramida

When there are no mount options, an implicit "rw" should be printed in
the output of ``mount -p''.

Approved by: rodrigc


# 155997 25-Feb-2006 rodrigc

If we specify: mount -u (update), without specifying an
additional -r (read-only) flag or or -w (read-write) flag,
then assume we want, mount -u -w.

When doing a mount update, this will implicitly pass a "noro" mount
option down to the VFS layer.
vfs_mergeopts() in vfs_mount.c will then remove the "ro" mount option
if it exists in the mount options for a mounted file system.
This means that "mount -u" works the same as "mount -u -w"
and will convert a read-only mount to read-write.


# 154773 24-Jan-2006 pjd

s/<space><tab>/<tab>/


# 154512 18-Jan-2006 pjd

Resolve the mount point's path with realpath(2) before checking if file
system is mounted. This prevevents duplicated mounts.

The change I made against the original patch is to fall back to the given
path on realpath(2) failure instead of exiting with an error.

Submitted by: Andreas Kohn <andreas@syndrom23.de>
PR: bin/89782
MFC after: 3 days


# 153360 12-Dec-2005 rodrigc

For reiserfs, pass mount parameters directly to nmount() instead
of forking an external mount_reiserfs program.

Reviewed by: dumbbell


# 153062 03-Dec-2005 rodrigc

Remove workaround for old GCC bugs.

Submitted by: ru


# 153038 02-Dec-2005 rodrigc

Simplify parsing of mount options by passing
"rw" option down to kernel, since vfs_donmount() can now parse it.


# 152778 24-Nov-2005 avatar

Fixing a regression introduced in rev1.72 by connecting cd9660 to the
external mounting program list as well; otherwise, entry like the following
in /etc/fstab wouldn't work:

/dev/acd0 /mnt/cdrom cd9660 ro,-C=big5 0 0

Reviewed by: rodrigc


# 152732 23-Nov-2005 rodrigc

Do not pass userquota and groupquota mount options to nmount().
These options are read from fstab by quotacheck(8), but are not
valid mount options that need to be passed down the the filesystem.

Noticed by: maxim


# 152668 21-Nov-2005 rodrigc

For mounting a UFS filesystem, call nmount() directly, instead of having
special logic which called mount() in a separate mount_ufs() function.


# 152465 16-Nov-2005 rodrigc

Do not pass noauto to nmount() or external mount program.

Noticed by: maxim


# 152344 12-Nov-2005 rodrigc

- Minor fixes to raise WARNS level to 6.
- Teach the mount program to call the nmount() syscall directly
- Preserve existing method of calling mount() for UFS, until we clean things
up.
- Preserve existing method of forking and calling external mount programs for
mfs, msdosfs, nfs, nfs4, ntfs, nwfs, nullfs, portalfs, reiserfs, smbfs,
udf, umapfs, unionfs
- devfs, linprocfs, procfs, ext2fs call nmount() syscall directly, since
that is all those external mount programs were doing

Reviewed by: phk
Discussed on: arch


# 151043 07-Oct-2005 rodrigc

In prmount(), use an unsigned int variable to eliminate
'comparison between signed and unsigned' compiler warning.


# 151042 07-Oct-2005 rodrigc

Switch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Make prototype in extern.h match prototype in mount_ufs.c


# 144133 26-Mar-2005 cperciva

When executing mount_foo, pass "mount_foo" as argv[0] instead of "foo".
This unbreaks "/rescue/mount -t foo" -- previously it was necessary to
explicitly call "/rescue/mount_foo".

Hints from: gordon
X-MFC after: 3 days (if approved by re@)


# 141611 10-Feb-2005 ru

Sync program's usage() with manpage's SYNOPSIS.


# 138187 29-Nov-2004 ru

Fix the mount(8) status reporting, now that MNT_NODEV is a no-op (zero).

Asked to commit by: phk


# 128658 26-Apr-2004 bmilekic

The previous change to mount(8) to report ufs or ufs2 used
libufs, which only works for Charlie root.

This change reverts the introduction of libufs and moves the
check into the kernel. Since the f_fstypename is the same
for both ufs and ufs2, we check fs_magic for presence of
ufs2 and copy "ufs2" explicitly instead.

Submitted by: Christian S.J. Peron <maneo@bsdpro.com>


# 128073 09-Apr-2004 markm

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 125933 17-Feb-2004 grog

Report the difference between ufs and ufs2.

Submitted by: "Christian S.J. Peron" <maneo@bsdpro.com>


# 125365 03-Feb-2004 nectar

Correct a typo and unbreak the build.

Pointy hat to: pjd


# 125339 02-Feb-2004 pjd

Made use of MNT_USER flag and inform about user responsible for mount
in those cases:
1. File system was mounted by an unprivileged user.
2. File system was mounted by an unprivileged root user.
3. File system was mounted by a privileged non-root user.

Point 1 is when file system was mounted by unprivileged user
(sysctl vfs.usermount was equal to 1 then).

Point 2 is when file system was mounted by root, while sysctl
security.bsd.suser_enabled is set to 0 and sysctl vfs.usermount
is set to 1.

Point 3 is because we want to be ready for capabilities.

Reviewed by: rwatson
Approved by: scottl (mentor)


# 125200 29-Jan-2004 guido

Style(9) option sorting

Submitted by: Ruslan Ermilov <ru@FreeBSD.org>


# 125197 29-Jan-2004 guido

Fix manpage and usage() to reflect that -a can be used in combination
with -o

Submitted by: Ruslan Ermilov <ru@FreeBSD.org>
Pointed out by: Ceri Davies <ceri@submonkey.net


# 125194 29-Jan-2004 guido

Unbreak -o fstab and -o current in combination with -a

MFC after: 2 weeks


# 124201 07-Jan-2004 anholt

Allow trailing slashes for MNT_UPDATE case (mount -u), too.

PR: bin/59144
Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>


# 123268 07-Dec-2003 trhodes

Style change


# 123242 07-Dec-2003 iedowse

Print out the file system access statistics using uintmax_t types
instead of casting the unsigned 64-bit values to longs.

Suggested by: bde


# 123162 05-Dec-2003 iedowse

Don't include the file system ID in the output of `mount -v' if it
is all zeros. The kernel now consistently zeroes FSIDs for non-root
users, so there's no point in printing these.

Also fix a number of compiler warnings, including two real bugs:
- a bracket placement bug caused `mount -t ufs localhost:/foo /mnt'
to override the `-t ufs' specification and use mount_nfs.
- an unitialised variable was used instead of _PATH_SYSPATH when
warning that the mount_* program cound not be found.

Submitted by: Rudolf Cejka <cejkar@fit.vutbr.cz> (FSID part)
Approved by: re (scottl)


# 118580 07-Aug-2003 imp

Prefer PATH_MAX to MAXPATHLEN. PATH_MAX has the trailing NUL.


# 117742 18-Jul-2003 iedowse

When mount(8) is invoked with the `-v' flag, display the filesystem
ID for each file system in addition to the normal information.

In umount(8), accept filesystem IDs as well as the usual device and
path names. This makes it possible to unambiguously specify which
file system is to be unmounted even when two or more file systems
share the same device and mountpoint names (e.g. NFS mounts from
the same export into different chroots).

Suggested by: Dan Nelson <dnelson@allantgroup.com>


# 117031 29-Jun-2003 gordon

Convert fsck and mount to using execvP to find fsck_foo and mount_foo.
This simplifies the code path and makes the default path easy to override
in the /rescue case.

Submitted by: Tim Kientzle <kientzle@acm.org>


# 113220 07-Apr-2003 mdodd

Implement the '-F' option for mount & umount which allows the user to
specify an alternate fstab file.


# 105118 14-Oct-2002 rwatson

Teach mount(8) about MNT_ACLS for the purposes of mount options and
mount option printing.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories


# 102231 21-Aug-2002 trhodes

s/filesystem/file system/g as discussed on -developers


# 101205 02-Aug-2002 rwatson

Introduce support for Mandatory Access Control and extensible
kernel access control.

Teach mount(8) to understand the MNT_MULTILABEL flag, which is used
to determine whether a file system operates with individual per-vnode
labels, or treats the entire file system as a single object with a
single (mount) label. The behavior here will probably evolve some
now that nmount(2) is available and can more flexibly support mount
options.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs


# 96707 16-May-2002 trhodes

more file system > filesystem


# 95318 23-Apr-2002 mux

Unbreak NFS mounts when mount(8) is invoked as : mount path@server.

Reviewed by: obrien


# 95289 22-Apr-2002 mux

Do our best to determine if the user is attempting an NFS mount when
the filesystem type isn't given in the command line. In the case of
an IPv6 address containing ':', one must use the '@' separator for it
to be properly parsed (mount_nfs(8) still needs fixing at the moment
though).

PR: bin/37230
Reviewed by: obrien
MFC after: 1 week


# 92882 21-Mar-2002 imp

o __P removed
o main prototype removed


# 77577 01-Jun-2001 ru

- VFS_SET(msdos) -> VFS_SET(msdosfs)
- msdos.ko -> msdosfs.ko
- mount_msdos(8) -> mount_msdosfs(8)
- "msdos" -> "msdosfs" compatibility glue in mount(8)


# 76198 02-May-2001 dd

Implement the -r and -w options as `-o ro' and `-o noro', respectively. At
least in -w's case, simply unsetting the correct bit in init_flags was not
enough. The bit may be reset later if, say, the filesystem is marked `ro'
in fstab. The command line option should override the fstab setting, but
did not. The implementation of -r was changed for consistency.

PR: 26886
Reviewed by: archie


# 69056 22-Nov-2000 phantom

We do not support lfs. Remove it from list of remountable fs'es.


# 65023 23-Aug-2000 sheldonh

Only print information about reads and writes when the -v flag (for
verbose mode) is specified. This should really have been the case
when this extra cruft was first introduced in rev 1.23.

PR: 20710
Reported by: Mike Meyer <mwm@mired.org>


# 56038 15-Jan-2000 green

This is another in Martin Blapp's N-series of mount-related cleanups :)
Changes are:
- rpc.umntall is called at the right places now in /etc/rc*
- rpc.umntall timeout has been lowered from two days (too high) to one
- verbose messages in rpc.umntall have been clarified
- kill double entries in /var/db/mounttab when rpc.umntall is invoked
- ${early_nfs_mounts} has been removed from /etc/rc
- patched mount(8) -p to print different pass/dump values for ufs filesystems.
(last patch recieved from dan <bugg@bugg.strangled.net>)

Submitted by: Martin Blapp <mbr@imp.ch>, dan <bugg@bugg.strangled.net>


# 55118 26-Dec-1999 eivind

Fix tab completion mounts (like /cdrom/)

Submitted by: Martin Blapp <mb@imp.ch>


# 53976 01-Dec-1999 mckusick

Print out the filesystem read counts now collected by the kernel.

Submitted by: Craig A Soules <soules+@andrew.cmu.edu>
Reviewed by: Kirk McKusick <mckusick@mckusick.com>


# 52678 30-Oct-1999 green

Fix a few things:

1. Get rid of the evilly bogus strdup(fstab) and free if (fstab == "")
as in umount.
2. Don't use /etc/fstab info if the mount instance does not exactly match
the fstab entry.
3. Reversed the mountpoint checking order in getmntpt().
4. Clarify the "not mounted" error message in mount -u. The previous
"unknown special file or file system" wasn't quite right.
5. Get rid of a 1-byte memory leak; this was reported by jhb.

Submitted by: Martin Blapp <mb@imp.ch>


# 52095 10-Oct-1999 green

Let a file with '@' or ':' in it take precedence over defaulting to
nfs.


# 52055 09-Oct-1999 phk

mount* fixes from Martin Blapp <mb@imp.ch>:

Made mount more userfriendly (bad slashes are now filtered out)
and we remove in mount_nfs trailing slashes if there are any.

Fixed mount_xxx binarys to resolve with realpath(3)
the mountpoint.

Translate the deprecated nfs-syntax with '@' to ':' .
The ':' syntax has now precedence, but '@' still works.
Notify the user that the '@' syntax should not be used.

PR: 7846
PR: 13692
Submitted by: Martin Blapp <mb@imp.ch>
Reviewed by: phk


# 52036 08-Oct-1999 n_hibma

- Fixed some cases in which mount was segfaulting.
Original patch from Adrian. Martin added a check for free().

- Included the filesystem type in output of mount

PR: bin/13143
Submitted-By: Martin Blapp <mblapp@kassiopeja.lan.attic.ch>


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 46620 07-May-1999 jkoshy

Null commit.

> PR: bin/6399
> Submitted by: David Malone <dwmalone@maths.tcd.ie>

Also reviewed by: bde


# 46619 07-May-1999 jkoshy

1. Enhanced syntax for mount(8). The -o option now supports two 'meta'
options:

-o fstab brings in filesystem options specified in /etc/fstab
-o current incorporates the current set of options for the file
system

The rightmost option wins in the case of conflicting options being
specified.

E.g.:-

# mount -u -o current,nosuid /home

will preserve the current mount options while adding the 'nosuid' flag.

2. Rewording of manual page to be hopefully clearer; small -Wall
cleanups.

Thanks to David Malone for his patience and willingness to work
multiple patches on request.

PR: bin/6399
Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 44811 16-Mar-1999 bde

Fixed `mount -a -u ...'. Rev.1.19 broke this by trying too hard to
avoid mounting filesystems multiple times.

PR: 10572
Submitted by: Cy Schubert <cy@cschuber.net.gov.bc.ca>


# 37425 06-Jul-1998 charnier

Remove unused #includes. Spelling. Add rcsid. Do not dot terminate err()
strings.


# 36772 08-Jun-1998 bde

Print the write counts if they are nonzero even if we're mounted
readonly, since they tell us about previous write activity.

Use the correct format to print the write counts.


# 36134 17-May-1998 dt

Remove extraneous ")" from output.


# 35105 08-Apr-1998 wosch

New mount option nosymfollow. If enabled, the kernel lookup()
function will not follow symbolic links on the mounted
file system and return EACCES (Permission denied).


# 34910 27-Mar-1998 peter

Don't print the 'writes: sync & async' stuff if we're mounted readonly
or if the fs isn't keeping the stats..


# 34266 08-Mar-1998 julian

Reviewed by: dyson@freebsd.org (john Dyson), dg@root.com (david greenman)
Submitted by: Kirk McKusick (mcKusick@mckusick.com)
Obtained from: WHistle development tree


# 33304 13-Feb-1998 bde

Converted putfsent() to Lite2 mount interface - don't use numeric
filesystem types.


# 31144 12-Nov-1997 julian

Reviewed by: hackers@freebsd.org in general
Obtained from: Whistle Communications tree

Add an option to the way UFS works dependent on the SUID bit of directories
This changes makes things a whole lot simpler on systems running as
fileservers for PCs and MACS. to enable the new code you must
1/ enable option SUIDDIR on the kernel.
2/ mount the filesystem with option suiddir.
hopefully this makes it difficult enough for people to
do this accidentally.
see the new chmod(2) man page for detailed info.


# 29890 27-Sep-1997 kato

Add noclusterr and noclusterw options. The noclusterr and noclusterw
disable clustered read and write, respectively.

Reviewed by: bde


# 28671 24-Aug-1997 steve

Try to avoid mounting filesystems multiple times. Also while
I'm here do some -Wall cleaning.

PR: kern/1839
Reviewed and corrected by: joerg


# 25120 23-Apr-1997 ache

Change vfork to fork, too many memory-clobbering actions present in child


# 23805 12-Mar-1997 bde

Finished (?) merging with Lite2: cleaned up #include mess; fixed merging
errors (mis-sorted prototypes, duplicated MNT_NOATIME, duplicated NULL
mntopts fixup).

Updated getopt() usage.

Fixed style bugs in FreeBSD changes (one or two per line for putfsent()
stuff).


# 23678 11-Mar-1997 peter

Merge from Lite2
- use new getvfsbyname() interface and mount(2) interface

**DANGER WILL ROBINSON!!** You must be running a -current kernel
from within a week or so in order for this to work!


# 18007 03-Sep-1996 dg

Implemented user side of "noatime" mount option. This option disables
the file access time update on reads and can be useful in reducing
filesystem overhead in cases where the access time is not important (like
Usenet news spools).


# 17243 21-Jul-1996 jkh

I have added a new option -p to the mount command. This was
inspired by SunOS version of mount which uses option -p to
indicate that the mount information should be printed in fstab
format.
This is a neat way to create a new fstab file to use later when
one has modified the mount points or mount options or added or
removed mount some mount points. You just type

mount -p > /etc/fstab.new

and there is your new fstab file ready to be used though you
will of course have to add any necessary noauto flags manually.

[Committers note: This also seems to do the wrong thing for AMD
mounts, but in the more average case this is a nifty feature nonetheless
and one can always edit the bogus entries out]

Submitted-By: Jukka Ukkonen <jau@jau.csc.fi>


# 14626 14-Mar-1996 asami

Change the messages slightly when there is no "mount_type" executable
found when the user specifies "mount -t type". Instead of printing
out one message for each path element (/sbin, /usr/sbin), it prints
out:

mount: exec mount_type not found in /sbin, /usr/sbin: No such file or directory

The code is quite long for such a stupid little piece of aesthesism
but it is very straghtforward so I guess it's ok. Besides, I don't
want to do a "char foo[100];" and have malloc break down when someone
decides to add a few more paths to a variable that's far apart from
this code. :)

By the way, there is no malloc() off-by-one error for the '\0' at the
end of the string although I don't explicitly add 1 to the length.
The code allocates strlen(path element)+2 bytes for each path element,
and doesn't use the last two bytes (for the delimiting ", ").

Reviewed by: the list (I hope)


# 14566 11-Mar-1996 mpp

Backout my changes to disallow "mount /mnt /mnt" until I can verify
that nfs mounts work again (I locked up my home machine testing it and can't
see what happened until I get home from work tonight).


# 14474 10-Mar-1996 mpp

Only restrict the user from doing something like "mount /mnt /mnt"
for file system types that actually cause a panic (ufs, msdos, cd9660).
This makes /proc mountable again.


# 14445 09-Mar-1996 mpp

Do not allow the caller to specify the same path for the special
device file and the mount point. This prevents the "unexpected recursive
lock" panic from happening.

This is a temporary fix. A kernel fix would be much much more ugly than
this, and still wouldn't be the "right" way to fix it. After some
of Terry's file system rework is installed, it will be possible to
properly fix this problem in a clean manner. Until then,
this change should prevent use from getting a problem report
on this every month or so (and I just noticed that someone in
one of the freebsd news groups was complaining about this problem, too).


# 14350 03-Mar-1996 jkh

Close PR#17. This may be a contraversal fix in that now mount will
spit out two error lines for a bogus filesystem type, e.g:

root@time-> mount -t foo /dev/sd0a /mnt
mount: exec /sbin/mount_foo for /mnt: No such file or directory
mount: exec /usr/sbin/mount_foo for /mnt: No such file or directory

But I would submit that if you're even going to scan multiple directories
for a mount_foo (which I actually think is somewhat bogus - if it's not
in /sbin, you're probably in big trouble anyway), you should emit an error
for each one. I got multiple complaints (in addition to the PR) that the
existing behavior was very confusing.


# 10288 26-Aug-1995 dg

The changes for adding the "noauto" option were mostly wrong. MNT_NOAUTO
is a kernel flag, and the kernel definately doesn't need to know about
it.


# 10199 23-Aug-1995 jkh

Add a "noauto" flag so that you can do things like prevent your system
from not coming up multiuser just because you have a CD mount in fstab
but no CD in the drive.
Submitted by: "Full Name Not Supplied" <simon@masi.ibp.fr>


# 6491 16-Feb-1995 bde

Fix another bogon in the change before the last.


# 6444 15-Feb-1995 dg

Woops, last change wasn't done quite right...fixed.


# 6441 15-Feb-1995 dg

Verify that the last component of the mount point path exists and is
a directory - allows for better error reporting.


# 2968 22-Sep-1994 wollman

Use getvfs* functions to map between VFS types and names.
Automatically load UFS if it is not present but is loadable.
(This won't happen now, but could happen if we fix NFS diskless support.)


# 1818 02-Aug-1994 dg

Fixed NULL pointer dereference that occured when any options were
specified.


# 1559 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1558,
which included commits to RCS files with non-trunk default branches.


# 1558 26-May-1994 rgrimes

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.