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 %5d %s\n"
19 #define HDRFMT "%-32.32s %5.5s %s\n"
20 #define DASHES "-------------------------------- ----- ---------------\n"
22 static const char *fmt_flags(int);
25 main(int argc, char **argv)
29 struct ovfsconf *ovfcp;
34 printf(HDRFMT, "Filesystem", "Refs", "Flags");
35 fputs(DASHES, stdout);
38 for(; argc; argc--, argv++) {
39 if (getvfsbyname(*argv, &vfc) == 0) {
40 printf(FMT, vfc.vfc_name, vfc.vfc_refcount, fmt_flags(vfc.vfc_flags));
42 warnx("VFS %s unknown or not loaded", *argv);
47 while ((ovfcp = getvfsent()) != NULL) {
48 printf(FMT, ovfcp->vfc_name, ovfcp->vfc_refcount,
49 fmt_flags(ovfcp->vfc_flags));
61 * NB: if you add new flags, don't forget to add them here vvvvvv too.
63 static char buf[sizeof
64 "static, network, read-only, synthetic, loopback, unicode"];
69 if(flags & VFCF_STATIC) {
70 if(comma++) strcat(buf, ", ");
71 strcat(buf, "static");
74 if(flags & VFCF_NETWORK) {
75 if(comma++) strcat(buf, ", ");
76 strcat(buf, "network");
79 if(flags & VFCF_READONLY) {
80 if(comma++) strcat(buf, ", ");
81 strcat(buf, "read-only");
84 if(flags & VFCF_SYNTHETIC) {
85 if(comma++) strcat(buf, ", ");
86 strcat(buf, "synthetic");
89 if(flags & VFCF_LOOPBACK) {
90 if(comma++) strcat(buf, ", ");
91 strcat(buf, "loopback");
94 if(flags & VFCF_UNICODE) {
95 if(comma++) strcat(buf, ", ");
96 strcat(buf, "unicode");