Commit Graph

341 Commits

Author SHA1 Message Date
Alexander Ziaee
1a720cbec5 man filesystems: fix xrefs after move to section 4
Reviewed by: des, imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1077
2024-05-16 10:25:29 -06:00
Ed Maste
54d31cfb27 mount: document atime option
atime is enabled by default, but may be specified explicitly so that any
future change in the default would not have an effect on a given mount.

Reviewed by:	olce, rgrimes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D43580
2024-01-24 14:55:54 -05:00
Warner Losh
393f2dca36 mount: Add a note that userquota and groupquota aren't printed with -p
The quota options are pseudo options and not passed to the mount system
call when a filesystem is mounted. They are not part of the info
returned from getmntinfo(3), so can't be printed. Add a note to this
effect.
2024-01-15 21:38:26 -07:00
Tom Hukins
ba719a0fec Fix "version introduced" in numerous manual pages
MFC after:	1 week
Pull request:	https://github.com/freebsd/freebsd-src/pull/853
2024-01-08 11:35:16 -05:00
Warner Losh
32e86a82f5 sbin: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:23:59 -07:00
Warner Losh
0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh
51e16cb8fc sbin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:29 -07:00
Jose Luis Duran
4b38c532ef mount.8: Mention tarfs(5)
Reviewed by:	markj
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/856
2023-10-04 11:52:40 -04:00
John Baldwin
eba230afba Purge more stray embedded $FreeBSD$ strings
These do not use __FBSDID but instead use bare char arrays.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41957
2023-09-25 07:54:56 -07:00
Warner Losh
b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh
d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh
1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh
42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh
b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Warner Losh
4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Simon J. Gerraty
d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
Kirk McKusick
ad055467be Fix for getmntpoint(3) when checking for NFS mount points.
Only attempt to add /dev/ to f_mntfromname names that result in a
valid character device.

MFC after:    1 week
Reported by:  Bjoern A. Zeeb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-29 15:14:43 -08:00
Kirk McKusick
0bd4c448ec Rewrite to avoid Coverity false positive.
MFC after:    1 week
Reported by:  Coverity (CID 1502669)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-25 16:57:26 -08:00
Kirk McKusick
906c312bbf Document the mntopts(3) functions.
The mntopts(3) functions support operations associated with a mount
point. The main purpose of this commit is to document the mntopts(3)
functions that now appear in 18 utilities in the base system. See
mntopts(3) for the documentation details.

The getmntopts() function appeared in 4.4BSD. The build_iovec(),
build_iovec_argf(), free_iovec(), checkpath(), and rmslashes()
functions were added with nmount(8) in FreeBSD 5.0. The getmntpoint()
and chkdoreload() functions are being added in this commit.

These functions should be in a library but for historic reasons are
in a file in the sources for the mount(8) program. Thus, to access
them the following lines need to be added to the Makefile of the
program wanting to use them:

SRCS+= getmntopts.c
MOUNT= ${SRCTOP}/sbin/mount
CFLAGS+= -I${MOUNT}
.PATH: ${MOUNT}

Once these changes have been MFC'ed to 13 they may be made into
a library.

Reviewed by:  kib, gbe
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37907
2023-01-15 10:21:31 -08:00
Doug Rabson
a3f714c4ff Add support for mounting single files in nullfs
My main use-case for this is to support mounting config files and secrets
into OCI containers. My current workaround copies the files into the
container which is messy and risks secrets leaking into container images
if the cleanup fails.

Reviewed by:	mjg, kib
Tested by:	pho
Differential Revision: https://reviews.freebsd.org/D37478
2022-12-19 16:44:54 +00:00
Jens Schweikhardt
e67af79c4b Delete xref to suidperl(1) which has long since been removed in perl5.12. 2022-08-14 15:43:27 +02:00
Doug Ambrisko
ce00b11940 mount: revert the active vnode reporting feature
Revert the computing of active vnode reporting since statfs is used
by a lot of tools.  Only report the vnodes used.

