Nuke unused macro and comment
[dragonfly.git] / usr.bin / lsvfs / lsvfs.c
blob687f33967cba46bd3439acaf816593cc37d7b267
1 /*
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 $
7 * $DragonFly: src/usr.bin/lsvfs/lsvfs.c,v 1.2 2003/06/17 04:29:28 dillon Exp $
8 */
10 #define _NEW_VFSCONF
12 #include <sys/param.h>
13 #include <sys/mount.h>
15 #include <err.h>
16 #include <stdio.h>
17 #include <string.h>
19 #define FMT "%-32.32s %5d %s\n"
20 #define HDRFMT "%-32.32s %5.5s %s\n"
21 #define DASHES "-------------------------------- ----- ---------------\n"
23 static const char *fmt_flags(int);
25 int
26 main(int argc, char **argv)
28 int rv = 0;
29 struct vfsconf vfc;
30 struct ovfsconf *ovfcp;
31 argc--, argv++;
33 setvfsent(1);
35 printf(HDRFMT, "Filesystem", "Refs", "Flags");
36 fputs(DASHES, stdout);
38 if(argc) {
39 for(; argc; argc--, argv++) {
40 if (getvfsbyname(*argv, &vfc) == 0) {
41 printf(FMT, vfc.vfc_name, vfc.vfc_refcount, fmt_flags(vfc.vfc_flags));
42 } else {
43 warnx("VFS %s unknown or not loaded", *argv);
44 rv++;
47 } else {
48 while ((ovfcp = getvfsent()) != NULL) {
49 printf(FMT, ovfcp->vfc_name, ovfcp->vfc_refcount,
50 fmt_flags(ovfcp->vfc_flags));
54 endvfsent();
55 return rv;
58 static const char *
59 fmt_flags(int flags)
62 * NB: if you add new flags, don't forget to add them here vvvvvv too.
64 static char buf[sizeof
65 "static, network, read-only, synthetic, loopback, unicode"];
66 int comma = 0;
68 buf[0] = '\0';
70 if(flags & VFCF_STATIC) {
71 if(comma++) strcat(buf, ", ");
72 strcat(buf, "static");
75 if(flags & VFCF_NETWORK) {
76 if(comma++) strcat(buf, ", ");
77 strcat(buf, "network");
80 if(flags & VFCF_READONLY) {
81 if(comma++) strcat(buf, ", ");
82 strcat(buf, "read-only");
85 if(flags & VFCF_SYNTHETIC) {
86 if(comma++) strcat(buf, ", ");
87 strcat(buf, "synthetic");
90 if(flags & VFCF_LOOPBACK) {
91 if(comma++) strcat(buf, ", ");
92 strcat(buf, "loopback");
95 if(flags & VFCF_UNICODE) {
96 if(comma++) strcat(buf, ", ");
97 strcat(buf, "unicode");
100 return buf;