summaryrefslogtreecommitdiffstats
path: root/usr.bin/lsvfs
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2002-08-10 20:19:04 +0000
committermux <mux@FreeBSD.org>2002-08-10 20:19:04 +0000
commitf43070c32510080cd90cfad7384d00f798c8d852 (patch)
treef2655b26537a3fa42106a5f0b342f24c8d6e679d /usr.bin/lsvfs
parent120b32fbcc3d50570076359500df08aac80318b6 (diff)
downloadFreeBSD-src-f43070c32510080cd90cfad7384d00f798c8d852.zip
FreeBSD-src-f43070c32510080cd90cfad7384d00f798c8d852.tar.gz
- Introduce a new struct xvfsconf, the userland version of struct vfsconf.
- Make getvfsbyname() take a struct xvfsconf *. - Convert several consumers of getvfsbyname() to use struct xvfsconf. - Correct the getvfsbyname.3 manpage. - Create a new vfs.conflist sysctl to dump all the struct xvfsconf in the kernel, and rewrite getvfsbyname() to use this instead of the weird existing API. - Convert some {set,get,end}vfsent() consumers to use the new vfs.conflist sysctl. - Convert a vfsload() call in nfsiod.c to kldload() and remove the useless vfsisloadable() and endvfsent() calls. - Add a warning printf() in vfs_sysctl() to tell people they are using an old userland. After these changes, it's possible to modify struct vfsconf without breaking the binary compatibility. Please note that these changes don't break this compatibility either. When bp will have updated mount_smbfs(8) with the patch I sent him, there will be no more consumers of the {set,get,end}vfsent(), vfsisloadable() and vfsload() API, and I will promptly delete it.
Diffstat (limited to 'usr.bin/lsvfs')
-rw-r--r--usr.bin/lsvfs/Makefile1
-rw-r--r--usr.bin/lsvfs/lsvfs.c28
2 files changed, 18 insertions, 11 deletions
diff --git a/usr.bin/lsvfs/Makefile b/usr.bin/lsvfs/Makefile
index 324b6fd..0c33583 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 909636e..6ea7f1f 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;
}
OpenPOWER on IntegriCloud