Reported by:	mjg
2022-06-15 07:24:55 -07:00
Doug Ambrisko
6468cd8e0e mount: add vnode usage per file system with mount -v
This avoids the need to drop into the ddb to figure out vnode
usage per file system.  It helps to see if they are or are not
being freed.  Suggestion to report active vnode count was from
kib@

Reviewed by:   	kib
Differential Revision: https://reviews.freebsd.org/D35436
2022-06-13 07:56:38 -07:00
Mateusz Guzik
a3214fbe7f mount: use pidfile_signal
This fixes a performance problem where poudriere -j 104 keeps remounting
filesystems, which induce wanting to signal mountd, if running. The
current code tries to do it by creating the pidfile in /var/run and
unlinking it if the operation succeeds, inducing contention against
anything doing an exec as it tries to look up /var/run/ld-elf.so.hints

Differential Revision:	https://reviews.freebsd.org/D34681
2022-04-09 15:59:43 +00:00
Gordon Bergling
c09770b2cd mount(8): Fix a typo in source code comments
- s/filesytem/filesystem/

MFC after:	3 days
2022-03-28 19:35:02 +02:00
Robert Wing
8772a9117b mount.8: mention that the snapshot option is exclusive
When using the snapshot option, all other options are ignored. This
update reflects changes made in ab2dbd9b87.

Reviewed by:	0mp, mckusick
Differential Revision:	https://reviews.freebsd.org/D34584
2022-03-17 14:33:03 -08:00
Stefan Eßer
ac413189f5 vfslist.c: initialize skipvfs variable
The function makevfslist is only called once in mount.c, but should
be save to be called more than once with different parameters.

The bin/df command links against this file, and will need this
possibility to allow -l and -t to be used together.

MFC after:	3 days
2022-01-05 23:00:36 +01:00
Piotr Pawel Stefaniak
260f26f035 mount: make libxo support more locale-aware
"special", "node", and "mounter" are not guaranteed to be encoded with
UTF-8. Use the appropriate modifier.

Reported by:	eugen@
2021-09-27 07:12:26 +02:00
John Baldwin
9d324b5ffc mount: Don't pass a NULL format string to xo_err().
This fixes a -Wformat error from GCC 9.

Fixes:		e725ee7eb6 mount: add libxo(3) support
2021-09-25 11:52:10 -07:00
Cameron Katri
e725ee7eb6 mount: add libxo(3) support
Adds --libxo to mount(8).

Differential Revision:	https://reviews.freebsd.org/D30341
2021-09-24 23:07:00 +02:00
Warner Losh
08b242aeee Move the mount name to bit mapping into sys/mount.h so it can be shared with the
kernel.

Discussed with: kib@
Reviewed by: kirk@ (prior version)
Sponsored by: Netflix
Diffential Revision: https://reviews.freebsd.org/D25969
2020-08-19 17:09:58 +00:00
Warner Losh
57d4cc2c58 All the other printf() calls cast to (void) here, do the two newer ones for
consistency.
2020-08-07 02:48:19 +00:00
Sean Eric Fagan
ba7a55d934 Add two options to allow mount to avoid covering up existing mount points.
The two options are

* nocover/cover:  Prevent/allow mounting over an existing root mountpoint.
E.g., "mount -t ufs -o nocover /dev/sd1a /usr/local" will fail if /usr/local
is already a mountpoint.
* emptydir/noemptydir:  Prevent/allow mounting on a non-empty directory.
E.g., "mount -t ufs -o emptydir /dev/sd1a /usr" will fail.

Neither of these options is intended to be a default, for historical and
compatibility reasons.

Reviewed by:	allanjude, kib
Differential Revision:	https://reviews.freebsd.org/D21458
2019-09-23 04:28:07 +00:00
Maxim Sobolev
634add3c8d Allow "update" option to be used in the fstab(5). Document possible use case.
Approved by:	mckusick
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D18586
2019-07-22 20:04:55 +00:00
Kirk McKusick
daba4da81d Add a new "untrusted" option to the mount command. Its purpose
is to notify the kernel that the file system is untrusted and it
should use more extensive checks on the file-system's metadata
before using it. This option is intended to be used when mounting
file systems from untrusted media such as USB memory sticks or other
externally-provided media.

