diff options
author | Karel Zak | 2006-12-07 00:26:05 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:05 +0100 |
commit | 95f1bdeee42cd7b9ac49d64b27bcec49557a991e (patch) | |
tree | 5813d335771188c724c3d1bc9f9f9feb23c1d9ca /mount | |
parent | Imported from util-linux-2.11w tarball. (diff) | |
download | kernel-qcow2-util-linux-95f1bdeee42cd7b9ac49d64b27bcec49557a991e.tar.gz kernel-qcow2-util-linux-95f1bdeee42cd7b9ac49d64b27bcec49557a991e.tar.xz kernel-qcow2-util-linux-95f1bdeee42cd7b9ac49d64b27bcec49557a991e.zip |
Imported from util-linux-2.11x tarball.
Diffstat (limited to 'mount')
-rw-r--r-- | mount/fstab.5 | 6 | ||||
-rw-r--r-- | mount/lomount.c | 5 | ||||
-rw-r--r-- | mount/mount.8 | 94 | ||||
-rw-r--r-- | mount/mount.c | 28 | ||||
-rw-r--r-- | mount/mount_by_label.c | 15 | ||||
-rw-r--r-- | mount/mount_constants.h | 8 | ||||
-rw-r--r-- | mount/sundries.c | 77 | ||||
-rw-r--r-- | mount/sundries.h | 1 | ||||
-rw-r--r-- | mount/swapon.8 | 16 | ||||
-rw-r--r-- | mount/swapon.c | 21 | ||||
-rw-r--r-- | mount/umount.8 | 11 | ||||
-rw-r--r-- | mount/umount.c | 18 |
12 files changed, 253 insertions, 47 deletions
diff --git a/mount/fstab.5 b/mount/fstab.5 index fa3d2b782..07aa32ca0 100644 --- a/mount/fstab.5 +++ b/mount/fstab.5 @@ -38,6 +38,7 @@ .\" Wed Jul 26 00:00:00 1995: Updated some nfs stuff, joey@infodrom.north.de .\" Tue Apr 2 00:38:28 1996: added info about "noauto", "user", etc. .\" Tue Jun 15 20:02:18 1999: added LABEL and UUID +.\" Sat Jul 14 2001: Michael K. Johnson <johnsonm@redhat.com> added -O .\" .TH FSTAB 5 "15 June 1999" "Linux 2.2" "Linux Programmer's Manual" .SH NAME @@ -156,7 +157,10 @@ For documentation on all nfs-specific options have a look at Common for all types of file system are the options ``noauto'' (do not mount when "mount -a" is given, e.g., at boot time), ``user'' (allow a user to mount), and ``owner'' -(allow device owner to mount). For more details, see +(allow device owner to mount), and ``_netdev'' (device requires network +to be available). +The ``owner'' and ``_netdev'' options are Linux-specific. +For more details, see .BR mount (8). The fifth field, diff --git a/mount/lomount.c b/mount/lomount.c index 70a8ff0ab..97cd9a092 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -24,6 +24,7 @@ #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/mman.h> +#include <sys/sysmacros.h> #include "loop.h" #include "lomount.h" @@ -121,7 +122,7 @@ is_loop_device (const char *device) { #endif return (loopmajor && stat(device, &statbuf) == 0 && S_ISBLK(statbuf.st_mode) && - (statbuf.st_rdev>>8) == loopmajor); + major(statbuf.st_rdev) == loopmajor); } #define SIZE(a) (sizeof(a)/sizeof(a[0])) @@ -174,7 +175,7 @@ find_unused_loop_device (void) { if (!somedev) error(_("mount: could not find any device /dev/loop#")); - else if(!someloop) { + else if (!someloop) { if (loop_known == 1) error(_( "mount: Could not find any loop device.\n" diff --git a/mount/mount.8 b/mount/mount.8 index 763e8fca7..ed2b41f8d 100644 --- a/mount/mount.8 +++ b/mount/mount.8 @@ -35,6 +35,7 @@ .\" 990111, aeb: documented /sbin/mount.smbfs .\" 990730, Yann Droneaud <lch@multimania.com>: updated page .\" 991214, Elrond <Elrond@Wunder-Nett.org>: added some docs on devpts +.\" 010714, Michael K. Johnson <johnsonm@redhat.com> added -O .\" 010725, Nikita Danilov <NikitaDanilov@Yahoo.COM>: reiserfs options .\" 011124, Karl Eichwalder <ke@gnu.franken.de>: tmpfs options .\" @@ -44,7 +45,7 @@ mount \- mount a file system .SH SYNOPSIS .BI "mount [\-lhV]" .LP -.BI "mount \-a [\-fFnrsvw] [\-t " vfstype ] +.BI "mount \-a [\-fFnrsvw] [\-t " vfstype "] [\-O " optlist ] .br .BI "mount [\-fnrsvw] [\-o " options " [,...]] " "device " | " dir" .br @@ -109,6 +110,15 @@ file hierarchy somewhere else. The call is .RE After this call the same contents is accessible in two places. +This call attaches only (part of) a single filesystem, not possible +submounts. The entire file hierarchy including submounts is attached +a second place using +.RS +.br +.B "mount --rbind olddir newdir" +.RE +.\" available since Linux 2.4.11. + Since Linux 2.5.1 it is possible to atomically move a subtree to another place. The call is .RS @@ -147,12 +157,12 @@ mounted where, using which options. This file is used in three ways: (i) The command .RS .br -.BI "mount \-a [-t" " type" ] +.BI "mount \-a [\-t " type "] [\-O " optlist ] .RE (usually given in a bootscript) causes all file systems mentioned in .I fstab -(of the proper type) to be mounted as indicated, except for those -whose line contains the +(of the proper type and/or having or not having the proper options) +to be mounted as indicated, except for those whose line contains the .B noauto keyword. Adding the .B \-F @@ -470,6 +480,44 @@ and .IR ext . .RE .TP +.B \-O +Used in conjunction with +.BR \-a , +to limit the set of filesystems to which the +.B \-a +is applied. Like +.B \-t +in this regard except that it is useless except in the context of +.BR \-a . +For example, the command: +.RS +.RS +.B "mount \-a \-O no_netdev" +.RE +mounts all file systems except those which have the option +.I _netdev +specified in the options field in the +.I /etc/fstab +file. + +It is different from +.B \-t +in that each option is matched exactly; a leading +.B no +at the beginning of one option does not negate the rest. + +The +.B \-t +and +.B \-O +options are cumulative in effect; that is, the command +.RS +.B "mount \-a \-t ext2 \-O _netdev" +.RE +mounts all ext2 filesystems with the _netdev option, not all filesystems +that are either ext2 or have the _netdev option specified. +.RE +.TP .B \-o Options are specified with a .B \-o @@ -503,6 +551,11 @@ Interpret character or block special devices on the file system. .B exec Permit execution of binaries. .TP +.B _netdev +The filesystem resides on a device that requires network access +(used to prevent the system from attempting to mount these filesystems +until the network has been enabled on the system). +.TP .B noatime Do not update inode access times on this file system (e.g, for faster access on the news spool to speed up news servers). @@ -1457,15 +1510,30 @@ by the console. It can be be enabled for the filesystem with this option. If `uni_xlate' gets set, UTF8 gets disabled. .TP .B shortname=[lower|win95|winnt|mixed] -Option (available since 2.4.13) that sets how short filenames are to be -created and displayed. -.nf - lower = display lower, create win95 filenames - win95 = display win95, create win95 filenames - winnt = display winnt, create winnt filenames - mixed = display winnt, create win95 filenames -.fi -Default is "lower". + +Defines the behaviour for creation and display of filenames which fit into +8.3 characters. If a long name for a file exists, it will always be +preferred display. There are four modes: +.RS +.TP +.I lower +Force the short name to lower case upon display; store a long name when +the short name is not all upper case. +.TP +.I win95 +Force the short name to upper case upon display; store a long name when +the short name is not all upper case. +. TP +.I winnt +Display the shortname as is; store a long name when the short name is +not all lower case or all upper case. +.TP +.I mixed +Display the short name as is; store a long name when the short name is not +all upper case. +.RE + +The default is "lower". .SH "Mount options for xenix" None. diff --git a/mount/mount.c b/mount/mount.c index 1f9fc6e62..1da75d93b 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -37,6 +37,8 @@ * 2000-05-11 Mark A. Peloquin <peloquin@us.ibm.com> * - check_special_mountprog now returns correct status * 2000-11-08 aeb: accept nonnumeric uid=, gid= options + * 2001-07-13 Michael K. Johnson <johnsonm@redhat.com> + * - implemented -a -O */ #include <unistd.h> @@ -122,10 +124,11 @@ struct opt_map { #define MS_USERS 0x40000000 #define MS_USER 0x20000000 #define MS_OWNER 0x10000000 +#define MS_NETDEV 0x00020000 #define MS_LOOP 0x00010000 /* Options that we keep the mount system call from seeing. */ -#define MS_NOSYS (MS_NOAUTO|MS_USERS|MS_USER|MS_LOOP) +#define MS_NOSYS (MS_NOAUTO|MS_USERS|MS_USER|MS_NETDEV|MS_LOOP) /* Options that we keep from appearing in the options field in the mtab. */ #define MS_NOMTAB (MS_REMOUNT|MS_NOAUTO|MS_USERS|MS_USER) @@ -159,6 +162,7 @@ static const struct opt_map opt_map[] = { { "nouser", 0, 1, MS_USER }, /* Forbid ordinary user to mount */ { "owner", 0, 0, MS_OWNER }, /* Let the owner of the device mount */ { "noowner", 0, 1, MS_OWNER }, /* Device owner has no special privs */ + { "_netdev", 0, 0, MS_NETDEV }, /* Device accessible only via network */ /* add new options here */ #ifdef MS_NOSUB { "sub", 0, 1, MS_NOSUB }, /* allow submounts */ @@ -1209,7 +1213,7 @@ has_noauto (char *opts) { #define DISKMAJOR(m) (((int) m) & ~0xf) static int -do_mount_all (char *types, char *options) { +do_mount_all (char *types, char *options, char *test_opts) { struct mntentchn *mc, *mc0, *mtmp; int status = 0; struct stat statbuf; @@ -1232,6 +1236,7 @@ do_mount_all (char *types, char *options) { if (has_noauto (mc->m.mnt_opts)) continue; if (matching_type (mc->m.mnt_type, types) + && matching_opts (mc->m.mnt_opts, test_opts) && !streq (mc->m.mnt_dir, "/") && !streq (mc->m.mnt_dir, "root")) { @@ -1350,6 +1355,7 @@ static struct option longopts[] = { { "read-write", 0, 0, 'w' }, { "rw", 0, 0, 'w' }, { "options", 1, 0, 'o' }, + { "test-opts", 1, 0, 'O' }, { "types", 1, 0, 't' }, { "bind", 0, 0, 128 }, { "replace", 0, 0, 129 }, @@ -1358,6 +1364,7 @@ static struct option longopts[] = { { "over", 0, 0, 132 }, { "move", 0, 0, 133 }, { "guess-fstype", 1, 0, 134 }, + { "rbind", 0, 0, 135 }, { NULL, 0, 0, 0 } }; @@ -1373,7 +1380,7 @@ usage (FILE *fp, int n) { "So far the informational part. Next the mounting.\n" "The command is `mount [-t fstype] something somewhere'.\n" "Details found in /etc/fstab may be omitted.\n" - " mount -a : mount all stuff from /etc/fstab\n" + " mount -a [-t|-O] ... : mount all stuff from /etc/fstab\n" " mount device : mount device at the known place\n" " mount directory : mount known device here\n" " mount -t type dev dir : ordinary mount command\n" @@ -1399,7 +1406,7 @@ usage (FILE *fp, int n) { int main (int argc, char *argv[]) { int c, result = 0, specseen; - char *options = NULL, *spec, *node; + char *options = NULL, *test_opts = NULL, *spec, *node; char *volumelabel = NULL; char *uuid = NULL; char *types = NULL; @@ -1424,7 +1431,7 @@ main (int argc, char *argv[]) { initproctitle(argc, argv); #endif - while ((c = getopt_long (argc, argv, "afFhlL:no:rsU:vVwt:", + while ((c = getopt_long (argc, argv, "afFhlL:no:O:rsU:vVwt:", longopts, NULL)) != -1) { switch (c) { case 'a': /* mount everything in fstab */ @@ -1454,6 +1461,12 @@ main (int argc, char *argv[]) { else options = xstrdup(optarg); break; + case 'O': /* with -t: mount only if (not) opt */ + if (test_opts) + test_opts = xstrconcat3(test_opts, ",", optarg); + else + test_opts = xstrdup(optarg); + break; case 'r': /* mount readonly */ readonly = 1; readwrite = 0; @@ -1509,6 +1522,9 @@ main (int argc, char *argv[]) { printf("%s\n", fstype ? fstype : "unknown"); exit(fstype ? 0 : EX_FAIL); } + case 135: + mounttype = (MS_BIND | MS_REC); + break; case '?': default: usage (stderr, EX_USAGE); @@ -1563,7 +1579,7 @@ main (int argc, char *argv[]) { switch (argc+specseen) { case 0: /* mount -a */ - result = do_mount_all (types, options); + result = do_mount_all (types, options, test_opts); if (result == 0 && verbose) error(_("nothing was mounted")); break; diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c index da5c5a79a..10c916672 100644 --- a/mount/mount_by_label.c +++ b/mount/mount_by_label.c @@ -243,7 +243,7 @@ uuidcache_init(void) { int firstPass; int handleOnFirst; #if 0 - char *iobuf = 0; + char iobuf[32*1024]; /* For setvbuf */ #endif if (uuidCache) @@ -272,12 +272,8 @@ uuidcache_init(void) { to keep statistics in /proc/partitions. Of course, statistics belong in some /proc/diskstats, not in some /proc file that happened to exist already. */ - { -#define CBBUF (16 * 1024) - iobuf = (char *) malloc(CBBUF); - if (iobuf) - setvbuf(procpt, iobuf, _IOFBF, CBBUF); - } + + setvbuf(procpt, iobuf, _IOFBF, sizeof(iobuf)); #endif for (firstPass = 1; firstPass >= 0; firstPass--) { @@ -321,10 +317,7 @@ uuidcache_init(void) { } fclose(procpt); -#if 0 - if (iobuf) - free(iobuf); -#endif + uuidcache_init_lvm(); } diff --git a/mount/mount_constants.h b/mount/mount_constants.h index 1eab36e03..61e89697f 100644 --- a/mount/mount_constants.h +++ b/mount/mount_constants.h @@ -51,8 +51,14 @@ if we have a stack or plain mount - mount atop of it, forming a stack. */ #ifndef MS_MOVE #define MS_MOVE 0x2000 /* 8192: Atomically move tree */ #endif +#ifndef MS_REC +#define MS_REC 0x4000 /* 16384: Recursive loopback */ +#endif +#ifndef MS_VERBOSE +#define MS_VERBOSE 0x8000 /* 32768 */ +#endif /* - * Magic mount flag number. Has to be or-ed to the flag values. + * Magic mount flag number. Had to be or-ed to the flag values. */ #ifndef MS_MGC_VAL #define MS_MGC_VAL 0xC0ED0000 /* magic flag number to indicate "new" flags */ diff --git a/mount/sundries.c b/mount/sundries.c index 621282cf5..e331f5d8f 100644 --- a/mount/sundries.c +++ b/mount/sundries.c @@ -185,6 +185,83 @@ matching_type (const char *type, const char *types) { return no; } +/* Returns 1 if needle found or noneedle not found in haystack + * Otherwise returns 0 + */ +static int +check_option(const char *haystack, const char *needle) { + const char *p, *r; + int len, needle_len, this_len; + int no; + + no = 0; + if (!strncmp(needle, "no", 2)) { + no = 1; + needle += 2; + } + needle_len = strlen(needle); + len = strlen(haystack); + + for (p = haystack; p < haystack+len; p++) { + r = strchr(p, ','); + if (r) { + this_len = r-p; + } else { + this_len = strlen(p); + } + if (this_len != needle_len) { + p += this_len; + continue; + } + if (strncmp(p, needle, this_len) == 0) + return !no; /* foo or nofoo was found */ + p += this_len; + } + + return no; /* foo or nofoo was not found */ +} + + +/* Returns 1 if each of the test_opts options agrees with the entire + * list of options. + * Returns 0 if any noopt is found in test_opts and opt is found in options. + * Returns 0 if any opt is found in test_opts but is not found in options. + * Unlike fs type matching, nonetdev,user and nonetdev,nouser have + * DIFFERENT meanings; each option is matched explicitly as specified. + */ +int +matching_opts (const char *options, const char *test_opts) { + const char *p, *r; + char *q; + int len, this_len; + + if (test_opts == NULL) + return 1; + + len = strlen(test_opts); + q = alloca(len+1); + if (q == NULL) + die (EX_SYSERR, _("not enough memory")); + + for (p = test_opts; p < test_opts+len; p++) { + r = strchr(p, ','); + if (r) { + this_len = r-p; + } else { + this_len = strlen(p); + } + if (!this_len) continue; /* if two ',' appear in a row */ + strncpy(q, p, this_len); + q[this_len] = '\0'; + if (!check_option(options, q)) + return 0; /* any match failure means failure */ + p += this_len; + } + + /* no match failures in list means success */ + return 1; +} + /* Make a canonical pathname from PATH. Returns a freshly malloced string. It is up the *caller* to ensure that the PATH is sensible. i.e. canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.'' diff --git a/mount/sundries.h b/mount/sundries.h index 788bef645..af0df4e27 100644 --- a/mount/sundries.h +++ b/mount/sundries.h @@ -24,6 +24,7 @@ void block_signals (int how); char *canonicalize (const char *path); void error (const char *fmt, ...); int matching_type (const char *type, const char *types); +int matching_opts (const char *options, const char *test_opts); void *xmalloc (size_t size); char *xstrdup (const char *s); char *xstrndup (const char *s, int n); diff --git a/mount/swapon.8 b/mount/swapon.8 index 4e03cf383..6dca7eb3d 100644 --- a/mount/swapon.8 +++ b/mount/swapon.8 @@ -44,7 +44,7 @@ swapon, swapoff \- enable/disable devices and files for paging and swapping .SH SYNOPSIS .B /sbin/swapon [\-h \-V] .br -.B /sbin/swapon \-a [\-v] +.B /sbin/swapon \-a [\-v] [\-e] .br .BI "/sbin/swapon [\-v] [\-p " "priority" "] " " specialfile " ... .br @@ -78,9 +78,19 @@ Display swap usage summary by device. Equivalent to "cat /proc/swaps". Not available before Linux 2.1.25. .TP .B \-a -All devices marked as ``sw'' swap devices in +All devices marked as ``swap'' swap devices in .I /etc/fstab -are made available. +are made available. Devices that are already running as swap are silently +skipped. +.TP +.B \-e +When +.B \-a +is used with swapon, +.B +\-e +makes swapon silently skip devices that +do not exist. .TP .BI \-p " priority" Specify priority for diff --git a/mount/swapon.c b/mount/swapon.c index c2ae20a9e..443ae3c57 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -8,8 +8,12 @@ * - added Native Language Support * 1999-03-21 Arnaldo Carvalho de Melo <acme@conectiva.com.br> * - fixed strerr(errno) in gettext calls + * 2001-03-22 Erik Troan <ewt@redhat.com> + * - added -e option for -a + * - -a shouldn't try to add swaps that are already enabled */ +#include <ctype.h> #include <stdlib.h> #include <stdio.h> #include <getopt.h> @@ -34,12 +38,16 @@ int all = 0; int verbose = 0; int priority = -1; /* non-prioritized swap by default */ +/* If true, don't complain if the device/file doesn't exist */ +int ifexists = 0; + extern char version[]; static char *program_name; static struct option longswaponopts[] = { /* swapon only */ { "priority", required_argument, 0, 'p' }, + { "ifexists", 0, 0, 'e' }, { "summary", 0, 0, 's' }, /* also for swapoff */ { "all", 0, 0, 'a' }, @@ -54,7 +62,7 @@ static struct option *longswapoffopts = &longswaponopts[2]; static void swapon_usage(FILE *fp, int n) { fprintf(fp, _("usage: %s [-hV]\n" - " %s -a [-v]\n" + " %s -a [-e] [-v]\n" " %s [-v] [-p priority] special ...\n" " %s [-s]\n"), program_name, program_name, program_name, program_name); @@ -256,7 +264,7 @@ main_swapon(int argc, char *argv[]) { int status = 0; int c; - while ((c = getopt_long(argc, argv, "ahp:svV", + while ((c = getopt_long(argc, argv, "ahep:svV", longswaponopts, NULL)) != -1) { switch (c) { case 'a': /* all */ @@ -268,6 +276,9 @@ main_swapon(int argc, char *argv[]) { case 'p': /* priority */ priority = atoi(optarg); break; + case 'e': /* ifexists */ + ifexists = 1; + break; case 's': /* status report */ status = display_summary(); exit(status); @@ -289,6 +300,9 @@ main_swapon(int argc, char *argv[]) { if (!all && *argv == NULL) swapon_usage(stderr, 2); + if (ifexists && (!all || strcmp(program_name, "swapon"))) + swapon_usage(stderr, 1); + if (all) { read_proc_swaps(); @@ -303,7 +317,8 @@ main_swapon(int argc, char *argv[]) { char *special = fstab->mnt_fsname; if (streq(fstab->mnt_type, MNTTYPE_SWAP) && - !is_in_proc_swaps(special)) { + !is_in_proc_swaps(special) + && (!ifexists || !access(special, R_OK))) { /* parse mount options; */ char *opt, *opts = strdup(fstab->mnt_opts); diff --git a/mount/umount.8 b/mount/umount.8 index ecc1fa64b..3449779e2 100644 --- a/mount/umount.8 +++ b/mount/umount.8 @@ -29,7 +29,7 @@ umount \- unmount file systems .SH SYNOPSIS .BI "umount [\-hV]" .LP -.BI "umount -a [\-dflnrv] [\-t " vfstype ] +.BI "umount -a [\-dflnrv] [\-t " vfstype "] [\-O " options ] .br .BI "umount [\-dflnrv] " "dir " | " device " [...] .SH DESCRIPTION @@ -90,6 +90,15 @@ list. The list of file system types can be prefixed with .B no to specify the file system types on which no action should be taken. .TP +.BI \-O " options" +Indicate that the actions should only be taken on file systems with +the specified options in +.IR /etc/fstab . +More than one option type may be specified in a comma separated +list. Each option can be prefixed with +.B no +to specify options for which no action should be taken. +.TP .B \-f Force unmount (in case of an unreachable NFS system). (Requires kernel 2.1.116 or later.) diff --git a/mount/umount.c b/mount/umount.c index 39c8385ed..29feff4fa 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -23,6 +23,7 @@ * in mtab, try them all, with last one tried first * - Differentiate "user" and "users" key words in fstab * 001202: aeb - remove at most one line from /etc/mtab + * 010716: Michael K. Johnson <johnsonm@redhat.com: -a -O * 010914: Jamie Strandboge - use tcp if that was used for mount * 011005: hch - add lazy umount support * 020105: aeb - permission test owner umount @@ -416,7 +417,7 @@ umount_one_bw (const char *file, struct mntentchn *mc) { in any case it's important to umount mtab entries in reverse order to mount, e.g. /usr/spool before /usr. */ static int -umount_all (char *types) { +umount_all (char *types, char *test_opts) { struct mntentchn *mc, *hd; int errors = 0; @@ -424,7 +425,8 @@ umount_all (char *types) { if (!hd->prev) die (2, _("umount: cannot find list of filesystems to unmount")); for (mc = hd->prev; mc != hd; mc = mc->prev) { - if (matching_type (mc->m.mnt_type, types)) { + if (matching_type (mc->m.mnt_type, types) + && matching_opts (mc->m.mnt_opts, test_opts)) { errors |= umount_one (mc->m.mnt_fsname, mc->m.mnt_dir, mc->m.mnt_type, mc->m.mnt_opts, mc); } @@ -441,6 +443,7 @@ static struct option longopts[] = { "force", 0, 0, 'f' }, { "help", 0, 0, 'h' }, { "no-mtab", 0, 0, 'n' }, + { "test-opts", 1, 0, 'O' }, { "verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { "read-only", 0, 0, 'r' }, @@ -452,7 +455,7 @@ static void usage (FILE *fp, int n) { fprintf (fp, _("Usage: umount [-hV]\n" - " umount -a [-f] [-r] [-n] [-v] [-t vfstypes]\n" + " umount -a [-f] [-r] [-n] [-v] [-t vfstypes] [-O opts]\n" " umount [-f] [-r] [-n] [-v] special | node...\n")); exit (n); } @@ -606,7 +609,7 @@ int main (int argc, char *argv[]) { int c; int all = 0; - char *types = NULL; + char *types = NULL, *test_opts = NULL; int result = 0; sanitize_env(); @@ -616,7 +619,7 @@ main (int argc, char *argv[]) { umask(033); - while ((c = getopt_long (argc, argv, "adfhlnrt:vV", + while ((c = getopt_long (argc, argv, "adfhlnrt:O:vV", longopts, NULL)) != -1) switch (c) { case 'a': /* umount everything */ @@ -638,6 +641,9 @@ main (int argc, char *argv[]) { case 'n': /* do not write in /etc/mtab */ ++nomtab; break; + case 'O': /* specify file system options */ + test_opts = optarg; + break; case 'r': /* remount read-only if umount fails */ ++remount; break; @@ -669,7 +675,7 @@ main (int argc, char *argv[]) { if (all) { if (types == NULL) types = "noproc,nodevfs"; - result = umount_all (types); + result = umount_all (types, test_opts); } else if (argc < 1) { usage (stderr, 2); } else while (argc--) { |