diff options
author | Maxime Henrion <mux@FreeBSD.org> | 2002-08-10 20:19:04 +0000 |
---|---|---|
committer | Maxime Henrion <mux@FreeBSD.org> | 2002-08-10 20:19:04 +0000 |
commit | 5965373e69ca208cedd8ede9716ef0d58e6c3434 (patch) | |
tree | f2655b26537a3fa42106a5f0b342f24c8d6e679d /usr.bin/lsvfs | |
parent | 306e6b83936d0560c96775d3dbf0767138825040 (diff) | |
download | src-5965373e69ca208cedd8ede9716ef0d58e6c3434.tar.gz src-5965373e69ca208cedd8ede9716ef0d58e6c3434.zip |
- 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.
Notes
Notes:
svn path=/head/; revision=101651
Diffstat (limited to 'usr.bin/lsvfs')
-rw-r--r-- | usr.bin/lsvfs/Makefile | 1 | ||||
-rw-r--r-- | usr.bin/lsvfs/lsvfs.c | 28 |
2 files changed, 18 insertions, 11 deletions
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; } |