Sat Oct 5 08:06:35 2013 UTC ()
No code change: corrected spelling in comment, removed trailing white spaces.


(ast)
diff -r1.98 -r1.99 src/sbin/mount/mount.c

cvs diff -r1.98 -r1.99 src/sbin/mount/mount.c (expand / switch to unified diff)

--- src/sbin/mount/mount.c 2013/01/24 17:53:49 1.98
+++ src/sbin/mount/mount.c 2013/10/05 08:06:35 1.99
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mount.c,v 1.98 2013/01/24 17:53:49 christos Exp $ */ 1/* $NetBSD: mount.c,v 1.99 2013/10/05 08:06:35 ast Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1980, 1989, 1993, 1994 4 * Copyright (c) 1980, 1989, 1993, 1994
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\ 34__COPYRIGHT("@(#) Copyright (c) 1980, 1989, 1993, 1994\
35 The Regents of the University of California. All rights reserved."); 35 The Regents of the University of California. All rights reserved.");
36#endif /* not lint */ 36#endif /* not lint */
37 37
38#ifndef lint 38#ifndef lint
39#if 0 39#if 0
40static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95"; 40static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
41#else 41#else
42__RCSID("$NetBSD: mount.c,v 1.98 2013/01/24 17:53:49 christos Exp $"); 42__RCSID("$NetBSD: mount.c,v 1.99 2013/10/05 08:06:35 ast Exp $");
43#endif 43#endif
44#endif /* not lint */ 44#endif /* not lint */
45 45
46#include <sys/param.h> 46#include <sys/param.h>
47#include <sys/mount.h> 47#include <sys/mount.h>
48#include <sys/wait.h> 48#include <sys/wait.h>
49 49
50#include <fs/puffs/puffs_msgif.h> 50#include <fs/puffs/puffs_msgif.h>
51 51
52#include <err.h> 52#include <err.h>
53#include <errno.h> 53#include <errno.h>
54#include <fstab.h> 54#include <fstab.h>
55#include <pwd.h> 55#include <pwd.h>
@@ -75,27 +75,27 @@ static void catopt(char **, const char * @@ -75,27 +75,27 @@ static void catopt(char **, const char *
75static const char * 75static const char *
76 getfslab(const char *str); 76 getfslab(const char *str);
77static struct statvfs * 77static struct statvfs *
78 getmntpt(const char *); 78 getmntpt(const char *);
79static int getmntargs(struct statvfs *, char *, size_t); 79static int getmntargs(struct statvfs *, char *, size_t);
80static int hasopt(const char *, const char *); 80static int hasopt(const char *, const char *);
81static void mangle(char *, int *, const char ** volatile *, int *); 81static void mangle(char *, int *, const char ** volatile *, int *);
82static int mountfs(const char *, const char *, const char *, 82static int mountfs(const char *, const char *, const char *,
83 int, const char *, const char *, int, char *, size_t); 83 int, const char *, const char *, int, char *, size_t);
84static void prmount(struct statvfs *); 84static void prmount(struct statvfs *);
85__dead static void usage(void); 85__dead static void usage(void);
86 86
87 87
88/* Map from mount otions to printable formats. */ 88/* Map from mount options to printable formats. */
89static const struct opt { 89static const struct opt {
90 int o_opt; 90 int o_opt;
91 int o_silent; 91 int o_silent;
92 const char *o_name; 92 const char *o_name;
93} optnames[] = { 93} optnames[] = {
94 __MNT_FLAGS 94 __MNT_FLAGS
95}; 95};
96 96
97static const char ffs_fstype[] = "ffs"; 97static const char ffs_fstype[] = "ffs";
98 98
99int 99int
100main(int argc, char *argv[]) 100main(int argc, char *argv[])
101{ 101{
@@ -342,27 +342,27 @@ hasopt(const char *mntopts, const char * @@ -342,27 +342,27 @@ hasopt(const char *mntopts, const char *
342 found = 0; 342 found = 0;
343 for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) { 343 for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
344 if (opt[0] == 'n' && opt[1] == 'o') { 344 if (opt[0] == 'n' && opt[1] == 'o') {
345 if (!strcasecmp(opt + 2, option)) 345 if (!strcasecmp(opt + 2, option))
346 found = negative; 346 found = negative;
347 } else if (!strcasecmp(opt, option)) 347 } else if (!strcasecmp(opt, option))
348 found = !negative; 348 found = !negative;
349 } 349 }
350 free(optbuf); 350 free(optbuf);
351 return (found); 351 return (found);
352} 352}
353 353
354static int 354static int
355mountfs(const char *vfstype, const char *spec, const char *name,  355mountfs(const char *vfstype, const char *spec, const char *name,
356 int flags, const char *options, const char *mntopts, 356 int flags, const char *options, const char *mntopts,
357 int skipmounted, char *buf, size_t buflen) 357 int skipmounted, char *buf, size_t buflen)
358{ 358{
359 /* List of directories containing mount_xxx subcommands. */ 359 /* List of directories containing mount_xxx subcommands. */
360 static const char *edirs[] = { 360 static const char *edirs[] = {
361#ifdef RESCUEDIR 361#ifdef RESCUEDIR
362 RESCUEDIR, 362 RESCUEDIR,
363#endif 363#endif
364 _PATH_SBIN, 364 _PATH_SBIN,
365 _PATH_USRSBIN, 365 _PATH_USRSBIN,
366 NULL 366 NULL
367 }; 367 };
368 const char ** volatile argv, **edir; 368 const char ** volatile argv, **edir;
@@ -569,27 +569,27 @@ mountfs(const char *vfstype, const char  @@ -569,27 +569,27 @@ mountfs(const char *vfstype, const char
569static void 569static void
570prmount(struct statvfs *sfp) 570prmount(struct statvfs *sfp)
571{ 571{
572 int flags; 572 int flags;
573 const struct opt *o; 573 const struct opt *o;
574 struct passwd *pw; 574 struct passwd *pw;
575 int f; 575 int f;
576 576
577 (void)printf("%s on %s type %.*s", sfp->f_mntfromname, 577 (void)printf("%s on %s type %.*s", sfp->f_mntfromname,
578 sfp->f_mntonname, (int)sizeof(sfp->f_fstypename), 578 sfp->f_mntonname, (int)sizeof(sfp->f_fstypename),
579 sfp->f_fstypename); 579 sfp->f_fstypename);
580 580
581 flags = sfp->f_flag & MNT_VISFLAGMASK; 581 flags = sfp->f_flag & MNT_VISFLAGMASK;
582 for (f = 0, o = optnames; flags && o <  582 for (f = 0, o = optnames; flags && o <
583 &optnames[sizeof(optnames)/sizeof(optnames[0])]; o++) 583 &optnames[sizeof(optnames)/sizeof(optnames[0])]; o++)
584 if (flags & o->o_opt) { 584 if (flags & o->o_opt) {
585 if (!o->o_silent || verbose) 585 if (!o->o_silent || verbose)
586 (void)printf("%s%s", !f++ ? " (" : ", ", 586 (void)printf("%s%s", !f++ ? " (" : ", ",
587 o->o_name); 587 o->o_name);
588 flags &= ~o->o_opt; 588 flags &= ~o->o_opt;
589 } 589 }
590 if (flags) 590 if (flags)
591 (void)printf("%sunknown flag%s %#x", !f++ ? " (" : ", ", 591 (void)printf("%sunknown flag%s %#x", !f++ ? " (" : ", ",
592 flags & (flags - 1) ? "s" : "", flags); 592 flags & (flags - 1) ? "s" : "", flags);
593 if (sfp->f_owner) { 593 if (sfp->f_owner) {
594 (void)printf("%smounted by ", !f++ ? " (" : ", "); 594 (void)printf("%smounted by ", !f++ ? " (" : ", ");
595 if ((pw = getpwuid(sfp->f_owner)) != NULL) 595 if ((pw = getpwuid(sfp->f_owner)) != NULL)