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