From 88ea9c97afa0a1c0115d7a57cac2c5ed92a2a7da Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 28 Apr 2023 07:32:00 -0500 Subject: [PATCH] Update fs_type_name() with linux/magic.h constants, trying to correct names for "mount -t TYPE" modules. This is probably going to need another pass. The 6.3 kernel's magic.h is full of dead cruft (the last user of NCP_SUPER_MAGIC went away in kernel commit bd32895c750b, SMB_SUPER_MAGIC in 939cbe5af5fb, and USBDEVICE_SUPER_MAGIC in fb28d58b72aa, all more than 10 years ago). And several filesystems use constants that aren't in that header. Plus the name of the header and the .name string in the fstype passed to register_filesystem() which mount -t recognizes are only coincidentally related, although there's ALSO the problem that different filesystems (such as ext2/ext3/ext4, or msdos/vfat) use the same constant so aren't readily distinguishable at runtime without looking in /proc/mounts... --- lib/portability.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/portability.c b/lib/portability.c index e55becb4..5c791596 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -556,15 +556,23 @@ char *fs_type_name(struct statfs *statfs) #else char *s = NULL; 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"}, + {0xADF5, "adfs"}, {0xADFF, "affs"}, {0x5346414F, "afs"}, {0x187, "autofs"}, + {0x1BADFACE, "bfs"}, {0x6C6F6F70, "binder"}, {0x9123683E, "btrfs"}, + {0xFF534D42, "cifs"}, {0x27E0EB, "cgroup"}, {0x63677270, "cgroup2"}, + {0x73757245, "coda"}, {0x28cd3d45, "cramfs"}, {0x1CD1, "devpts"}, + {0xF15F, "ecryptfs"}, {0x414A53, "efs"}, {0xE0F5E1E2, "erofs"}, + {0x2011BAB0, "exfat"}, {0x137D, "ext"}, {0xEF51, "ext2"}, + {0xEF53, "ext3/4"}, {0xF2F52010, "f2fs"}, {0xBAD1DEA, "futexfs"}, + {0x00C0FFEE, "hostfs"}, {0xF995E849, "hpfs"}, + {0x9660, "isofs"}, {0x72B6, "jffs2"}, {0x3153464a, "jfs"}, + {0x137F, "minix"}, {0x2468, "minix2"}, {0x4D5A, "minix3"}, + {0x4D44, "vfat"}, {0x6969, "nfs"}, {0x3434, "nilfs2"}, + {0x5346544E, "ntfs"}, {0x7461636F, "ocfs2"}, {0x9FA1, "openpromfs"}, + {0x794C7630, "overlay"}, {0x9FA0, "proc"}, {0x002f, "qnx4"}, + {0x68191122, "qnx6"}, {0x7275, "romfs"}, {0x7655821, "resctrl"}, {0x534F434B, "sockfs"}, {0x62656572, "sysfs"}, {0x517B, "smb"}, - {0x4d44, "msdos"}, {0x4006, "fat"}, {0x43415d53, "smackfs"}, - {0x73717368, "squashfs"}, {0xF2F52010, "f2fs"}, {0xE0F5E1E2, "erofs"}, - {0x2011BAB0, "exfat"}, + {0x01021994, "tmpfs"}, {0x15013346, "udf"}, {0x43415d53, "smackfs"}, + {0x73717368, "squashfs"}, {0xabba1974, "xenfs"}, {0x58465342, "xfs"} }; int i; -- 2.39.2