mount.c revision 123162
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 123162 2003-12-05 09:36:56Z iedowse $"; 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]; 397 struct statfs sf; 398 pid_t pid; 399 int argc, i, status; 400 char *optbuf, execname[PATH_MAX], mntpath[PATH_MAX]; 401 402#if __GNUC__ 403 (void)&optbuf; 404 (void)&name; 405#endif 406 407 /* resolve the mountpoint with realpath(3) */ 408 (void)checkpath(name, mntpath); 409 name = mntpath; 410 411 if (mntopts == NULL) 412 mntopts = ""; 413 if (options == NULL) { 414 if (*mntopts == '\0') { 415 options = "rw"; 416 } else { 417 options = mntopts; 418 mntopts = ""; 419 } 420 } 421 optbuf = catopt(strdup(mntopts), options); 422 423 if (strcmp(name, "/") == 0) 424 flags |= MNT_UPDATE; 425 if (flags & MNT_FORCE) 426 optbuf = catopt(optbuf, "force"); 427 if (flags & MNT_RDONLY) 428 optbuf = catopt(optbuf, "ro"); 429 /* 430 * XXX 431 * The mount_mfs (newfs) command uses -o to select the 432 * optimization mode. We don't pass the default "-o rw" 433 * for that reason. 434 */ 435 if (flags & MNT_UPDATE) 436 optbuf = catopt(optbuf, "update"); 437 438 /* Compatibility glue. */ 439 if (strcmp(vfstype, "msdos") == 0) 440 vfstype = "msdosfs"; 441 442 argc = 0; 443 argv[argc++] = vfstype; 444 mangle(optbuf, &argc, argv); 445 argv[argc++] = spec; 446 argv[argc++] = name; 447 argv[argc] = NULL; 448 449 if (debug) { 450 (void)printf("exec: mount_%s", vfstype); 451 for (i = 1; i < argc; i++) 452 (void)printf(" %s", argv[i]); 453 (void)printf("\n"); 454 return (0); 455 } 456 457 switch (pid = fork()) { 458 case -1: /* Error. */ 459 warn("fork"); 460 free(optbuf); 461 return (1); 462 case 0: /* Child. */ 463 if (strcmp(vfstype, "ufs") == 0) 464 exit(mount_ufs(argc, (char * const *) argv)); 465 466 /* Go find an executable. */ 467 (void)snprintf(execname, sizeof(execname), "mount_%s", vfstype); 468 execvP(execname, _PATH_SYSPATH, (char * const *)argv); 469 if (errno == ENOENT) { 470 warn("exec mount_%s not found in %s", vfstype, 471 _PATH_SYSPATH); 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, i; 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 (long)sfp->f_syncwrites, (long)sfp->f_asyncwrites); 535 if (sfp->f_syncreads != 0 || sfp->f_asyncreads != 0) 536 (void)printf(", reads: sync %ld async %ld", 537 (long)sfp->f_syncreads, (long)sfp->f_asyncreads); 538 if (sfp->f_fsid.val[0] != 0 || sfp->f_fsid.val[1] != 0) { 539 printf(", fsid "); 540 for (i = 0; i < sizeof(sfp->f_fsid); i++) 541 printf("%02x", ((u_char *)&sfp->f_fsid)[i]); 542 } 543 } 544 (void)printf(")\n"); 545} 546 547struct statfs * 548getmntpt(name) 549 const char *name; 550{ 551 struct statfs *mntbuf; 552 int i, mntsize; 553 554 mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); 555 for (i = mntsize - 1; i >= 0; i--) { 556 if (strcmp(mntbuf[i].f_mntfromname, name) == 0 || 557 strcmp(mntbuf[i].f_mntonname, name) == 0) 558 return (&mntbuf[i]); 559 } 560 return (NULL); 561} 562 563char * 564catopt(s0, s1) 565 char *s0; 566 const char *s1; 567{ 568 size_t i; 569 char *cp; 570 571 if (s1 == NULL || *s1 == '\0') 572 return s0; 573 574 if (s0 && *s0) { 575 i = strlen(s0) + strlen(s1) + 1 + 1; 576 if ((cp = malloc(i)) == NULL) 577 errx(1, "malloc failed"); 578 (void)snprintf(cp, i, "%s,%s", s0, s1); 579 } else 580 cp = strdup(s1); 581 582 if (s0) 583 free(s0); 584 return (cp); 585} 586 587void 588mangle(options, argcp, argv) 589 char *options; 590 int *argcp; 591 const char **argv; 592{ 593 char *p, *s; 594 int argc; 595 596 argc = *argcp; 597 for (s = options; (p = strsep(&s, ",")) != NULL;) 598 if (*p != '\0') { 599 if (*p == '-') { 600 argv[argc++] = p; 601 p = strchr(p, '='); 602 if (p) { 603 *p = '\0'; 604 argv[argc++] = p+1; 605 } 606 } else if (strcmp(p, "rw") != 0) { 607 argv[argc++] = "-o"; 608 argv[argc++] = p; 609 } 610 } 611 612 *argcp = argc; 613} 614 615 616char * 617update_options(opts, fstab, curflags) 618 char *opts; 619 char *fstab; 620 int curflags; 621{ 622 char *o, *p; 623 char *cur; 624 char *expopt, *newopt, *tmpopt; 625 626 if (opts == NULL) 627 return strdup(""); 628 629 /* remove meta options from list */ 630 remopt(fstab, MOUNT_META_OPTION_FSTAB); 631 remopt(fstab, MOUNT_META_OPTION_CURRENT); 632 cur = flags2opts(curflags); 633 634 /* 635 * Expand all meta-options passed to us first. 636 */ 637 expopt = NULL; 638 for (p = opts; (o = strsep(&p, ",")) != NULL;) { 639 if (strcmp(MOUNT_META_OPTION_FSTAB, o) == 0) 640 expopt = catopt(expopt, fstab); 641 else if (strcmp(MOUNT_META_OPTION_CURRENT, o) == 0) 642 expopt = catopt(expopt, cur); 643 else 644 expopt = catopt(expopt, o); 645 } 646 free(cur); 647 free(opts); 648 649 /* 650 * Remove previous contradictory arguments. Given option "foo" we 651 * remove all the "nofoo" options. Given "nofoo" we remove "nonofoo" 652 * and "foo" - so we can deal with possible options like "notice". 653 */ 654 newopt = NULL; 655 for (p = expopt; (o = strsep(&p, ",")) != NULL;) { 656 if ((tmpopt = malloc( strlen(o) + 2 + 1 )) == NULL) 657 errx(1, "malloc failed"); 658 659 strcpy(tmpopt, "no"); 660 strcat(tmpopt, o); 661 remopt(newopt, tmpopt); 662 free(tmpopt); 663 664 if (strncmp("no", o, 2) == 0) 665 remopt(newopt, o+2); 666 667 newopt = catopt(newopt, o); 668 } 669 free(expopt); 670 671 return newopt; 672} 673 674void 675remopt(string, opt) 676 char *string; 677 const char *opt; 678{ 679 char *o, *p, *r; 680 681 if (string == NULL || *string == '\0' || opt == NULL || *opt == '\0') 682 return; 683 684 r = string; 685 686 for (p = string; (o = strsep(&p, ",")) != NULL;) { 687 if (strcmp(opt, o) != 0) { 688 if (*r == ',' && *o != '\0') 689 r++; 690 while ((*r++ = *o++) != '\0') 691 ; 692 *--r = ','; 693 } 694 } 695 *r = '\0'; 696} 697 698void 699usage() 700{ 701 702 (void)fprintf(stderr, "%s\n%s\n%s\n", 703"usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node", 704" mount [-adfpruvw] [ -F fstab] [-t ufs | external_type]", 705" mount [-dfpruvw] special | node"); 706 exit(1); 707} 708 709void 710putfsent(ent) 711 const struct statfs *ent; 712{ 713 struct fstab *fst; 714 char *opts; 715 716 opts = flags2opts(ent->f_flags); 717 printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname, 718 ent->f_fstypename, opts); 719 free(opts); 720 721 if ((fst = getfsspec(ent->f_mntfromname))) 722 printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); 723 else if ((fst = getfsfile(ent->f_mntonname))) 724 printf("\t%u %u\n", fst->fs_freq, fst->fs_passno); 725 else if (strcmp(ent->f_fstypename, "ufs") == 0) { 726 if (strcmp(ent->f_mntonname, "/") == 0) 727 printf("\t1 1\n"); 728 else 729 printf("\t2 2\n"); 730 } else 731 printf("\t0 0\n"); 732} 733 734 735char * 736flags2opts(flags) 737 int flags; 738{ 739 char *res; 740 741 res = NULL; 742 743 res = catopt(res, (flags & MNT_RDONLY) ? "ro" : "rw"); 744 745 if (flags & MNT_SYNCHRONOUS) res = catopt(res, "sync"); 746 if (flags & MNT_NOEXEC) res = catopt(res, "noexec"); 747 if (flags & MNT_NOSUID) res = catopt(res, "nosuid"); 748 if (flags & MNT_NODEV) res = catopt(res, "nodev"); 749 if (flags & MNT_UNION) res = catopt(res, "union"); 750 if (flags & MNT_ASYNC) res = catopt(res, "async"); 751 if (flags & MNT_NOATIME) res = catopt(res, "noatime"); 752 if (flags & MNT_NOCLUSTERR) res = catopt(res, "noclusterr"); 753 if (flags & MNT_NOCLUSTERW) res = catopt(res, "noclusterw"); 754 if (flags & MNT_NOSYMFOLLOW) res = catopt(res, "nosymfollow"); 755 if (flags & MNT_SUIDDIR) res = catopt(res, "suiddir"); 756 if (flags & MNT_MULTILABEL) res = catopt(res, "multilabel"); 757 if (flags & MNT_ACLS) res = catopt(res, "acls"); 758 759 return res; 760} 761