aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/find/function.c2
-rw-r--r--usr.bin/lsvfs/Makefile1
-rw-r--r--usr.bin/lsvfs/lsvfs.c28
3 files changed, 19 insertions, 12 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index 66f92b12b9c8..31e1a651767b 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -834,7 +834,7 @@ c_fstype(option, argvp)
{
char *fsname;
PLAN *new;
- struct vfsconf vfc;
+ struct xvfsconf vfc;
fsname = nextarg(option, argvp);
ftsoptions &= ~FTS_NOSTAT;
diff --git a/usr.bin/lsvfs/Makefile b/usr.bin/lsvfs/Makefile
index 324b6fd0746d..0c33583257cf 100644
--- a/usr.bin/lsvfs/Makefile
+++ b/usr.bin/lsvfs/Makefile
@@ -1,5 +1,6 @@
# $FreeBSD$
PROG= lsvfs
+WARNS?= 6
.include <bsd.prog.mk>
diff --git a/usr.bin/lsvfs/lsvfs.c b/usr.bin/lsvfs/lsvfs.c
index 909636e9808e..6ea7f1fb9c49 100644
--- a/usr.bin/lsvfs/lsvfs.c
+++ b/usr.bin/lsvfs/lsvfs.c
@@ -8,13 +8,12 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#define _NEW_VFSCONF
-
#include <sys/param.h>
#include <sys/mount.h>
#include <err.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#define FMT "%-32.32s %5d %s\n"
@@ -26,13 +25,11 @@ static const char *fmt_flags(int);
int
main(int argc, char **argv)
{
- int rv = 0;
- struct vfsconf vfc;
- struct ovfsconf *ovfcp;
+ int cnt, rv = 0, i;
+ struct xvfsconf vfc, *xvfsp;
+ size_t buflen;
argc--, argv++;
- setvfsent(1);
-
printf(HDRFMT, "Filesystem", "Refs", "Flags");
fputs(DASHES, stdout);
@@ -46,13 +43,22 @@ main(int argc, char **argv)
}
}
} else {
- while ((ovfcp = getvfsent()) != NULL) {
- printf(FMT, ovfcp->vfc_name, ovfcp->vfc_refcount,
- fmt_flags(ovfcp->vfc_flags));
+ if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0)
+ err(1, "sysctl(vfs.conflist)");
+ xvfsp = malloc(buflen);
+ if (xvfsp == NULL)
+ errx(1, "malloc failed");
+ if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0)
+ err(1, "sysctl(vfs.conflist)");
+ cnt = buflen / sizeof(struct xvfsconf);
+
+ for (i = 0; i < cnt; i++) {
+ printf(FMT, xvfsp[i].vfc_name, xvfsp[i].vfc_refcount,
+ fmt_flags(xvfsp[i].vfc_flags));
}
+ free(xvfsp);
}
- endvfsent();
return rv;
}