aboutsummaryrefslogtreecommitdiff
path: root/bin/df
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2020-11-13 16:47:42 +0000
committerMark Johnston <markj@FreeBSD.org>2020-11-13 16:47:42 +0000
commit1740c2dbb628ba657d5eb185cdd8fe20d959555f (patch)
tree6890e64927eb796d415da96ed186a57d1ed5be35 /bin/df
parentec26a84475bd5497a858b4a1e52e17a87582b2ea (diff)
downloadsrc-1740c2dbb628ba657d5eb185cdd8fe20d959555f.tar.gz
src-1740c2dbb628ba657d5eb185cdd8fe20d959555f.zip
df: Remove support for mounting devices
This was marked deprecated in r329092, over two and a half years ago. This functionality is also buggy per PR 237368. PR: 237368 Reviewed by: brooks, cem, emaste, imp Differential Revision: https://reviews.freebsd.org/D27197
Notes
Notes: svn path=/head/; revision=367642
Diffstat (limited to 'bin/df')
-rw-r--r--bin/df/Makefile3
-rw-r--r--bin/df/df.11
-rw-r--r--bin/df/df.c78
3 files changed, 5 insertions, 77 deletions
diff --git a/bin/df/Makefile b/bin/df/Makefile
index 6d36a370b02c..445a999a49a7 100644
--- a/bin/df/Makefile
+++ b/bin/df/Makefile
@@ -10,9 +10,6 @@ SRCS= df.c vfslist.c
CFLAGS+= -I${MOUNT}
-CFLAGS+= -DMOUNT_CHAR_DEVS
-SRCS+= getmntopts.c
-
LIBADD= xo util
.include <bsd.prog.mk>
diff --git a/bin/df/df.1 b/bin/df/df.1
index e618077cbf06..8949ab1c71b0 100644
--- a/bin/df/df.1
+++ b/bin/df/df.1
@@ -48,6 +48,7 @@ The
.Nm
utility
displays statistics about the amount of free disk space on the specified
+mounted
.Ar file system
or on the file system of which
.Ar file
diff --git a/bin/df/df.c b/bin/df/df.c
index ed7d319388cf..a0d43fca5789 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -52,16 +52,10 @@ __FBSDID("$FreeBSD$");
#include <sys/stat.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
-#ifdef MOUNT_CHAR_DEVS
-#include <ufs/ufs/ufsmount.h>
-#endif
#include <err.h>
#include <getopt.h>
#include <libutil.h>
#include <locale.h>
-#ifdef MOUNT_CHAR_DEVS
-#include <mntopts.h>
-#endif
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -106,9 +100,6 @@ imax(int a, int b)
static int aflag = 0, cflag, hflag, iflag, kflag, lflag = 0, nflag, Tflag;
static int thousands;
-#ifdef MOUNT_CHAR_DEVS
-static struct ufs_args mdev;
-#endif
static const struct option long_options[] =
{
@@ -123,21 +114,11 @@ main(int argc, char *argv[])
struct statfs statfsbuf, totalbuf;
struct maxwidths maxwidths;
struct statfs *mntbuf;
-#ifdef MOUNT_CHAR_DEVS
- struct iovec *iov = NULL;
-#endif
const char *fstype;
-#ifdef MOUNT_CHAR_DEVS
- char *mntpath;
- char errmsg[255] = {0};
-#endif
char *mntpt;
const char **vfslist;
int i, mntsize;
int ch, rv;
-#ifdef MOUNT_CHAR_DEVS
- int iovlen = 0;
-#endif
fstype = "ufs";
(void)setlocale(LC_ALL, "");
@@ -255,66 +236,15 @@ main(int argc, char *argv[])
continue;
}
} else if (S_ISCHR(stbuf.st_mode)) {
- if ((mntpt = getmntpt(*argv)) == NULL) {
-#ifdef MOUNT_CHAR_DEVS
- xo_warnx(
- "df on unmounted devices is deprecated");
- mdev.fspec = *argv;
- mntpath = strdup("/tmp/df.XXXXXX");
- if (mntpath == NULL) {
- xo_warn("strdup failed");
- rv = 1;
- continue;
- }
- mntpt = mkdtemp(mntpath);
- if (mntpt == NULL) {
- xo_warn("mkdtemp(\"%s\") failed", mntpath);
- rv = 1;
- free(mntpath);
- continue;
- }
- if (iov != NULL)
- free_iovec(&iov, &iovlen);
- build_iovec_argf(&iov, &iovlen, "fstype", "%s",
- fstype);
- build_iovec_argf(&iov, &iovlen, "fspath", "%s",
- mntpath);
- build_iovec_argf(&iov, &iovlen, "from", "%s",
- *argv);
- build_iovec(&iov, &iovlen, "errmsg", errmsg,
- sizeof(errmsg));
- if (nmount(iov, iovlen,
- MNT_RDONLY|MNT_NOEXEC) < 0) {
- if (errmsg[0])
- xo_warn("%s: %s", *argv,
- errmsg);
- else
- xo_warn("%s", *argv);
- rv = 1;
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
- } else if (statfs(mntpt, &statfsbuf) == 0) {
- statfsbuf.f_mntonname[0] = '\0';
- prtstat(&statfsbuf, &maxwidths);
- if (cflag)
- addstat(&totalbuf, &statfsbuf);
- } else {
- xo_warn("%s", *argv);
- rv = 1;
- }
- (void)unmount(mntpt, 0);
- (void)rmdir(mntpt);
- free(mntpath);
- continue;
-#else
+ mntpt = getmntpt(*argv);
+ if (mntpt == NULL) {
xo_warnx("%s: not mounted", *argv);
rv = 1;
continue;
-#endif
}
- } else
+ } else {
mntpt = *argv;
+ }
/*
* Statfs does not take a `wait' flag, so we cannot