rework human_fstype to cut down size

This commit is contained in:
Mike Frysinger 2005-04-24 04:11:44 +00:00
parent f06c494636
commit 408ae211ce

View File

@ -78,84 +78,53 @@ static char const *human_time(time_t t)
*/ */
static char const *human_fstype(long f_type) static char const *human_fstype(long f_type)
{ {
#define S_MAGIC_AFFS 0xADFF int i;
#define S_MAGIC_DEVPTS 0x1CD1 static struct types {
#define S_MAGIC_EXT 0x137D long type;
#define S_MAGIC_EXT2_OLD 0xEF51 char *fs;
#define S_MAGIC_EXT2 0xEF53 } humantypes[] = {
#define S_MAGIC_JFS 0x3153464a { 0xADFF, "affs" },
#define S_MAGIC_XFS 0x58465342 { 0x1Cd1, "devpts" },
#define S_MAGIC_HPFS 0xF995E849 { 0x137D, "ext" },
#define S_MAGIC_ISOFS 0x9660 { 0xEF51, "ext2" },
#define S_MAGIC_ISOFS_WIN 0x4000 { 0xEF53, "ext2/ext3" },
#define S_MAGIC_ISOFS_R_WIN 0x4004 { 0x3153464a, "jfs" },
#define S_MAGIC_MINIX 0x137F { 0x58465342, "xfs" },
#define S_MAGIC_MINIX_30 0x138F { 0xF995E849, "hpfs" },
#define S_MAGIC_MINIX_V2 0x2468 { 0x9660, "isofs" },
#define S_MAGIC_MINIX_V2_30 0x2478 { 0x4000, "isofs" },
#define S_MAGIC_MSDOS 0x4d44 { 0x4004, "isofs" },
#define S_MAGIC_FAT 0x4006 { 0x137F, "minix" },
#define S_MAGIC_NCP 0x564c { 0x138F, "minix (30 char.)" },
#define S_MAGIC_NFS 0x6969 { 0x2468, "minix v2" },
#define S_MAGIC_PROC 0x9fa0 { 0x2478, "minix v2 (30 char.)" },
#define S_MAGIC_SMB 0x517B { 0x4d44, "msdos" },
#define S_MAGIC_XENIX 0x012FF7B4 { 0x4006, "fat" },
#define S_MAGIC_SYSV4 0x012FF7B5 { 0x564c, "novell" },
#define S_MAGIC_SYSV2 0x012FF7B6 { 0x6969, "nfs" },
#define S_MAGIC_COH 0x012FF7B7 { 0x9fa0, "proc" },
#define S_MAGIC_UFS 0x00011954 { 0x517B, "smb" },
#define S_MAGIC_XIAFS 0x012FD16D { 0x012FF7B4, "xenix" },
#define S_MAGIC_NTFS 0x5346544e { 0x012FF7B5, "sysv4" },
#define S_MAGIC_TMPFS 0x1021994 { 0x012FF7B6, "sysv2" },
#define S_MAGIC_REISERFS 0x52654973 { 0x012FF7B7, "coh" },
#define S_MAGIC_CRAMFS 0x28cd3d45 { 0x00011954, "ufs" },
#define S_MAGIC_ROMFS 0x7275 { 0x012FD16D, "xia" },
#define S_MAGIC_RAMFS 0x858458f6 { 0x5346544e, "ntfs" },
#define S_MAGIC_SQUASHFS 0x73717368 { 0x1021994, "tmpfs" },
#define S_MAGIC_SYSFS 0x62656572 { 0x52654973, "reiserfs" },
switch (f_type) { { 0x28cd3d45, "cramfs" },
case S_MAGIC_AFFS: return "affs"; { 0x7275, "romfs" },
case S_MAGIC_DEVPTS: return "devpts"; { 0x858458f6, "romfs" },
case S_MAGIC_EXT: return "ext"; { 0x73717368, "squashfs" },
case S_MAGIC_EXT2_OLD: return "ext2"; { 0x62656572, "sysfs" },
case S_MAGIC_EXT2: return "ext2/ext3"; { 0, "UNKNOWN" },
case S_MAGIC_JFS: return "jfs"; { 0, NULL }
case S_MAGIC_XFS: return "xfs"; };
case S_MAGIC_HPFS: return "hpfs"; for (i=0; humantypes[i].type; ++i)
case S_MAGIC_ISOFS: return "isofs"; if (humantypes[i].type == f_type)
case S_MAGIC_ISOFS_WIN: return "isofs"; return humantypes[i].fs;
case S_MAGIC_ISOFS_R_WIN: return "isofs"; return humantypes[i].fs;
case S_MAGIC_MINIX: return "minix";
case S_MAGIC_MINIX_30: return "minix (30 char.)";
case S_MAGIC_MINIX_V2: return "minix v2";
case S_MAGIC_MINIX_V2_30: return "minix v2 (30 char.)";
case S_MAGIC_MSDOS: return "msdos";
case S_MAGIC_FAT: return "fat";
case S_MAGIC_NCP: return "novell";
case S_MAGIC_NFS: return "nfs";
case S_MAGIC_PROC: return "proc";
case S_MAGIC_SMB: return "smb";
case S_MAGIC_XENIX: return "xenix";
case S_MAGIC_SYSV4: return "sysv4";
case S_MAGIC_SYSV2: return "sysv2";
case S_MAGIC_COH: return "coh";
case S_MAGIC_UFS: return "ufs";
case S_MAGIC_XIAFS: return "xia";
case S_MAGIC_NTFS: return "ntfs";
case S_MAGIC_TMPFS: return "tmpfs";
case S_MAGIC_REISERFS: return "reiserfs";
case S_MAGIC_CRAMFS: return "cramfs";
case S_MAGIC_ROMFS: return "romfs";
case S_MAGIC_RAMFS: return "ramfs";
case S_MAGIC_SQUASHFS: return "squashfs";
case S_MAGIC_SYSFS: return "sysfs";
default: {
static char buf[sizeof("UNKNOWN (0x%lx)") - 3
+ (sizeof(f_type) * CHAR_BIT + 3) / 4];
sprintf(buf, "UNKNOWN (0x%lx)", f_type);
return buf;
}
}
} }
#ifdef CONFIG_FEATURE_STAT_FORMAT #ifdef CONFIG_FEATURE_STAT_FORMAT