From 7eaf5d674f32a0301c44e2f0f433aa7144ad1479 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 5 Dec 2019 14:53:43 -0800 Subject: stat: fix filesystem type on macOS. (Also show unknown values on Linux in hex rather than just "unknown".) --- toys/other/stat.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'toys/other/stat.c') diff --git a/toys/other/stat.c b/toys/other/stat.c index d99331b7..08b278f8 100644 --- a/toys/other/stat.c +++ b/toys/other/stat.c @@ -150,24 +150,8 @@ static void print_statfs(char type) { out('d', statfs->f_namelen); #endif } else if (type == 't') out('x', statfs->f_type); - else if (type == 'T') { - char *s = "unknown"; - struct {unsigned num; char *name;} nn[] = { - {0xADFF, "affs"}, {0x5346544e, "ntfs"}, {0x1Cd1, "devpts"}, - {0x137D, "ext"}, {0xEF51, "ext2"}, {0xEF53, "ext3"}, - {0x1BADFACE, "bfs"}, {0x9123683E, "btrfs"}, {0x28cd3d45, "cramfs"}, - {0x3153464a, "jfs"}, {0x7275, "romfs"}, {0x01021994, "tmpfs"}, - {0x3434, "nilfs"}, {0x6969, "nfs"}, {0x9fa0, "proc"}, - {0x534F434B, "sockfs"}, {0x62656572, "sysfs"}, {0x517B, "smb"}, - {0x4d44, "msdos"}, {0x4006, "fat"}, {0x43415d53, "smackfs"}, - {0x73717368, "squashfs"} - }; - int i; - - for (i=0; if_type) s = nn[i].name; - strout(s); - } else if (type == 'i') { + else if (type == 'T') strout(fs_type_name(statfs)); + else if (type == 'i') { int *val = (int *) &statfs->f_fsid; char buf[32]; -- cgit v1.2.3