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 $
12 #include <sys/param.h>
13 #include <sys/mount.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);
26 main(int argc
, char **argv
)
30 struct ovfsconf
*ovfcp
;
35 printf(HDRFMT
, "Filesystem", "Refs", "Flags");
36 fputs(DASHES
, stdout
);
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
));
43 warnx("VFS %s unknown or not loaded", *argv
);
48 while ((ovfcp
= getvfsent()) != NULL
) {
49 printf(FMT
, ovfcp
->vfc_name
, ovfcp
->vfc_refcount
,
50 fmt_flags(ovfcp
->vfc_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"];
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");