Page MenuHomeFreeBSD

D33748.id100956.diff
No OneTemporary

D33748.id100956.diff

diff --git a/bin/df/df.c b/bin/df/df.c
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -88,7 +88,7 @@
static void prthumanval(const char *, int64_t);
static intmax_t fsbtoblk(int64_t, uint64_t, u_long);
static void prtstat(struct statfs *, struct maxwidths *);
-static size_t regetmntinfo(struct statfs **, long, const char **);
+static size_t regetmntinfo(struct statfs **, long, const char **, const char **);
static void update_maxwidths(struct maxwidths *, const struct statfs *);
static void usage(void);
@@ -115,7 +115,7 @@
struct maxwidths maxwidths;
struct statfs *mntbuf;
char *mntpt;
- const char **vfslist;
+ const char **vfslist_l, **vfslist_t;
int i, mntsize;
int ch, rv;
@@ -124,7 +124,8 @@
memset(&totalbuf, 0, sizeof(totalbuf));
totalbuf.f_bsize = DEV_BSIZE;
strlcpy(totalbuf.f_mntfromname, "total", MNAMELEN);
- vfslist = NULL;
+ vfslist_l = NULL;
+ vfslist_t = NULL;
argc = xo_parse_args(argc, argv);
if (argc < 0)
@@ -175,9 +176,7 @@
/* Ignore duplicate -l */
if (lflag)
break;
- if (vfslist != NULL)
- xo_errx(1, "-l and -t are mutually exclusive.");
- vfslist = makevfslist(makenetvfslist());
+ vfslist_l = makevfslist(makenetvfslist());
lflag = 1;
break;
case 'm':
@@ -188,11 +187,9 @@
nflag = 1;
break;
case 't':
- if (lflag)
- xo_errx(1, "-l and -t are mutually exclusive.");
if (vfslist != NULL)
xo_errx(1, "only one -t option may be specified");
- vfslist = makevfslist(optarg);
+ vfslist_t = makevfslist(optarg);
break;
case 'T':
Tflag = 1;
@@ -211,7 +208,7 @@
if (!*argv) {
/* everything (modulo -t) */
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
- mntsize = regetmntinfo(&mntbuf, mntsize, vfslist);
+ mntsize = regetmntinfo(&mntbuf, mntsize, vfslist_l, vfslist_t);
} else {
/* just the filesystems specified on the command line */
mntbuf = malloc(argc * sizeof(*mntbuf));
@@ -259,7 +256,8 @@
* list a mount point that does not match the other args
* we've been given (-l, -t, etc.).
*/
- if (checkvfsname(statfsbuf.f_fstypename, vfslist)) {
+ if (checkvfsname(statfsbuf.f_fstypename, vfslist_l) ||
+ checkvfsname(statfsbuf.f_fstypename, vfslist_t)) {
rv = 1;
continue;
}
@@ -309,21 +307,24 @@
/*
* Make a pass over the file system info in ``mntbuf'' filtering out
- * file system types not in vfslist and possibly re-stating to get
+ * file system types not in vfslist_{l,t} and possibly re-stating to get
* current (not cached) info. Returns the new count of valid statfs bufs.
*/
static size_t
-regetmntinfo(struct statfs **mntbufp, long mntsize, const char **vfslist)
+regetmntinfo(struct statfs **mntbufp, long mntsize, const char **vfslist_l,
+ const char **vfslist_t)
{
int error, i, j;
struct statfs *mntbuf;
- if (vfslist == NULL)
+ if (vfslist_l == NULL && vfslist_t == NULL)
return (nflag ? mntsize : getmntinfo(mntbufp, MNT_WAIT));
mntbuf = *mntbufp;
for (j = 0, i = 0; i < mntsize; i++) {
- if (checkvfsname(mntbuf[i].f_fstypename, vfslist))
+ if (vfslist_l && checkvfsname(mntbuf[i].f_fstypename, vfslist_l))
+ continue;
+ if (vfslist_t && checkvfsname(mntbuf[i].f_fstypename, vfslist_t))
continue;
/*
* XXX statfs(2) can fail for various reasons. It may be

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 16, 4:31 AM (14 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16669148
Default Alt Text
D33748.id100956.diff (3 KB)

Event Timeline