Pre-IFS commit. Commit IFS-aware fsck and mount utilities.
mount_ifs: repocopy of sbin/mount, with most of the intelligence ripped out and "ufs" replaced with "ifs" in the right places. It will only mount a single filesystem, rather than the -t <type> magic that our real mount does. fsck_ifs: repocopy of sbin/fsck_ffs, but the directory structure stuff (pass2 and some refcount checks) has been #ifdef'ed out. src/sbin/Makefile: Build these two utilities There is probably cruft code left in both which can be removed at a later date, especially in mount_ifs, but I trust that people will not try mount_ifs -a .. Note: there are no man pages installed for these two commands as I haven't actually written them yet.
This commit is contained in:
parent
3de1cbc079
commit
ee143d47ad
@ -17,6 +17,7 @@ SUBDIR= adjkerntz \
|
|||||||
dumpfs \
|
dumpfs \
|
||||||
dumpon \
|
dumpon \
|
||||||
fsck \
|
fsck \
|
||||||
|
fsck_ifs \
|
||||||
fsck_ffs \
|
fsck_ffs \
|
||||||
fsdb \
|
fsdb \
|
||||||
fsirand \
|
fsirand \
|
||||||
@ -37,6 +38,7 @@ SUBDIR= adjkerntz \
|
|||||||
mount \
|
mount \
|
||||||
mount_cd9660 \
|
mount_cd9660 \
|
||||||
mount_ext2fs \
|
mount_ext2fs \
|
||||||
|
mount_ifs \
|
||||||
mount_msdos \
|
mount_msdos \
|
||||||
mount_nfs \
|
mount_nfs \
|
||||||
mount_ntfs \
|
mount_ntfs \
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
# @(#)Makefile 8.2 (Berkeley) 4/27/95
|
# @(#)Makefile 8.2 (Berkeley) 4/27/95
|
||||||
|
|
||||||
PROG= fsck_ffs
|
PROG= fsck_ifs
|
||||||
LINKS+= ${BINDIR}/fsck_ffs ${BINDIR}/fsck_ufs
|
NOMAN= true
|
||||||
LINKS+= ${BINDIR}/fsck_ffs ${BINDIR}/fsck_4.2bsd
|
|
||||||
MAN8= fsck_ffs.8
|
|
||||||
SRCS= dir.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
|
SRCS= dir.c fsutil.c inode.c main.c pass1.c pass1b.c pass2.c pass3.c pass4.c \
|
||||||
pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
|
pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c
|
||||||
CFLAGS+=-W
|
CFLAGS+=-W
|
||||||
|
@ -241,9 +241,12 @@ checkfilesys(filesys, mntpt, auxdata, child)
|
|||||||
/*
|
/*
|
||||||
* 2: traverse directories from root to mark all connected directories
|
* 2: traverse directories from root to mark all connected directories
|
||||||
*/
|
*/
|
||||||
|
#ifdef NOTFORIFS
|
||||||
if (preen == 0)
|
if (preen == 0)
|
||||||
printf("** Phase 2 - Check Pathnames\n");
|
printf("** Phase 2 - Check Pathnames\n");
|
||||||
pass2();
|
pass2();
|
||||||
|
#endif
|
||||||
|
printf("** Skipping phase 2 for IFS\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 3: scan inodes looking for disconnected directories
|
* 3: scan inodes looking for disconnected directories
|
||||||
@ -345,7 +348,7 @@ checkfilesys(filesys, mntpt, auxdata, child)
|
|||||||
args.fspec = 0;
|
args.fspec = 0;
|
||||||
args.export.ex_flags = 0;
|
args.export.ex_flags = 0;
|
||||||
args.export.ex_root = 0;
|
args.export.ex_root = 0;
|
||||||
ret = mount("ufs", mntbuf->f_mntonname,
|
ret = mount("ifs", mntbuf->f_mntonname,
|
||||||
mntbuf->f_flags | MNT_UPDATE | MNT_RELOAD, &args);
|
mntbuf->f_flags | MNT_UPDATE | MNT_RELOAD, &args);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return (0);
|
return (0);
|
||||||
@ -380,7 +383,7 @@ getmntpt(name)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
|
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
|
||||||
for (i = 0; i < mntsize; i++) {
|
for (i = 0; i < mntsize; i++) {
|
||||||
if (strcmp(mntbuf[i].f_fstypename, "ufs") != 0)
|
if (strcmp(mntbuf[i].f_fstypename, "ifs") != 0)
|
||||||
continue;
|
continue;
|
||||||
devname = mntbuf[i].f_mntfromname;
|
devname = mntbuf[i].f_mntfromname;
|
||||||
if (*devname != '/') {
|
if (*devname != '/') {
|
||||||
|
@ -73,9 +73,12 @@ pass4()
|
|||||||
case DFOUND:
|
case DFOUND:
|
||||||
n = inoinfo(inumber)->ino_linkcnt;
|
n = inoinfo(inumber)->ino_linkcnt;
|
||||||
if (n) {
|
if (n) {
|
||||||
|
#if NOTFORIFS
|
||||||
adjust(&idesc, (short)n);
|
adjust(&idesc, (short)n);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if NOTFORIFS
|
||||||
for (zlnp = zlnhead; zlnp; zlnp = zlnp->next) {
|
for (zlnp = zlnhead; zlnp; zlnp = zlnp->next) {
|
||||||
if (zlnp->zlncnt == inumber) {
|
if (zlnp->zlncnt == inumber) {
|
||||||
zlnp->zlncnt = zlnhead->zlncnt;
|
zlnp->zlncnt = zlnhead->zlncnt;
|
||||||
@ -86,10 +89,10 @@ pass4()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DSTATE:
|
case DSTATE:
|
||||||
clri(&idesc, "UNREF", 1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DCLEAR:
|
case DCLEAR:
|
||||||
|
@ -292,10 +292,12 @@ setup(dev)
|
|||||||
}
|
}
|
||||||
numdirs = sblock.fs_cstotal.cs_ndir;
|
numdirs = sblock.fs_cstotal.cs_ndir;
|
||||||
dirhash = numdirs;
|
dirhash = numdirs;
|
||||||
|
#if NOTFORIFS
|
||||||
if (numdirs == 0) {
|
if (numdirs == 0) {
|
||||||
printf("numdirs is zero, try using an alternate superblock\n");
|
printf("numdirs is zero, try using an alternate superblock\n");
|
||||||
goto badsb;
|
goto badsb;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
inplast = 0;
|
inplast = 0;
|
||||||
listmax = numdirs + 10;
|
listmax = numdirs + 10;
|
||||||
inpsort = (struct inoinfo **)calloc((unsigned)listmax,
|
inpsort = (struct inoinfo **)calloc((unsigned)listmax,
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# @(#)Makefile 8.6 (Berkeley) 5/8/95
|
# @(#)Makefile 8.6 (Berkeley) 5/8/95
|
||||||
# $FreeBSD$
|
# $FreeBSD$
|
||||||
|
|
||||||
PROG= mount
|
PROG= mount_ifs
|
||||||
SRCS= mount.c mount_ufs.c getmntopts.c vfslist.c
|
SRCS= mount.c mount_ufs.c getmntopts.c
|
||||||
MAN8= mount.8
|
NOMAN= true
|
||||||
# We do NOT install the getmntopts.3 man page.
|
# We do NOT install the getmntopts.3 man page.
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -26,9 +26,5 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* vfslist.c */
|
|
||||||
int checkvfsname __P((const char *, const char **));
|
|
||||||
const char **makevfslist __P((char *));
|
|
||||||
|
|
||||||
/* mount_ufs.c */
|
/* mount_ufs.c */
|
||||||
int mount_ufs __P((int, char *const *));
|
int mount_ifs __P((int, char *const *));
|
||||||
|
@ -134,179 +134,8 @@ main(argc, argv)
|
|||||||
int all, ch, i, init_flags, mntsize, rval, have_fstab;
|
int all, ch, i, init_flags, mntsize, rval, have_fstab;
|
||||||
char *options;
|
char *options;
|
||||||
|
|
||||||
all = init_flags = 0;
|
mount_ifs(argc, argv);
|
||||||
options = NULL;
|
/* NOTREACHED */
|
||||||
vfslist = NULL;
|
|
||||||
vfstype = "ufs";
|
|
||||||
while ((ch = getopt(argc, argv, "adfo:prwt:uv")) != -1)
|
|
||||||
switch (ch) {
|
|
||||||
case 'a':
|
|
||||||
all = 1;
|
|
||||||
break;
|
|
||||||
case 'd':
|
|
||||||
debug = 1;
|
|
||||||
break;
|
|
||||||
case 'f':
|
|
||||||
init_flags |= MNT_FORCE;
|
|
||||||
break;
|
|
||||||
case 'o':
|
|
||||||
if (*optarg)
|
|
||||||
options = catopt(options, optarg);
|
|
||||||
break;
|
|
||||||
case 'p':
|
|
||||||
fstab_style = 1;
|
|
||||||
verbose = 1;
|
|
||||||
break;
|
|
||||||
case 'r':
|
|
||||||
init_flags |= MNT_RDONLY;
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
if (vfslist != NULL)
|
|
||||||
errx(1, "only one -t option may be specified");
|
|
||||||
vfslist = makevfslist(optarg);
|
|
||||||
vfstype = optarg;
|
|
||||||
break;
|
|
||||||
case 'u':
|
|
||||||
init_flags |= MNT_UPDATE;
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
verbose = 1;
|
|
||||||
break;
|
|
||||||
case 'w':
|
|
||||||
init_flags &= ~MNT_RDONLY;
|
|
||||||
break;
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
|
|
||||||
#define BADTYPE(type) \
|
|
||||||
(strcmp(type, FSTAB_RO) && \
|
|
||||||
strcmp(type, FSTAB_RW) && strcmp(type, FSTAB_RQ))
|
|
||||||
|
|
||||||
rval = 0;
|
|
||||||
switch (argc) {
|
|
||||||
case 0:
|
|
||||||
if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
|
|
||||||
err(1, "getmntinfo");
|
|
||||||
if (all) {
|
|
||||||
while ((fs = getfsent()) != NULL) {
|
|
||||||
if (BADTYPE(fs->fs_type))
|
|
||||||
continue;
|
|
||||||
if (checkvfsname(fs->fs_vfstype, vfslist))
|
|
||||||
continue;
|
|
||||||
if (hasopt(fs->fs_mntops, "noauto"))
|
|
||||||
continue;
|
|
||||||
if (!(init_flags & MNT_UPDATE) &&
|
|
||||||
ismounted(fs, mntbuf, mntsize))
|
|
||||||
continue;
|
|
||||||
if (mountfs(fs->fs_vfstype, fs->fs_spec,
|
|
||||||
fs->fs_file, init_flags, options,
|
|
||||||
fs->fs_mntops))
|
|
||||||
rval = 1;
|
|
||||||
}
|
|
||||||
} else if (fstab_style) {
|
|
||||||
for (i = 0; i < mntsize; i++) {
|
|
||||||
if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
|
|
||||||
continue;
|
|
||||||
putfsent(&mntbuf[i]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i = 0; i < mntsize; i++) {
|
|
||||||
if (checkvfsname(mntbuf[i].f_fstypename,
|
|
||||||
vfslist))
|
|
||||||
continue;
|
|
||||||
prmount(&mntbuf[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exit(rval);
|
|
||||||
case 1:
|
|
||||||
if (vfslist != NULL)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
if (init_flags & MNT_UPDATE) {
|
|
||||||
mntfromname = NULL;
|
|
||||||
have_fstab = 0;
|
|
||||||
if ((mntbuf = getmntpt(*argv)) == NULL)
|
|
||||||
errx(1, "not currently mounted %s", *argv);
|
|
||||||
/*
|
|
||||||
* Only get the mntflags from fstab if both mntpoint
|
|
||||||
* and mntspec are identical. Also handle the special
|
|
||||||
* case where just '/' is mounted and 'spec' is not
|
|
||||||
* identical with the one from fstab ('/dev' is missing
|
|
||||||
* in the spec-string at boot-time).
|
|
||||||
*/
|
|
||||||
if ((fs = getfsfile(mntbuf->f_mntonname)) != NULL) {
|
|
||||||
if (strcmp(fs->fs_spec,
|
|
||||||
mntbuf->f_mntfromname) == 0 &&
|
|
||||||
strcmp(fs->fs_file,
|
|
||||||
mntbuf->f_mntonname) == 0) {
|
|
||||||
have_fstab = 1;
|
|
||||||
mntfromname = mntbuf->f_mntfromname;
|
|
||||||
} else if (argv[0][0] == '/' &&
|
|
||||||
argv[0][1] == '\0') {
|
|
||||||
fs = getfsfile("/");
|
|
||||||
have_fstab = 1;
|
|
||||||
mntfromname = fs->fs_spec;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (have_fstab) {
|
|
||||||
options = update_options(options, fs->fs_mntops,
|
|
||||||
mntbuf->f_flags);
|
|
||||||
} else {
|
|
||||||
mntfromname = mntbuf->f_mntfromname;
|
|
||||||
options = update_options(options, NULL,
|
|
||||||
mntbuf->f_flags);
|
|
||||||
}
|
|
||||||
rval = mountfs(mntbuf->f_fstypename, mntfromname,
|
|
||||||
mntbuf->f_mntonname, init_flags, options, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
rmslashes(*argv, *argv);
|
|
||||||
if ((fs = getfsfile(*argv)) == NULL &&
|
|
||||||
(fs = getfsspec(*argv)) == NULL)
|
|
||||||
errx(1, "%s: unknown special file or file system",
|
|
||||||
*argv);
|
|
||||||
if (BADTYPE(fs->fs_type))
|
|
||||||
errx(1, "%s has unknown file system type",
|
|
||||||
*argv);
|
|
||||||
rval = mountfs(fs->fs_vfstype, fs->fs_spec, fs->fs_file,
|
|
||||||
init_flags, options, fs->fs_mntops);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
/*
|
|
||||||
* If -t flag has not been specified, the path cannot be
|
|
||||||
* found, spec contains either a ':' or a '@', and the
|
|
||||||
* spec is not a file with those characters, then assume
|
|
||||||
* that an NFS filesystem is being specified ala Sun.
|
|
||||||
*/
|
|
||||||
if (vfslist == NULL && strpbrk(argv[0], ":@") != NULL &&
|
|
||||||
access(argv[0], 0) == -1)
|
|
||||||
vfstype = "nfs";
|
|
||||||
rval = mountfs(vfstype,
|
|
||||||
argv[0], argv[1], init_flags, options, NULL);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the mount was successfully, and done by root, tell mountd the
|
|
||||||
* good news. Pid checks are probably unnecessary, but don't hurt.
|
|
||||||
*/
|
|
||||||
if (rval == 0 && getuid() == 0 &&
|
|
||||||
(mountdfp = fopen(_PATH_MOUNTDPID, "r")) != NULL) {
|
|
||||||
if (fscanf(mountdfp, "%d", &pid) == 1 &&
|
|
||||||
pid > 0 && kill(pid, SIGHUP) == -1 && errno != ESRCH)
|
|
||||||
err(1, "signal mountd");
|
|
||||||
(void)fclose(mountdfp);
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(rval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -440,8 +269,8 @@ mountfs(vfstype, spec, name, flags, options, mntopts)
|
|||||||
free(optbuf);
|
free(optbuf);
|
||||||
return (1);
|
return (1);
|
||||||
case 0: /* Child. */
|
case 0: /* Child. */
|
||||||
if (strcmp(vfstype, "ufs") == 0)
|
if (strcmp(vfstype, "ifs") == 0)
|
||||||
exit(mount_ufs(argc, (char * const *) argv));
|
exit(mount_ifs(argc, (char * const *) argv));
|
||||||
|
|
||||||
/* Go find an executable. */
|
/* Go find an executable. */
|
||||||
for (edir = edirs; *edir; edir++) {
|
for (edir = edirs; *edir; edir++) {
|
||||||
@ -688,10 +517,8 @@ void
|
|||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n",
|
||||||
"usage: mount [-dfpruvw] [-o options] [-t ufs | external_type] special node",
|
"usage: mount [-dfpruvw] [-o options] special node");
|
||||||
" mount [-adfpruvw] [-t ufs | external_type]",
|
|
||||||
" mount [-dfpruvw] special | node");
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static const char rcsid[] =
|
|||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
#include "mntopts.h"
|
#include "mntopts.h"
|
||||||
|
|
||||||
static void ufs_usage __P((void));
|
static void ifs_usage __P((void));
|
||||||
|
|
||||||
static struct mntopt mopts[] = {
|
static struct mntopt mopts[] = {
|
||||||
MOPT_STDOPTS,
|
MOPT_STDOPTS,
|
||||||
@ -71,7 +71,7 @@ static struct mntopt mopts[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
mount_ufs(argc, argv)
|
mount_ifs(argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char * const argv[];
|
char * const argv[];
|
||||||
{
|
{
|
||||||
@ -90,13 +90,13 @@ mount_ufs(argc, argv)
|
|||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
default:
|
default:
|
||||||
ufs_usage();
|
ifs_usage();
|
||||||
}
|
}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
ufs_usage();
|
ifs_usage();
|
||||||
|
|
||||||
args.fspec = argv[0]; /* The name of the device file. */
|
args.fspec = argv[0]; /* The name of the device file. */
|
||||||
fs_name = argv[1]; /* The mount point. */
|
fs_name = argv[1]; /* The mount point. */
|
||||||
@ -108,17 +108,17 @@ mount_ufs(argc, argv)
|
|||||||
else
|
else
|
||||||
args.export.ex_flags = 0;
|
args.export.ex_flags = 0;
|
||||||
|
|
||||||
error = getvfsbyname("ufs", &vfc);
|
error = getvfsbyname("ifs", &vfc);
|
||||||
if (error && vfsisloadable("ufs")) {
|
if (error && vfsisloadable("ifs")) {
|
||||||
if (vfsload("ufs")) {
|
if (vfsload("ifs")) {
|
||||||
warn("vfsload(ufs)");
|
warn("vfsload(ifs)");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
endvfsent(); /* flush old table */
|
endvfsent(); /* flush old table */
|
||||||
error = getvfsbyname("ufs", &vfc);
|
error = getvfsbyname("ifs", &vfc);
|
||||||
}
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
warnx("ufs filesystem is not available");
|
warnx("ifs filesystem is not available");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,8 +147,8 @@ mount_ufs(argc, argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ufs_usage()
|
ifs_usage()
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: mount_ufs [-o options] special node\n");
|
(void)fprintf(stderr, "usage: mount_ifs [-o options] special node\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
/*-
|
|
||||||
* Copyright (c) 1995
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
|
||||||
* must display the following acknowledgement:
|
|
||||||
* This product includes software developed by the University of
|
|
||||||
* California, Berkeley and its contributors.
|
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "@(#)vfslist.c 8.1 (Berkeley) 5/8/95";
|
|
||||||
#endif
|
|
||||||
static const char rcsid[] =
|
|
||||||
"$FreeBSD$";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <err.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "extern.h"
|
|
||||||
|
|
||||||
static int skipvfs;
|
|
||||||
|
|
||||||
int
|
|
||||||
checkvfsname(vfsname, vfslist)
|
|
||||||
const char *vfsname;
|
|
||||||
const char **vfslist;
|
|
||||||
{
|
|
||||||
|
|
||||||
if (vfslist == NULL)
|
|
||||||
return (0);
|
|
||||||
while (*vfslist != NULL) {
|
|
||||||
if (strcmp(vfsname, *vfslist) == 0)
|
|
||||||
return (skipvfs);
|
|
||||||
++vfslist;
|
|
||||||
}
|
|
||||||
return (!skipvfs);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char **
|
|
||||||
makevfslist(fslist)
|
|
||||||
char *fslist;
|
|
||||||
{
|
|
||||||
const char **av;
|
|
||||||
int i;
|
|
||||||
char *nextcp;
|
|
||||||
|
|
||||||
if (fslist == NULL)
|
|
||||||
return (NULL);
|
|
||||||
if (fslist[0] == 'n' && fslist[1] == 'o') {
|
|
||||||
fslist += 2;
|
|
||||||
skipvfs = 1;
|
|
||||||
}
|
|
||||||
for (i = 0, nextcp = fslist; *nextcp; nextcp++)
|
|
||||||
if (*nextcp == ',')
|
|
||||||
i++;
|
|
||||||
if ((av = malloc((size_t)(i + 2) * sizeof(char *))) == NULL) {
|
|
||||||
warnx("malloc failed");
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
nextcp = fslist;
|
|
||||||
i = 0;
|
|
||||||
av[i++] = nextcp;
|
|
||||||
while ((nextcp = strchr(nextcp, ',')) != NULL) {
|
|
||||||
*nextcp++ = '\0';
|
|
||||||
av[i++] = nextcp;
|
|
||||||
}
|
|
||||||
av[i++] = NULL;
|
|
||||||
return (av);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user