summaryrefslogtreecommitdiffstats
path: root/bin/df
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 /bin/df
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 'bin/df')
-rw-r--r--bin/df/df.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/bin/df/df.c b/bin/df/df.c
index b91dc66..9bb5204 100644
--- a/bin/df/df.c
+++ b/bin/df/df.c
@@ -491,31 +491,40 @@ static char *
makenetvfslist(void)
{
char *str, *strptr, **listptr;
- int mib[3], maxvfsconf, cnt=0, i;
- size_t miblen;
- struct ovfsconf *ptr;
-
- mib[0] = CTL_VFS; mib[1] = VFS_GENERIC; mib[2] = VFS_MAXTYPENUM;
- miblen=sizeof(maxvfsconf);
- if (sysctl(mib, (unsigned int)(sizeof(mib) / sizeof(mib[0])),
- &maxvfsconf, &miblen, NULL, 0)) {
- warnx("sysctl failed");
+ struct xvfsconf *xvfsp;
+ size_t buflen;
+ int cnt, i, maxvfsconf;
+
+ if (sysctlbyname("vfs.conflist", NULL, &buflen, NULL, 0) < 0) {
+ warn("sysctl(vfs.conflist)");
+ return (NULL);
+ }
+ xvfsp = malloc(buflen);
+ if (xvfsp == NULL) {
+ warnx("malloc failed");
return (NULL);
}
+ if (sysctlbyname("vfs.conflist", xvfsp, &buflen, NULL, 0) < 0) {
+ warn("sysctl(vfs.conflist)");
+ return (NULL);
+ }
+ maxvfsconf = buflen / sizeof(struct xvfsconf);
if ((listptr = malloc(sizeof(char*) * maxvfsconf)) == NULL) {
warnx("malloc failed");
return (NULL);
}
- for (ptr = getvfsent(); ptr; ptr = getvfsent())
- if (ptr->vfc_flags & VFCF_NETWORK) {
- listptr[cnt++] = strdup(ptr->vfc_name);
+ for (cnt = 0, i = 0; i < maxvfsconf; i++) {
+ if (xvfsp->vfc_flags & VFCF_NETWORK) {
+ listptr[cnt++] = strdup(xvfsp->vfc_name);
if (listptr[cnt-1] == NULL) {
warnx("malloc failed");
return (NULL);
}
}
+ xvfsp++;
+ }
if (cnt == 0 ||
(str = malloc(sizeof(char) * (32 * cnt + cnt + 2))) == NULL) {
OpenPOWER on IntegriCloud