diff options
author | Jim Meyering <jim@meyering.net> | 2007-08-27 23:46:49 +0200 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2007-08-27 23:47:45 +0200 |
commit | 505eee2f38169d5f3ae3fd2a71a6c78c53030b64 (patch) | |
tree | 234deb0c7dcaeda6e0ac7455e221ce3cb1637e98 | |
parent | ddb029b0f084c7aea2922aa955c63176fa649328 (diff) | |
download | coreutils-505eee2f38169d5f3ae3fd2a71a6c78c53030b64.tar.xz |
Add some file system type names and magic numbers from glibc.
* src/stat.c (human_fstype): Add any file system names and values
present in glibc's linux_fsinfo.h but not in this list.
Alphabetize the S_* names and capitalize the hexadecimal constants.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | src/stat.c | 107 |
2 files changed, 79 insertions, 35 deletions
@@ -1,3 +1,10 @@ +2007-08-27 Jim Meyering <jim@meyering.net> + + Add some file system type names and magic numbers from glibc. + * src/stat.c (human_fstype): Add any file system names and values + present in glibc's linux_fsinfo.h but not in this list. + Alphabetize the S_* names and capitalize the hexadecimal constants. + 2007-08-26 Jim Meyering <jim@meyering.net> * tests/misc/fold: Fix a typo: missing \ in a diagnostic diff --git a/src/stat.c b/src/stat.c index 73abc1b1e..339c71242 100644 --- a/src/stat.c +++ b/src/stat.c @@ -202,33 +202,63 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) { # if defined __linux__ + /* Compare with what's in libc: + f=/a/libc/sysdeps/unix/sysv/linux/linux_fsinfo.h + sed -n '/ADFS_SUPER_MAGIC/,/SYSFS_MAGIC/p' $f \ + | perl -n -e '/#define (.*?)_(?:SUPER_)MAGIC\s+0x(\S+)/' \ + -e 'and print "case S_MAGIC_$1: /\* 0x" . uc($2) . " *\/\n"' \ + | sort > sym_libc + perl -ne '/^\s+(case S_MAGIC_.*?): \/\* 0x(\S+) \*\//' \ + -e 'and do { $v=uc$2; print "$1: /\* 0x$v *\/\n"}' stat.c \ + | sort > sym_stat + diff -u sym_stat sym_libc + */ + /* IMPORTANT NOTE: Each of the following `case S_MAGIC_...:' statements must be followed by a hexadecimal constant in a comment. The S_MAGIC_... name and constant are automatically combined to produce the #define directives in fs.h. */ + case S_MAGIC_ADFS: /* 0xADF5 */ + return "adfs"; case S_MAGIC_AFFS: /* 0xADFF */ return "affs"; + case S_MAGIC_AUTOFS: /* 0x187 */ + return "autofs"; + case S_MAGIC_CODA: /* 0x73757245 */ + return "coda"; + case S_MAGIC_COH: /* 0x012FF7B7 */ + return "coh"; + case S_MAGIC_CRAMFS: /* 0x28CD3D45 */ + return "cramfs"; + case S_MAGIC_DEVFS: /* 0x1373 */ + return "devfs"; case S_MAGIC_DEVPTS: /* 0x1CD1 */ return "devpts"; + case S_MAGIC_EFS: /* 0x414A53 */ + return "efs"; case S_MAGIC_EXT: /* 0x137D */ return "ext"; - case S_MAGIC_EXT2_OLD: /* 0xEF51 */ - return "ext2"; case S_MAGIC_EXT2: /* 0xEF53 */ return "ext2/ext3"; - case S_MAGIC_JFS: /* 0x3153464a */ - return "jfs"; - case S_MAGIC_XFS: /* 0x58465342 */ - return "xfs"; + case S_MAGIC_EXT2_OLD: /* 0xEF51 */ + return "ext2"; + case S_MAGIC_FAT: /* 0x4006 */ + return "fat"; case S_MAGIC_HPFS: /* 0xF995E849 */ return "hpfs"; case S_MAGIC_ISOFS: /* 0x9660 */ return "isofs"; - case S_MAGIC_ISOFS_WIN: /* 0x4000 */ - return "isofs"; case S_MAGIC_ISOFS_R_WIN: /* 0x4004 */ return "isofs"; + case S_MAGIC_ISOFS_WIN: /* 0x4000 */ + return "isofs"; + case S_MAGIC_JFFS2: /* 0x72B6 */ + return "jffs2"; + case S_MAGIC_JFFS: /* 0x07C0 */ + return "jffs"; + case S_MAGIC_JFS: /* 0x3153464A */ + return "jfs"; case S_MAGIC_MINIX: /* 0x137F */ return "minix"; case S_MAGIC_MINIX_30: /* 0x138F */ @@ -237,46 +267,53 @@ human_fstype (STRUCT_STATVFS const *statfsbuf) return "minix v2"; case S_MAGIC_MINIX_V2_30: /* 0x2478 */ return "minix v2 (30 char.)"; - case S_MAGIC_MSDOS: /* 0x4d44 */ + case S_MAGIC_MSDOS: /* 0x4D44 */ return "msdos"; - case S_MAGIC_FAT: /* 0x4006 */ - return "fat"; - case S_MAGIC_NCP: /* 0x564c */ + case S_MAGIC_NCP: /* 0x564C */ return "novell"; case S_MAGIC_NFS: /* 0x6969 */ return "nfs"; - case S_MAGIC_PROC: /* 0x9fa0 */ - return "proc"; - case S_MAGIC_SMB: /* 0x517B */ - return "smb"; - case S_MAGIC_XENIX: /* 0x012FF7B4 */ - return "xenix"; - case S_MAGIC_SYSV4: /* 0x012FF7B5 */ - return "sysv4"; - case S_MAGIC_SYSV2: /* 0x012FF7B6 */ - return "sysv2"; - case S_MAGIC_COH: /* 0x012FF7B7 */ - return "coh"; - case S_MAGIC_UFS: /* 0x00011954 */ - return "ufs"; - case S_MAGIC_XIAFS: /* 0x012FD16D */ - return "xia"; - case S_MAGIC_NTFS: /* 0x5346544e */ + case S_MAGIC_NTFS: /* 0x5346544E */ return "ntfs"; - case S_MAGIC_TMPFS: /* 0x1021994 */ - return "tmpfs"; + case S_MAGIC_PROC: /* 0x9FA0 */ + return "proc"; + case S_MAGIC_QNX4: /* 0x002F */ + return "qnx4"; + case S_MAGIC_RAMFS: /* 0x858458F6 */ + return "ramfs"; case S_MAGIC_REISERFS: /* 0x52654973 */ return "reiserfs"; - case S_MAGIC_CRAMFS: /* 0x28cd3d45 */ - return "cramfs"; case S_MAGIC_ROMFS: /* 0x7275 */ return "romfs"; - case S_MAGIC_RAMFS: /* 0x858458f6 */ - return "ramfs"; + case S_MAGIC_SMB: /* 0x517B */ + return "smb"; case S_MAGIC_SQUASHFS: /* 0x73717368 */ return "squashfs"; case S_MAGIC_SYSFS: /* 0x62656572 */ return "sysfs"; + case S_MAGIC_SYSV2: /* 0x012FF7B6 */ + return "sysv2"; + case S_MAGIC_SYSV4: /* 0x012FF7B5 */ + return "sysv4"; + case S_MAGIC_TMPFS: /* 0x1021994 */ + return "tmpfs"; + case S_MAGIC_UDF: /* 0x15013346 */ + return "udf"; + case S_MAGIC_UFS: /* 0x00011954 */ + return "ufs"; + case S_MAGIC_UFS_BYTESWAPPED: /* 0x54190100 */ + return "ufs"; + case S_MAGIC_USBDEVFS: /* 0x9FA2 */ + return "usbdevfs"; + case S_MAGIC_VXFS: /* 0xA501FCF5 */ + return "vxfs"; + case S_MAGIC_XENIX: /* 0x012FF7B4 */ + return "xenix"; + case S_MAGIC_XFS: /* 0x58465342 */ + return "xfs"; + case S_MAGIC_XIAFS: /* 0x012FD16D */ + return "xia"; + # elif __GNU__ case FSTYPE_UFS: return "ufs"; |