It will initially be used by the UFS/FFS file system, but should
likely be expanded to be used by other file systems that may appear
on external media like msdosfs, exfat, and ext2fs.

Reviewed by:  kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D20786
2019-07-01 23:22:26 +00:00
Konstantin Belousov
7bead17ddc Exercise some care before sending SIGHUP to mountd.
Reviewed by:	antoine, emaste, oshogbo
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D19847
2019-04-08 18:16:49 +00:00
Kirk McKusick
4818bd986c When getting mount information for all filesystems, mount uses the
getfsstat(2) system call using the MNT_NOWAIT flag to indicate that
it wants to use the statfs information cached in the mount structure.
When the -v (verbose) flag is specified, we need to use the MNT_WAIT
flag to getfsstat(2) so that kernel will call VFS_STATFS to get the
current statfs statistics from each filesystem.

Sponsored by:	Netflix
2018-08-07 21:17:45 +00:00
Mateusz Piotrowski
70866c8dbd Fix synopsis of the -t option.
While here:

 - Remove deprecated ".Tn" macros.
 - Improve formatting and fix typos in the description of
   the -t option.

Reviewed by:	bcr
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16541
2018-08-06 11:38:55 +00:00
Andriy Gapon
31260bf042 vfs_donmount: in certain cases try r/o mount if r/w mount fails
If the operation is not an update, if neither r/w nor r/o mode is
explicitly requested, if the error code hints at the possibility of the
media being read-only, and if the fallback is allowed, then we can try
to automatically downgrade to the readonly mode.

This is especially useful for auto-mounting of removable media that
sometimes can happen to be write-protected.

The fallback to r/o is not enabled by default.  It can be requested on a
per-mount basis with a new mount option, 'autoro'.  Or it can be
globally allowed by setting vfs.default_autoro.

Reviewed by:	cem, kib
MFC after:	3 weeks
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D13361
2018-03-27 14:31:42 +00:00
Warner Losh
0b8c33590a Remove decade's old whine about msdos vs msdosfs.
Retain the compatibility silently though.

Reviewed by: cem@, kevans@, emaste@ (and many others in the past)
2018-03-09 21:32:07 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Edward Tomasz Napierala
1f3aded066 Fix "mount -uw /" when the filesystem type doesn't match.
This basically makes "mount -uw /" work when the filesystem
mounted on / is NFS, but the one configured in fstab(5) is UFS,
which can happen when you forget to modify fstab.

Note that the whole special case ("else if (argv[0][0] == '/'")
is probably not needed anyway.  I'll take a look at removing it
altogether; for now this is a minimally intrusive fix.

MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D11323
2017-07-08 11:06:27 +00:00
Stephen J. Kiernan
9a81ba0f24 Add MD_VERIFY option to enable O_VERIFY in open for vnode type.
Add -o [no]verify option to mdconfig (and document in man page.)
Implement GEOM attribute MNT::verified to ask md if the backing vnode is
  verified.
Check for MNT::verified in cd9660 mount to flag the mount as MNT_VERIFIED if
  the underlying device has been verified.

Reviewed by:	rwatson
Approved by:	sjg (mentor)
Obtained from:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D2902
2017-05-31 21:18:11 +00:00
Edward Tomasz Napierala
5b2d5e4fc2 Move mount.conf(8) to mount.conf(5); it's a kernel configuration file
and not an administrative utility.

MFC after:	2 weeks
2017-05-28 18:07:53 +00:00
Alan Somers
6e24000a72 sbin/mount: strcpy -> strlcpy
Reported by:	Coverity
CID:		1011173, 1011174
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
2017-04-07 15:39:41 +00:00
Enji Cooper
acc3e91350 Add a post-humous manpage for cd9660(5), the ISO-9660 file system
Describe (briefly) how to compile the filesystem into the kernel and
load as a module.

Reference cd9660(5) in mount(8) and mount_cd9660(8).

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-23 02:57:08 +00:00
Enji Cooper
53de181604 mount.conf(8): fix a .Xr call
Add the missing section number for devfs(5)

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-03-23 02:50:35 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00