1 /* 2 * lsvfs - lsit loaded VFSes 3 * Garrett A. Wollman, September 1994 4 * This file is in the public domain. 5 */ 6 7 #include <sys/types.h> 8 #include <sys/param.h> 9 #include <sys/mount.h> 10 #include <stdio.h> 11 #include <err.h> 12 13 #define FMT "%-32.32s %5d %5d %5d\n" 14 #define HDRFMT "%-32.32s %5.5s %5.5s %5.5s\n" 15 #define DASHES "-------------------------------- ----- ----- -----\n" 16 17 int 18 main(int argc, char **argv) 19 { 20 int rv = 0; 21 struct vfsconf *vfc; 22 argc--, argv++; 23 24 setvfsent(1); 25 26 printf(HDRFMT, "Filesystem", "Index", "Refs", "Flags"); 27 fputs(DASHES, stdout); 28 29 if(argc) { 30 for(; argc; argc--, argv++) { 31 vfc = getvfsbyname(*argv); 32 if(vfc) { 33 printf(FMT, vfc->vfc_name, vfc->vfc_index, vfc->vfc_refcount, 34 vfc->vfc_flags); 35 } else { 36 warnx("VFS %s unknown or not loaded", *argv); 37 rv++; 38 } 39 } 40 } else { 41 while(vfc = getvfsent()) { 42 printf(FMT, vfc->vfc_name, vfc->vfc_index, vfc->vfc_refcount, 43 vfc->vfc_flags); 44 } 45 } 46 47 endvfsent(); 48 return rv; 49 } 50 51