+ lastused = loc;
+}
+
+/*
+ * Initialize the set of filesystem names
+ */
+vfsinit()
+{
+ int mib[4], maxtypenum, cnt, loc, size;
+ struct vfsconf vfc;
+ size_t buflen;
+
+ if (secondlevel[CTL_VFS].list != 0)
+ return;
+ mib[0] = CTL_VFS;
+ mib[1] = VFS_GENERIC;
+ mib[2] = VFS_MAXTYPENUM;
+ buflen = 4;
+ if (sysctl(mib, 3, &maxtypenum, &buflen, (void *)0, (size_t)0) < 0)
+ return;
+ if ((vfsname = malloc(maxtypenum * sizeof(*vfsname))) == 0)
+ return;
+ memset(vfsname, 0, maxtypenum * sizeof(*vfsname));
+ mib[2] = VFS_CONF;
+ buflen = sizeof vfc;
+ for (loc = lastused, cnt = 0; cnt < maxtypenum; cnt++) {
+ mib[3] = cnt;
+ if (sysctl(mib, 4, &vfc, &buflen, (void *)0, (size_t)0) < 0) {
+ if (errno == EOPNOTSUPP)
+ continue;
+ perror("vfsinit");
+ free(vfsname);
+ return;
+ }
+ strcat(&names[loc], vfc.vfc_name);
+ vfsname[cnt].ctl_name = &names[loc];
+ vfsname[cnt].ctl_type = CTLTYPE_INT;
+ size = strlen(vfc.vfc_name) + 1;
+ loc += size;
+ }
+ lastused = loc;
+ secondlevel[CTL_VFS].list = vfsname;
+ secondlevel[CTL_VFS].size = maxtypenum;
+ return;