mount.c revision 117031
1/*-
2 * Copyright (c) 1980, 1989, 1993, 1994
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35static const char copyright[] =
36"@(#) Copyright (c) 1980, 1989, 1993, 1994\n\
37	The Regents of the University of California.  All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)mount.c	8.25 (Berkeley) 5/8/95";
43#endif
44static const char rcsid[] =
45  "$FreeBSD: head/sbin/mount/mount.c 117031 2003-06-29 17:53:48Z gordon $";
46#endif /* not lint */
47
48#include <sys/param.h>
49#include <sys/mount.h>
50#include <sys/stat.h>
51#include <sys/wait.h>
52
53#include <ctype.h>
54#include <err.h>
55#include <errno.h>
56#include <fstab.h>
57#include <paths.h>
58#include <pwd.h>
59#include <signal.h>
60#include <stdio.h>
61#include <stdlib.h>
62#include <string.h>
63#include <unistd.h>
64
65#include "extern.h"
66#include "mntopts.h"
67#include "pathnames.h"
68
69/* `meta' options */
70#define MOUNT_META_OPTION_FSTAB		"fstab"
71#define MOUNT_META_OPTION_CURRENT	"current"
72
73int debug, fstab_style, verbose;
74
75char   *catopt(char *, const char *);
76struct statfs *getmntpt(const char *);
77int	hasopt(const char *, const char *);
78int	ismounted(struct fstab *, struct statfs *, int);
79int	isremountable(const char *);
80void	mangle(char *, int *, const char **);
81char   *update_options(char *, char *, int);
82int	mountfs(const char *, const char *, const char *,
83			int, const char *, const char *);
84void	remopt(char *, const char *);
85void	prmount(struct statfs *);
86void	putfsent(const struct statfs *);
87void	usage(void);
88char   *flags2opts(int);
89
90/* Map from mount options to printable formats. */
91static struct opt {
92	int o_opt;
93	const char *o_name;
94} optnames[] = {
95	{ MNT_ASYNC,		"asynchronous" },
96	{ MNT_EXPORTED,		"NFS exported" },
97	{ MNT_LOCAL,		"local" },
98	{ MNT_NOATIME,		"noatime" },
99	{ MNT_NODEV,		"nodev" },
100	{ MNT_NOEXEC,		"noexec" },
101	{ MNT_NOSUID,		"nosuid" },
102	{ MNT_NOSYMFOLLOW,	"nosymfollow" },
103	{ MNT_QUOTA,		"with quotas" },
104	{ MNT_RDONLY,		"read-only" },
105	{ MNT_SYNCHRONOUS,	"synchronous" },
106	{ MNT_UNION,		"union" },
107	{ MNT_NOCLUSTERR,	"noclusterr" },
108	{ MNT_NOCLUSTERW,	"noclusterw" },
109	{ MNT_SUIDDIR,		"suiddir" },
110	{ MNT_SOFTDEP,		"soft-updates" },
111	{ MNT_MULTILABEL,	"multilabel" },
112	{ MNT_ACLS,		"acls" },
113	{ 0, NULL }
114};
115
116/*
117 * List of VFS types that can be remounted without becoming mounted on top
118 * of each other.
119 * XXX Is this list correct?
120 */
121static const char *
122remountable_fs_names[] = {
123	"ufs", "ffs", "ext2fs",
124	0
125};
126
127int
128main(argc, argv)
129	int argc;
130	char * const argv[];
131{
132	const char *mntfromname, **vfslist, *vfstype;
133	struct fstab *fs;
134	struct statfs *mntbuf;
135	FILE *mountdfp;
136	pid_t pid;
137	int all, ch, i, init_flags, mntsize, rval, have_fstab;
138	char *cp, *ep, *options;
139
140	all = init_flags = 0;
141	options = NULL;
142	vfslist = NULL;
143	vfstype = "ufs";
144	while ((ch = getopt(argc, argv, "adF:fo:prwt:uv")) != -1)
145		switch (ch) {
146		case 'a':
147			all = 1;
148			break;
149		case 'd':
150			debug = 1;
151			break;
152		case 'F':
153			setfstab(optarg);
154			break;
155		case 'f':
156			init_flags |= MNT_FORCE;
157			break;
158		case 'o':
159			if (*optarg)
160				options = catopt(options, optarg);
161			break;
162		case 'p':
163			fstab_style = 1;
164			verbose = 1;
165			break;
166		case 'r':
167			options = catopt(options, "ro");
168			break;
169		case 't':
170			if (vfslist != NULL)
171				errx(1, "only one -t option may be specified");
172			vfslist = makevfslist(optarg);
173			vfstype = optarg;
174			break;
175		case 'u':
176			init_flags |= MNT_UPDATE;
177			break;
178		case 'v':
179			verbose = 1;
180			break;
181		case 'w':
182			options = catopt(options, "noro");
183			break;
184		case '?':
185		default:
186			usage();
187			/* NOTREACHED */
188		}
189	argc -= optind;
190	argv += optind;
191
192#define	BADTYPE(type)							\
193	(strcmp(type, FSTAB_RO) &&					\
194	    strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ))
195
196	rval = 0;
197	switch (argc) {
198	case 0:
199		if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
200			err(1, "getmntinfo");
201		if (all) {
202			while ((fs = getfsent()) != NULL) {
203				if (BADTYPE(fs->fs_type))
204					continue;
205				if (checkvfsname(fs->fs_vfstype, vfslist))
206					continue;
207				if (hasopt(fs->fs_mntops, "noauto"))
208					continue;
209				if (!(init_flags & MNT_UPDATE) &&
210				    ismounted(fs, mntbuf, mntsize))
211					continue;
212				if (mountfs(fs->fs_vfstype, fs->fs_spec,
213				    fs->fs_file, init_flags, options,
214				    fs->fs_mntops))
215					rval = 1;
216			}
217		} else if (fstab_style) {
218			for (i = 0; i < mntsize; i++) {
219				if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
220					continue;
221				putfsent(&mntbuf[i]);
222			}
223		} else {
224			for (i = 0; i < mntsize; i++) {
225				if (checkvfsname(mntbuf[i].f_fstypename,
226				    vfslist))
227					continue;
228				prmount(&mntbuf[i]);
229			}
230		}
231		exit(rval);
232	case 1:
233		if (vfslist != NULL)
234			usage();
235
236		if (init_flags & MNT_UPDATE) {
237			mntfromname = NULL;
238			have_fstab = 0;
239			if ((mntbuf = getmntpt(*argv)) == NULL)
240				errx(1, "not currently mounted %s", *argv);
241			/*
242			 * Only get the mntflags from fstab if both mntpoint
243			 * and mntspec are identical. Also handle the special
244			 * case where just '/' is mounted and 'spec' is not
245			 * identical with the one from fstab ('/dev' is missing
246			 * in the spec-string at boot-time).
247			 */
248			if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL) {
249				if (strcmp(fs->fs_spec,
250				    mntbuf->f_mntfromname) == 0 &&
251				    strcmp(fs->fs_file,
252				    mntbuf->f_mntonname) == 0) {
253					have_fstab = 1;
254					mntfromname = mntbuf->f_mntfromname;
255				} else if (argv[0][0] == '/' &&
256				    argv[0][1] == '\0') {
257					fs = getfsfile("/");
258					have_fstab = 1;
259					mntfromname = fs->fs_spec;
260				}
261			}
262			if (have_fstab) {
263				options = update_options(options, fs->fs_mntops,
264				    mntbuf->f_flags);
265			} else {
266				mntfromname = mntbuf->f_mntfromname;
267				options = update_options(options, NULL,
268				    mntbuf->f_flags);
269			}
270			rval = mountfs(mntbuf->f_fstypename, mntfromname,
271			    mntbuf->f_mntonname, init_flags, options, 0);
272			break;
273		}
274		rmslashes(*argv, *argv);
275		if ((fs = getfsfile(*argv)) == NULL &&
276		    (fs = getfsspec(*argv)) == NULL)
277			errx(1, "%s: unknown special file or file system",
278			    *argv);
279		if (BADTYPE(fs->fs_type))
280			errx(1, "%s has unknown file system type",
281			    *argv);
282		rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file,
283		    init_flags, options, fs->fs_mntops);
284		break;
285	case 2:
286		/*
287		 * If -t flag has not been specified, the path cannot be
288		 * found, spec contains either a ':' or a '@', then assume
289		 * that an NFS file system is being specified ala Sun.
290		 * Check if the hostname contains only allowed characters
291		 * to reduce false positives.  IPv6 addresses containing
292		 * ':' will be correctly parsed only if the separator is '@'.
293		 * The definition of a valid hostname is taken from RFC 1034.
294		 */
295		if (vfslist == NULL && ((ep = strchr(argv[0], '@')) != NULL) ||
296		    ((ep = strchr(argv[0], ':')) != NULL)) {
297			if (*ep == '@') {
298				cp = ep + 1;
299				ep = cp + strlen(cp);
300			} else
301				cp = argv[0];
302			while (cp != ep) {
303				if (!isdigit(*cp) && !isalpha(*cp) &&
304				    *cp != '.' && *cp != '-' && *cp != ':')
305					break;
306				cp++;
307			}
308			if (cp == ep)
309				vfstype = "nfs";
310		}
311		rval = mountfs(vfstype,
312		    argv[0], argv[1], init_flags, options, NULL);
313		break;
314	default:
315		usage();
316		/* NOTREACHED */
317	}
318
319	/*
320	 * If the mount was successfully, and done by root, tell mountd the
321	 * good news.  Pid checks are probably unnecessary, but don't hurt.
322	 */
323	if (rval == 0 && getuid() == 0 &&
324	    (mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) {
325		if (fscanf(mountdfp, "%d", &pid) == 1 &&
326		     pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH)
327			err(1, "signal mountd");
328		(void)fclose(mountdfp);
329	}
330
331	exit(rval);
332}
333
334int
335ismounted(fs, mntbuf, mntsize)
336	struct fstab *fs;
337	struct statfs *mntbuf;
338	int mntsize;
339{
340	int i;
341
342	if (fs->fs_file[0] == '/' && fs->fs_file[1] == '\0')
343		/* the root file system can always be remounted */
344		return (0);
345
346	for (i = mntsize - 1; i >= 0; --i)
347		if (strcmp(fs->fs_file, mntbuf[i].f_mntonname) == 0 &&
348		    (!isremountable(fs->fs_vfstype) ||
349		     strcmp(fs->fs_spec, mntbuf[i].f_mntfromname) == 0))
350			return (1);
351	return (0);
352}
353
354int
355isremountable(vfsname)
356	const char *vfsname;
357{
358	const char **cp;
359
360	for (cp = remountable_fs_names; *cp; cp++)
361		if (strcmp(*cp, vfsname) == 0)
362			return (1);
363	return (0);
364}
365
366int
367hasopt(mntopts, option)
368	const char *mntopts, *option;
369{
370	int negative, found;
371	char *opt, *optbuf;
372
373	if (option[0] == 'n' && option[1] == 'o') {
374		negative = 1;
375		option += 2;
376	} else
377		negative = 0;
378	optbuf = strdup(mntopts);
379	found = 0;
380	for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
381		if (opt[0] == 'n' && opt[1] == 'o') {
382			if (!strcasecmp(opt + 2, option))
383				found = negative;
384		} else if (!strcasecmp(opt, option))
385			found = !negative;
386	}
387	free(optbuf);
388	return (found);
389}
390
391int
392mountfs(vfstype, spec, name, flags, options, mntopts)
393	const char *vfstype, *spec, *name, *options, *mntopts;
394	int flags;
395{
396	const char *argv[100], **edir;
397	char *path, *cur;
398	struct statfs sf;
399	pid_t pid;
400	int argc, i, status;
401	char *optbuf, execname[MAXPATHLEN + 1], mntpath[MAXPATHLEN];
402
403#if __GNUC__
404	(void)&optbuf;
405	(void)&name;
406#endif
407
408	/* resolve the mountpoint with realpath(3) */
409	(void)checkpath(name, mntpath);
410	name = mntpath;
411
412	if (mntopts == NULL)
413		mntopts = "";
414	if (options == NULL) {
415		if (*mntopts == '\0') {
416			options = "rw";
417		} else {
418			options = mntopts;
419			mntopts = "";
420		}
421	}
422	optbuf = catopt(strdup(mntopts), options);
423
424	if (strcmp(name, "/") == 0)
425		flags |= MNT_UPDATE;
426	if (flags & MNT_FORCE)
427		optbuf = catopt(optbuf, "force");
428	if (flags & MNT_RDONLY)
429		optbuf = catopt(optbuf, "ro");
430	/*
431	 * XXX
432	 * The mount_mfs (newfs) command uses -o to select the
433	 * optimization mode.  We don't pass the default "-o rw"
434	 * for that reason.
435	 */
436	if (flags & MNT_UPDATE)
437		optbuf = catopt(optbuf, "update");
438
439	/* Compatibility glue. */
440	if (strcmp(vfstype, "msdos") == 0)
441		vfstype = "msdosfs";
442
443	argc = 0;
444	argv[argc++] = vfstype;
445	mangle(optbuf, &argc, argv);
446	argv[argc++] = spec;
447	argv[argc++] = name;
448	argv[argc] = NULL;
449
450	if (debug) {
451		(void)printf("exec: mount_%s", vfstype);
452		for (i = 1; i < argc; i++)
453			(void)printf(" %s", argv[i]);
454		(void)printf("\n");
455		return (0);
456	}
457
458	switch (pid = fork()) {
459	case -1:				/* Error. */
460		warn("fork");
461		free(optbuf);
462		return (1);
463	case 0:					/* Child. */
464		if (strcmp(vfstype, "ufs") == 0)
465			exit(mount_ufs(argc, (char * const *) argv));
466
467		/* Go find an executable. */
468		(void)snprintf(execname, sizeof(execname), "mount_%s", vfstype);
469		execvP(execname, _PATH_SYSPATH, (char * const *)argv);
470		if (errno == ENOENT) {
471			warn("exec mount_%s not found in %s", vfstype, path);
472		}
473		exit(1);
474		/* NOTREACHED */
475	default:				/* Parent. */
476		free(optbuf);
477
478		if (waitpid(pid, &status, 0) < 0) {
479			warn("waitpid");
480			return (1);
481		}
482
483		if (WIFEXITED(status)) {
484			if (WEXITSTATUS(status) != 0)
485				return (WEXITSTATUS(status));
486		} else if (WIFSIGNALED(status)) {
487			warnx("%s: %s", name, sys_siglist[WTERMSIG(status)]);
488			return (1);
489		}
490
491		if (verbose) {
492			if (statfs(name, &sf) < 0) {
493				warn("statfs %s", name);
494				return (1);
495			}
496			if (fstab_style)
497				putfsent(&sf);
498			else
499				prmount(&sf);
500		}
501		break;
502	}
503
504	return (0);
505}
506
507void
508prmount(sfp)
509	struct statfs *sfp;
510{
511	int flags;
512	struct opt *o;
513	struct passwd *pw;
514
515	(void)printf("%s on %s (%s", sfp->f_mntfromname, sfp->f_mntonname,
516	    sfp->f_fstypename);
517
518	flags = sfp->f_flags & MNT_VISFLAGMASK;
519	for (o = optnames; flags && o->o_opt; o++)
520		if (flags & o->o_opt) {
521			(void)printf(", %s", o->o_name);
522			flags &= ~o->o_opt;
523		}
524	if (sfp->f_owner) {
525		(void)printf(", mounted by ");
526		if ((pw = getpwuid(sfp->f_owner)) != NULL)
527			(void)printf("%s", pw->pw_name);
528		else
529			(void)printf("%d", sfp->f_owner);
530	}
531	if (verbose) {
532		if (sfp->f_syncwrites != 0 || sfp->f_asyncwrites != 0)
533			(void)printf(", writes: sync %ld async %ld",
534			    sfp->f_syncwrites, sfp->f_asyncwrites);
535		if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0)
536			(void)printf(", reads: sync %ld async %ld",
537			    sfp->f_syncreads, sfp->f_asyncreads);
538	}
539	(void)printf(")\n");
540}
541
542struct statfs *
543getmntpt(name)
544	const char *name;
545{
546	struct statfs *mntbuf;
547	int i, mntsize;
548
549	mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
550	for (i = mntsize - 1; i >= 0; i--) {
551		if (strcmp(mntbuf[i].f_mntfromname, name) == 0 ||
552		    strcmp(mntbuf[i].f_mntonname, name) == 0)
553			return (&mntbuf[i]);
554	}
555	return (NULL);
556}
557
558char *
559catopt(s0, s1)
560	char *s0;
561	const char *s1;
562{
563	size_t i;
564	char *cp;
565
566	if (s1 == NULL || *s1 == '\0')
567		return s0;
568
569	if (s0 && *s0) {
570		i = strlen(s0) + strlen(s1) + 1 + 1;
571		if ((cp = malloc(i)) == NULL)
572			errx(1, "malloc failed");
573		(void)snprintf(cp, i, "%s,%s", s0, s1);
574	} else
575		cp = strdup(s1);
576
577	if (s0)
578		free(s0);
579	return (cp);
580}
581
582void
583mangle(options, argcp, argv)
584	char *options;
585	int *argcp;
586	const char **argv;
587{
588	char *p, *s;
589	int argc;
590
591	argc = *argcp;
592	for (s = options; (p = strsep(&s, ",")) != NULL;)
593		if (*p != '\0') {
594			if (*p == '-') {
595				argv[argc++] = p;
596				p = strchr(p, '=');
597				if (p) {
598					*p = '\0';
599					argv[argc++] = p+1;
600				}
601			} else if (strcmp(p, "rw") != 0) {
602				argv[argc++] = "-o";
603				argv[argc++] = p;
604			}
605		}
606
607	*argcp = argc;
608}
609
610
611char *
612update_options(opts, fstab, curflags)
613	char *opts;
614	char *fstab;
615	int curflags;
616{
617	char *o, *p;
618	char *cur;
619	char *expopt, *newopt, *tmpopt;
620
621	if (opts == NULL)
622		return strdup("");
623
624	/* remove meta options from list */
625	remopt(fstab, MOUNT_META_OPTION_FSTAB);
626	remopt(fstab, MOUNT_META_OPTION_CURRENT);
627	cur = flags2opts(curflags);
628
629	/*
630	 * Expand all meta-options passed to us first.
631	 */
632	expopt = NULL;
633	for (p = opts; (o = strsep(&p, ",")) != NULL;) {
634		if (strcmp(MOUNT_META_OPTION_FSTAB, o) == 0)
635			expopt = catopt(expopt, fstab);
636		else if (strcmp(MOUNT_META_OPTION_CURRENT, o) == 0)
637			expopt = catopt(expopt, cur);
638		else
639			expopt = catopt(expopt, o);
640	}
641	free(cur);
642	free(opts);
643
644	/*
645	 * Remove previous contradictory arguments. Given option "foo" we
646	 * remove all the "nofoo" options. Given "nofoo" we remove "nonofoo"
647	 * and "foo" - so we can deal with possible options like "notice".
648	 */
649	newopt = NULL;
650	for (p = expopt; (o = strsep(&p, ",")) != NULL;) {
651		if ((tmpopt = malloc( strlen(o) + 2 + 1 )) == NULL)
652			errx(1, "malloc failed");
653
654		strcpy(tmpopt, "no");
655		strcat(tmpopt, o);
656		remopt(newopt, tmpopt);
657		free(tmpopt);
658
659		if (strncmp("no", o, 2) == 0)
660			remopt(newopt, o+2);
661
662		newopt = catopt(newopt, o);
663	}
664	free(expopt);
665
666	return newopt;
667}
668
669void
670remopt(string, opt)
671	char *string;
672 	const char *opt;
673{
674	char *o, *p, *r;
675
676	if (string == NULL || *string == '\0' || opt == NULL || *opt == '\0')
677		return;
678
679	r = string;
680
681	for (p = string; (o = strsep(&p, ",")) != NULL;) {
682		if (strcmp(opt, o) != 0) {
683			if (*r == ',' && *o != '\0')
684				r++;
685			while ((*r++ = *o++) != '\0')
686			    ;
687			*--r = ',';
688		}
689	}
690	*r = '\0';
691}
692
693void
694usage()
695{
696
697	(void)fprintf(stderr, "%s\n%s\n%s\n",
698"usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node",
699"       mount [-adfpruvw] [ -F fstab] [-t ufs | external_type]",
700"       mount [-dfpruvw] special | node");
701	exit(1);
702}
703
704void
705putfsent(ent)
706	const struct statfs *ent;
707{
708	struct fstab *fst;
709	char *opts;
710
711	opts = flags2opts(ent->f_flags);
712	printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname,
713	    ent->f_fstypename, opts);
714	free(opts);
715
716	if ((fst = getfsspec(ent->f_mntfromname)))
717		printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
718	else if ((fst = getfsfile(ent->f_mntonname)))
719		printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
720	else if (strcmp(ent->f_fstypename, "ufs") == 0) {
721		if (strcmp(ent->f_mntonname, "/") == 0)
722			printf("\t1 1\n");
723		else
724			printf("\t2 2\n");
725	} else
726		printf("\t0 0\n");
727}
728
729
730char *
731flags2opts(flags)
732	int flags;
733{
734	char *res;
735
736	res = NULL;
737
738	res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw");
739
740	if (flags & MNT_SYNCHRONOUS)	res = catopt(res, "sync");
741	if (flags & MNT_NOEXEC)		res = catopt(res, "noexec");
742	if (flags & MNT_NOSUID)		res = catopt(res, "nosuid");
743	if (flags & MNT_NODEV)		res = catopt(res, "nodev");
744	if (flags & MNT_UNION)		res = catopt(res, "union");
745	if (flags & MNT_ASYNC)		res = catopt(res, "async");
746	if (flags & MNT_NOATIME)	res = catopt(res, "noatime");
747	if (flags & MNT_NOCLUSTERR)	res = catopt(res, "noclusterr");
748	if (flags & MNT_NOCLUSTERW)	res = catopt(res, "noclusterw");
749	if (flags & MNT_NOSYMFOLLOW)	res = catopt(res, "nosymfollow");
750	if (flags & MNT_SUIDDIR)	res = catopt(res, "suiddir");
751	if (flags & MNT_MULTILABEL)	res = catopt(res, "multilabel");
752	if (flags & MNT_ACLS)		res = catopt(res, "acls");
753
754	return res;
755}
756