Put the undocumented df feature of mounting filesystems from device nodes

under an ifdef.  Leave enabled.

Reviewed by:	cem
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D8513
This commit is contained in:
Brooks Davis 2016-12-14 21:11:42 +00:00
parent e61e40a204
commit 176d3efd2b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310088
2 changed files with 11 additions and 1 deletions

View File

@ -9,6 +9,7 @@ PROG= df
SRCS= df.c vfslist.c SRCS= df.c vfslist.c
CFLAGS+= -I${MOUNT} CFLAGS+= -I${MOUNT}
CFLAGS+= -DMOUNT_CHAR_DEVS
LIBADD= xo util LIBADD= xo util

View File

@ -50,7 +50,9 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/sysctl.h> #include <sys/sysctl.h>
#ifdef MOUNT_CHAR_DEVS
#include <ufs/ufs/ufsmount.h> #include <ufs/ufs/ufsmount.h>
#endif
#include <err.h> #include <err.h>
#include <libutil.h> #include <libutil.h>
#include <locale.h> #include <locale.h>
@ -98,7 +100,9 @@ imax(int a, int b)
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag; static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag;
static int thousands; static int thousands;
#ifdef MOUNT_CHAR_DEVS
static struct ufs_args mdev; static struct ufs_args mdev;
#endif
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -108,7 +112,10 @@ main(int argc, char *argv[])
struct maxwidths maxwidths; struct maxwidths maxwidths;
struct statfs *mntbuf; struct statfs *mntbuf;
const char *fstype; const char *fstype;
char *mntpath, *mntpt; #ifdef MOUNT_CHAR_DEVS
char *mntpath;
#endif
char *mntpt;
const char **vfslist; const char **vfslist;
int i, mntsize; int i, mntsize;
int ch, rv; int ch, rv;
@ -227,6 +234,7 @@ main(int argc, char *argv[])
rv = 1; rv = 1;
continue; continue;
} }
#ifdef MOUNT_CHAR_DEVS
} else if (S_ISCHR(stbuf.st_mode)) { } else if (S_ISCHR(stbuf.st_mode)) {
if ((mntpt = getmntpt(*argv)) == NULL) { if ((mntpt = getmntpt(*argv)) == NULL) {
mdev.fspec = *argv; mdev.fspec = *argv;
@ -264,6 +272,7 @@ main(int argc, char *argv[])
free(mntpath); free(mntpath);
continue; continue;
} }
#endif
} else } else
mntpt = *argv; mntpt = *argv;