summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-03-12 18:35:10 +0000
committerbde <bde@FreeBSD.org>1997-03-12 18:35:10 +0000
commit0ecb1e854b530441ebb69afcec1df0c59cd2daf8 (patch)
tree81f1ffd815c131da6859803f2a5f421b1c3cb9d8 /sbin/mount
parent30c15106d5bd9ed6df712b45d4a9bffab108c224 (diff)
downloadFreeBSD-src-0ecb1e854b530441ebb69afcec1df0c59cd2daf8.zip
FreeBSD-src-0ecb1e854b530441ebb69afcec1df0c59cd2daf8.tar.gz
Finished (?) merging with Lite2: cleaned up #include mess; fixed merging
errors (mis-sorted prototypes, duplicated MNT_NOATIME, duplicated NULL mntopts fixup). Updated getopt() usage. Fixed style bugs in FreeBSD changes (one or two per line for putfsent() stuff).
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c110
1 files changed, 48 insertions, 62 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 99173ea..c281cbc 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -43,9 +43,8 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#include <sys/param.h>
#include <sys/mount.h>
-#include <sys/wait.h>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/wait.h>
#include <err.h>
#include <errno.h>
@@ -59,8 +58,7 @@ static char sccsid[] = "@(#)mount.c 8.25 (Berkeley) 5/8/95";
#include "pathnames.h"
-int debug, verbose;
-int fstab_style = 0;
+int debug, fstab_style, verbose;
int checkvfsname __P((const char *, const char **));
char *catopt __P((char *, const char *));
@@ -73,8 +71,8 @@ void mangle __P((char *, int *, const char **));
int mountfs __P((const char *, const char *, const char *,
int, const char *, const char *));
void prmount __P((struct statfs *));
-void usage __P((void));
void putfsent __P((const struct statfs *));
+void usage __P((void));
/* From mount_ufs.c. */
int mount_ufs __P((int, char * const *));
@@ -95,7 +93,6 @@ static struct opt {
{ MNT_RDONLY, "read-only" },
{ MNT_SYNCHRONOUS, "synchronous" },
{ MNT_UNION, "union" },
- { MNT_NOATIME, "noatime" },
{ NULL }
};
@@ -116,12 +113,8 @@ main(argc, argv)
options = NULL;
vfslist = NULL;
vfstype = "ufs";
- while ((ch = getopt(argc, argv, "padfo:rwt:uv")) != EOF)
+ while ((ch = getopt(argc, argv, "adfo:prwt:uv")) != -1)
switch (ch) {
- case 'p':
- fstab_style = 1;
- verbose = 1;
- break;
case 'a':
all = 1;
break;
@@ -135,6 +128,10 @@ main(argc, argv)
if (*optarg)
options = catopt(options, optarg);
break;
+ case 'p':
+ fstab_style = 1;
+ verbose = 1;
+ break;
case 'r':
init_flags |= MNT_RDONLY;
break;
@@ -177,9 +174,9 @@ main(argc, argv)
if (hasopt(fs->fs_mntops, "noauto"))
continue;
if (mountfs(fs->fs_vfstype, fs->fs_spec,
- fs->fs_file, init_flags, options,
- fs->fs_mntops))
- rval = 1;
+ fs->fs_file, init_flags, options,
+ fs->fs_mntops))
+ rval = 1;
}
else if (fstab_style) {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
@@ -187,14 +184,14 @@ main(argc, argv)
for (i = 0; i < mntsize; i++) {
if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
continue;
- putfsent (&mntbuf[i]);
+ putfsent(&mntbuf[i]);
}
- }
- else {
+ } else {
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
err(1, "getmntinfo");
for (i = 0; i < mntsize; i++) {
- if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
+ if (checkvfsname(mntbuf[i].f_fstypename,
+ vfslist))
continue;
prmount(&mntbuf[i]);
}
@@ -288,8 +285,6 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
const char *vfstype, *spec, *name, *options, *mntopts;
int flags;
{
- struct stat sb;
-
/* List of directories containing mount_xxx subcommands. */
static const char *edirs[] = {
_PATH_SBIN,
@@ -297,6 +292,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
NULL
};
const char *argv[100], **edir;
+ struct stat sb;
struct statfs sf;
pid_t pid;
int argc, i, status;
@@ -312,9 +308,6 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
return (1);
}
- if (mntopts == NULL)
- mntopts = "";
-
name = mntpath;
if (mntopts == NULL)
@@ -415,7 +408,7 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
return (1);
}
if (fstab_style)
- putfsent (&sf);
+ putfsent(&sf);
else
prmount(&sf);
}
@@ -529,43 +522,36 @@ usage()
}
void
-putfsent (ent)
- const struct statfs *ent;
+putfsent(ent)
+ const struct statfs *ent;
{
- struct fstab *fst;
-
- printf ("%s\t%s\t%s %s",
- ent->f_mntfromname, ent->f_mntonname,
- ent->f_fstypename,
- (ent->f_flags & MNT_RDONLY) ? "ro" : "rw");
-
- if (ent->f_flags & MNT_SYNCHRONOUS)
- printf (",sync");
-
- if (ent->f_flags & MNT_NOEXEC)
- printf (",noexec");
-
- if (ent->f_flags & MNT_NOSUID)
- printf (",nosuid");
-
- if (ent->f_flags & MNT_NODEV)
- printf (",nodev");
-
- if (ent->f_flags & MNT_UNION)
- printf (",union");
-
- if (ent->f_flags & MNT_ASYNC)
- printf (",async");
-
- if (ent->f_flags & MNT_NOATIME)
- printf (",noatime");
-
- if (fst = getfsspec (ent->f_mntfromname))
- printf ("\t%u %u\n", fst->fs_freq, fst->fs_passno);
- else if (fst = getfsfile (ent->f_mntonname))
- printf ("\t%u %u\n", fst->fs_freq, fst->fs_passno);
- else if (ent->f_type == MOUNT_UFS)
- printf ("\t1 1\n");
- else
- printf ("\t0 0\n");
+ struct fstab *fst;
+
+ printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname,
+ ent->f_fstypename, (ent->f_flags & MNT_RDONLY) ? "ro" : "rw");
+
+ /* XXX should use optnames[] - put shorter names in it. */
+ if (ent->f_flags & MNT_SYNCHRONOUS)
+ printf(",sync");
+ if (ent->f_flags & MNT_NOEXEC)
+ printf(",noexec");
+ if (ent->f_flags & MNT_NOSUID)
+ printf(",nosuid");
+ if (ent->f_flags & MNT_NODEV)
+ printf(",nodev");
+ if (ent->f_flags & MNT_UNION)
+ printf(",union");
+ if (ent->f_flags & MNT_ASYNC)
+ printf(",async");
+ if (ent->f_flags & MNT_NOATIME)
+ printf(",noatime");
+
+ if (fst = getfsspec(ent->f_mntfromname))
+ printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
+ else if (fst = getfsfile(ent->f_mntonname))
+ printf("\t%u %u\n", fst->fs_freq, fst->fs_passno);
+ else if (ent->f_type == MOUNT_UFS)
+ printf("\t1 1\n");
+ else
+ printf("\t0 0\n");
}
OpenPOWER on IntegriCloud