2 * lsvfs - list loaded VFSes
3 * Garrett A. Wollman, September 1994
4 * This file is in the public domain.
6 * $FreeBSD: src/usr.bin/lsvfs/lsvfs.c,v 1.13.2.1 2001/07/30 09:59:16 dd Exp $
11 #include <sys/param.h>
12 #include <sys/mount.h>
18 #define FMT "%-32.32s 0x%08x %5d %s\n"
19 #define HDRFMT "%-32.32s %10s %5.5s %s\n"
20 #define DASHES "-------------------------------- " \
21 "---------- ----- ---------------\n"
23 static struct flaglist {
25 const char str[32]; /* must be longer than the longest one. */
27 { .flag = VFCF_STATIC, .str = "static", },
28 { .flag = VFCF_NETWORK, .str = "network", },
29 { .flag = VFCF_READONLY, .str = "read-only", },
30 { .flag = VFCF_SYNTHETIC, .str = "synthetic", },
31 { .flag = VFCF_LOOPBACK, .str = "loopback", },
32 { .flag = VFCF_UNICODE, .str = "unicode", },
35 static const char *fmt_flags(int);
38 main(int argc, char **argv)
42 struct ovfsconf *ovfcp;
47 printf(HDRFMT, "Filesystem", "Num", "Refs", "Flags");
48 fputs(DASHES, stdout);
51 for(; argc; argc--, argv++) {
52 if (getvfsbyname(*argv, &vfc) == 0) {
53 printf(FMT, vfc.vfc_name, vfc.vfc_typenum, vfc.vfc_refcount,
54 fmt_flags(vfc.vfc_flags));
56 warnx("VFS %s unknown or not loaded", *argv);
61 while ((ovfcp = getvfsent()) != NULL) {
62 if (getvfsbyname(ovfcp->vfc_name, &vfc) == 0) {
63 printf(FMT, vfc.vfc_name, vfc.vfc_typenum, vfc.vfc_refcount,
64 fmt_flags(vfc.vfc_flags));
66 warnx("VFS %s unknown or not loaded", *argv);
79 static char buf[sizeof(struct flaglist) * sizeof(fl)];
83 for (i = 0; i < (int)nitems(fl); i++)
84 if (flags & fl[i].flag) {
85 strlcat(buf, fl[i].str, sizeof(buf));
86 strlcat(buf, ", ", sizeof(buf));
89 buf[strlen(buf) - 2] = '\0';