]>
git.cameronkatri.com Git - apple_cmds.git/blob - adv_cmds/lsvfs/lsvfs.c
2 * Copyright (c) 1998-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #include <sys/mount.h>
24 #include <sys/types.h>
25 #include <sys/sysctl.h>
32 #define FMT "%-32.32s %5d %s\n"
33 #define HDRFMT "%-32.32s %5.5s %s\n"
34 #define DASHES "-------------------------------- ----- ---------------\n"
36 static const char *fmt_flags(int flags
);
39 main(int argc
, char *argv
[])
45 printf(HDRFMT
, "Filesystem", "Refs", "Flags");
46 fputs(DASHES
, stdout
);
49 for (x
= 1; x
< argc
; x
++)
50 if (getvfsbyname(argv
[x
], &vfc
) == 0)
51 printf(FMT
, vfc
.vfc_name
, vfc
.vfc_refcount
,
52 fmt_flags(vfc
.vfc_flags
));
54 warnx("VFS %s unknown or not loaded", argv
[x
]);
58 mib
[2] = VFS_MAXTYPENUM
;
60 if (sysctl(mib
, 3, &max
, &len
, NULL
, 0) != 0)
65 for (x
= 0; x
< max
; x
++) {
67 if (sysctl(mib
, 4, &vfc
, &len
, NULL
, 0) != 0) {
71 printf(FMT
, vfc
.vfc_name
, vfc
.vfc_refcount
,
72 fmt_flags(vfc
.vfc_flags
));
83 static char buf
[sizeof "local, dovolfs"];
88 if(flags
& MNT_LOCAL
) {
89 if(comma
++) strcat(buf
, ", ");
93 if(flags
& MNT_DOVOLFS
) {
94 if(comma
++) strcat(buf
, ", ");
95 strcat(buf
, "dovolfs");