Commit graph

86 commits

Author SHA1 Message Date
Warner Losh e21ebb4d2d auto_master.5: Fix my push
Forgot the commit --amend before the push to fix the date. My bad.
Fixes: fc8ac5fedf
2023-12-27 16:59:48 -07:00
concussious fc8ac5fedf auto_master.5: improve description, bump date
Add autofs automounter to description to improve visibility.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/824
2023-12-27 16:57:20 -07:00
Emmanuel Vadot 094abb6fb4 autofs: media: Always use sync option for fat*
Users of autofs for removable media expect to be able to copy files and
directly remove the media without having the need to call sync(8) or umount(8).
Only do that for fat/ntfs filesystems.

Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42494
Reviewed by:	rew (older version)
2023-12-04 07:51:33 +01:00
Warner Losh 4d65a7c695 usr.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:24:01 -07:00
Emmanuel Vadot 5a78fcfce4 autofs: Remove stale comment
devd action for automount -c was never commented.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42493
Reviewed by:	rew
2023-11-24 10:44:40 +01:00
Emmanuel Vadot 0b7c89c8c2 autofs: media: Don't include nosuid in the script
We already have nosuid option in auto_master so no need to redefine it.
Also it's easier for a user to modify the auto_master configuration file
than the script (which shouldn't be modified).

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D42492
Reviewed by:	rew
2023-11-24 10:44:20 +01:00
Konstantin Belousov 56c44bd92e automount(8): when flushing autofs, specify fsid
Which should avoid situation where flushed filesystem is not autofs,
because it was mounted over autofs mp.

Reported and tested by:	Andrew "RhodiumToad" Gierth <andrew@tao11.riddles.org.uk>
PR:	272446
Reviewed by:	mjg
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42023
2023-10-17 19:40:50 +03:00
Andrew Gierth 21b8e363c4 automount: check for mounted-over autofs instances on flush
PR:	272446
Reviewed by:	kib
MFC after:	1 week
Differential revision: https://reviews.freebsd.org/D40961
2023-10-17 19:40:45 +03:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -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 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
Emmanuel Vadot eb14f050a3 pkgbase: Put autofs config files in the FreeBSD-autofs package
Reviewed by:	emaste
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33434
2021-12-21 10:17:25 +01:00
Robert Wing 88e531f38c autofs: best effort to maintain mounttab and mountdtab
When an automounted filesystem is successfully unmounted, call
rpc.umntall(8) with the -k flag.

rpc.umntall(8) is used to clean up /var/db/mounttab on the client and
/var/db/mountdtab on the server. This is only useful for NFSv3.

PR:     251906
Reviewed by: trasz
Differential Revision:  https://reviews.freebsd.org/D27801
2021-03-12 06:41:55 -09:00
Robert Wing ce22a792de autounmountd: set filter-specific flags for the EVFILT_FS filter
Set the filter-specific flags VQ_MOUNT and VQ_UNMOUNT for the
EVFILT_FS filter.

The filter-specific flags for the EVFILT_FS filter are undocumented, but
their usage can be found by looking up vfs_event_signal().

Reviewed by:	trasz
Differential Revision:	https://reviews.freebsd.org/D28975
2021-03-02 14:18:40 -09:00
Robert Wing 63640b2f55 automount(8): fix absolute path when creating a mountpoint
When executing automount(8), it will attempt to create the directory where an
autofs filesystem is to be mounted. Explicity set the root path for this
directory to "/".

This fixes the issue where the directory being created was being treated as a
relative path instead of an absolute path (as expected).

PR:     224601
Reported by:    kusumi.tomohiro@gmail.com
Reviewed by:    trasz
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D27832
2021-02-17 01:02:56 -09:00
Edward Tomasz Napierala bce7ee9d41 Drop "All rights reserved" from all my stuff. This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by:	emaste, imp, gbe (manpages)
Differential Revision:	https://reviews.freebsd.org/D26980
2020-10-28 13:46:11 +00:00
Ryan Moeller 245bfd34da Deduplicate fsid comparisons
Comparing fsid_t objects requires internal knowledge of the fsid structure
and yet this is duplicated across a number of places in the code.

Simplify by creating a fsidcmp function (macro).

Reviewed by:	mjg, rmacklem
Approved by:	mav (mentor)
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D24749
2020-05-21 01:55:35 +00:00
Edward Tomasz Napierala 981e04778f Stop hardcoding WARNS in automount(8) et al.
MFC after:	2 weeks
Sponsored by:	DARPA
2020-04-01 15:08:13 +00:00
Justin Hibbits 3447ea90d7 autofs: Fix autounmountd's printing of mount time.
time_t should be printed as intmax_t.  Even though duration should be short, the
correct way to print is intmax_t, not long.

Reported by:	ian,imp
2019-08-09 02:20:26 +00:00
Justin Hibbits ca05fff090 Change autounmountd(8) to use time_t for duration instead of double
Summary:
autounmountd(8) uses doubles to handle mount time durations.  However,
it must convert to integer types, time_t in particular, to do anything
meaningful.  Additionally, even though it's a floating-point value in
seconds, the sub-seconds component is never used, so it's unnecessary.

Switching type to time_t fixes an assertion on powerpc64, which checks
that a sleep value that's not -1.0 is greater than 0.  On powerpc64, it
happens that the value of -1.0 gets loaded as a float (perhaps a bug in
gcc), but gets compared to a double.  This compares as false, so follows
through the 'sleep != -1.0' path, and fails the assert.  Since the
sub-second component isn't used in the double, just drop it and deal
with whole-integer seconds.

Reviewed by:	trasz
Differential Revision: https://reviews.freebsd.org/D21109
2019-08-08 03:16:32 +00:00
Edward Tomasz Napierala 1383afcb99 Fix segfault that could occur on "automount -LL".
MFC after:	2 weeks
Sponsored by:	DARPA, AFRL
2019-04-10 16:09:06 +00:00
Chris Rees 488ded9168 There is no way of escaping literal $ signs in auto_master(5), which
makes for difficulty with hidden Samba shares; shares with $ at the end
of their name.  This enables the use of ${DOLLAR} to work around this.

Reviewed by:		bcr (man page)
Approved by:		trasz
Differential Revision:	https://reviews.freebsd.org/D7048
2018-12-28 15:11:22 +00:00
Edward Tomasz Napierala bd9325a169 Add the "autoro" flag to /media. This makes it attempt to mount
it read-only instead of just failing if the media is write-protected.

The /net doesn't seem to require the flag.

MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	DARPA, AFRL
2018-08-14 13:52:08 +00:00
Brad Davis 0ab0a723ed Move autofs related configs to usr.sbin/autofs/
This is prep for pkgbase to have config files tagged as such.

Approved by:	will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16492
2018-08-04 22:41:17 +00:00
Edward Tomasz Napierala abdd394564 Add SPDX tags for automount(8) et al.
MFC after:	2 weeks
2018-01-24 16:39:02 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Benjamin Kaduk fe8b4983b4 Fix mdoc typo in auto_master.5
There needs to be a space after the no-space macro in order for it
to be interpreted.

PR:		221986
Submitted by:	Paul Townsend <pt@zendware.com>
2017-09-01 22:04:45 +00:00
Edward Tomasz Napierala d4acedbc64 Revert r317804; apparently I forgot the auto_master syntax.
MFC after:	2 weeks
2017-05-04 19:55:32 +00:00
Edward Tomasz Napierala 1638f1d3e4 Make automount(8) error out when the map name is missing.
MFC after:	2 weeks
2017-05-04 19:41:19 +00:00
Enji Cooper 64a0982bee usr.sbin: normalize paths using SRCTOP-relative paths or :H when possible
This simplifies make logic/output

MFC after:	1 month
Sponsored by:	Dell EMC Isilon
2017-03-04 11:38:03 +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
Edward Tomasz Napierala 8379360aeb Make autounmountd(8) not die when traced with "truss -p".
MFC after:	1 month
2016-11-02 08:12:37 +00:00
Edward Tomasz Napierala 275253770b Use proper argument order for calloc(3).
MFC after:	1 month
2016-09-14 11:20:58 +00:00
Baptiste Daroussin 7556d9b06a Remove usage of _WITH_GETLINE from usr.sbin 2016-07-30 01:10:05 +00:00
Edward Tomasz Napierala debc480e03 Add new unmount(2) flag, MNT_NONBUSY, to check whether there are
any open vnodes before proceeding. Make autounmound(8) use this flag.
Without it, even an unsuccessfull unmount causes filesystem flush,
which interferes with normal operation.

Reviewed by:	kib@
Approved by:	re (gjb@)
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D7047
2016-07-07 09:03:57 +00:00
Glen Barber d60840138f MFH
Sponsored by:	The FreeBSD Foundation
2016-04-04 23:55:32 +00:00
Edward Tomasz Napierala e19462c33b Use the log_errno value passed to the function instead of the errno global
variable.

Suggested by:	Daniel Braniss
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-03-15 11:03:45 +00:00
Glen Barber 52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Edward Tomasz Napierala 4b9f77e45e Autofs is section 5, not 4.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-29 17:14:04 +00:00
Bryan Drewery bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Glen Barber dd181aca6c Create a package for autofs(5)
Sponsored by:	The FreeBSD Foundation
2016-02-02 17:33:37 +00:00
Edward Tomasz Napierala 592d6e850a The <libutil.h> is an ordinary header file; should sort just like any other.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-01-24 18:11:36 +00:00
Bryan Drewery b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Edward Tomasz Napierala 286c4906d6 Add -noauto autofs map, for automatic handling of fstab entries
marked "noauto".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 12:44:46 +00:00
Edward Tomasz Napierala 52df29e6a5 Get executable direct maps to work.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 12:27:59 +00:00
Edward Tomasz Napierala cd3772d076 Rework the concat() algorithm to be correct in all cases.
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-13 11:26:02 +00:00
Edward Tomasz Napierala 8ee4f5ef45 Make "automount -LL -o whatever" present options in the same order
as used by automountd(8).

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-12 12:36:08 +00:00