aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/stat.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/toys/other/stat.c b/toys/other/stat.c
index d6db44dd..d43a8393 100644
--- a/toys/other/stat.c
+++ b/toys/other/stat.c
@@ -29,7 +29,7 @@ config STAT
%a Available blocks |%b Total blocks |%c Total inodes
%d Free inodes |%f Free blocks |%i File system ID
%l Max filename length |%n File name |%s Fragment size
- %S Best transfer size |%t File system type
+ %S Best transfer size |%t Filesystem type |%T Filesystem type name
*/
#define FOR_stat
@@ -113,7 +113,24 @@ static void print_statfs(char type) {
else if (type == 'f') xprintf("%llu", statfs->f_bfree);
else if (type == 'l') xprintf("%ld", statfs->f_namelen);
else if (type == 't') xprintf("%lx", statfs->f_type);
- else if (type == 'i')
+ 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; i<ARRAY_LEN(nn); i++)
+ if (nn[i].num == statfs->f_type) s = nn[i].name;
+ xprintf(s);
+ } else if (type == 'i')
xprintf("%08x%08x", statfs->f_fsid.__val[0], statfs->f_fsid.__val[1]);
else if (type == 's') xprintf("%d", statfs->f_frsize);
else if (type == 'S') xprintf("%d", statfs->f_bsize);