aboutsummaryrefslogtreecommitdiff
path: root/coreutils/stat.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-04-24 04:11:44 +0000
committerMike Frysinger <vapier@gentoo.org>2005-04-24 04:11:44 +0000
commit408ae211ceaf33bf758207cd5329903c39e8880c (patch)
tree86ba5c99fbc7ff83dc8a6a8d21fef83f005d207b /coreutils/stat.c
parentf06c4946368c3e60dda0f66e2729ae05d02621ca (diff)
downloadbusybox-w32-408ae211ceaf33bf758207cd5329903c39e8880c.tar.gz
busybox-w32-408ae211ceaf33bf758207cd5329903c39e8880c.tar.bz2
busybox-w32-408ae211ceaf33bf758207cd5329903c39e8880c.zip
rework human_fstype to cut down size
Diffstat (limited to 'coreutils/stat.c')
-rw-r--r--coreutils/stat.c125
1 files changed, 47 insertions, 78 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 536873fdc..33f01deb0 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -78,84 +78,53 @@ static char const *human_time(time_t t)
78 */ 78 */
79static char const *human_fstype(long f_type) 79static char const *human_fstype(long f_type)
80{ 80{
81#define S_MAGIC_AFFS 0xADFF 81 int i;
82#define S_MAGIC_DEVPTS 0x1CD1 82 static struct types {
83#define S_MAGIC_EXT 0x137D 83 long type;
84#define S_MAGIC_EXT2_OLD 0xEF51 84 char *fs;
85#define S_MAGIC_EXT2 0xEF53 85 } humantypes[] = {
86#define S_MAGIC_JFS 0x3153464a 86 { 0xADFF, "affs" },
87#define S_MAGIC_XFS 0x58465342 87 { 0x1Cd1, "devpts" },
88#define S_MAGIC_HPFS 0xF995E849 88 { 0x137D, "ext" },
89#define S_MAGIC_ISOFS 0x9660 89 { 0xEF51, "ext2" },
90#define S_MAGIC_ISOFS_WIN 0x4000 90 { 0xEF53, "ext2/ext3" },
91#define S_MAGIC_ISOFS_R_WIN 0x4004 91 { 0x3153464a, "jfs" },
92#define S_MAGIC_MINIX 0x137F 92 { 0x58465342, "xfs" },
93#define S_MAGIC_MINIX_30 0x138F 93 { 0xF995E849, "hpfs" },
94#define S_MAGIC_MINIX_V2 0x2468 94 { 0x9660, "isofs" },
95#define S_MAGIC_MINIX_V2_30 0x2478 95 { 0x4000, "isofs" },
96#define S_MAGIC_MSDOS 0x4d44 96 { 0x4004, "isofs" },
97#define S_MAGIC_FAT 0x4006 97 { 0x137F, "minix" },
98#define S_MAGIC_NCP 0x564c 98 { 0x138F, "minix (30 char.)" },
99#define S_MAGIC_NFS 0x6969 99 { 0x2468, "minix v2" },
100#define S_MAGIC_PROC 0x9fa0 100 { 0x2478, "minix v2 (30 char.)" },
101#define S_MAGIC_SMB 0x517B 101 { 0x4d44, "msdos" },
102#define S_MAGIC_XENIX 0x012FF7B4 102 { 0x4006, "fat" },
103#define S_MAGIC_SYSV4 0x012FF7B5 103 { 0x564c, "novell" },
104#define S_MAGIC_SYSV2 0x012FF7B6 104 { 0x6969, "nfs" },
105#define S_MAGIC_COH 0x012FF7B7 105 { 0x9fa0, "proc" },
106#define S_MAGIC_UFS 0x00011954 106 { 0x517B, "smb" },
107#define S_MAGIC_XIAFS 0x012FD16D 107 { 0x012FF7B4, "xenix" },
108#define S_MAGIC_NTFS 0x5346544e 108 { 0x012FF7B5, "sysv4" },
109#define S_MAGIC_TMPFS 0x1021994 109 { 0x012FF7B6, "sysv2" },
110#define S_MAGIC_REISERFS 0x52654973 110 { 0x012FF7B7, "coh" },
111#define S_MAGIC_CRAMFS 0x28cd3d45 111 { 0x00011954, "ufs" },
112#define S_MAGIC_ROMFS 0x7275 112 { 0x012FD16D, "xia" },
113#define S_MAGIC_RAMFS 0x858458f6 113 { 0x5346544e, "ntfs" },
114#define S_MAGIC_SQUASHFS 0x73717368 114 { 0x1021994, "tmpfs" },
115#define S_MAGIC_SYSFS 0x62656572 115 { 0x52654973, "reiserfs" },
116 switch (f_type) { 116 { 0x28cd3d45, "cramfs" },
117 case S_MAGIC_AFFS: return "affs"; 117 { 0x7275, "romfs" },
118 case S_MAGIC_DEVPTS: return "devpts"; 118 { 0x858458f6, "romfs" },
119 case S_MAGIC_EXT: return "ext"; 119 { 0x73717368, "squashfs" },
120 case S_MAGIC_EXT2_OLD: return "ext2"; 120 { 0x62656572, "sysfs" },
121 case S_MAGIC_EXT2: return "ext2/ext3"; 121 { 0, "UNKNOWN" },
122 case S_MAGIC_JFS: return "jfs"; 122 { 0, NULL }
123 case S_MAGIC_XFS: return "xfs"; 123 };
124 case S_MAGIC_HPFS: return "hpfs"; 124 for (i=0; humantypes[i].type; ++i)
125 case S_MAGIC_ISOFS: return "isofs"; 125 if (humantypes[i].type == f_type)
126 case S_MAGIC_ISOFS_WIN: return "isofs"; 126 return humantypes[i].fs;
127 case S_MAGIC_ISOFS_R_WIN: return "isofs"; 127 return humantypes[i].fs;
128 case S_MAGIC_MINIX: return "minix";
129 case S_MAGIC_MINIX_30: return "minix (30 char.)";
130 case S_MAGIC_MINIX_V2: return "minix v2";
131 case S_MAGIC_MINIX_V2_30: return "minix v2 (30 char.)";
132 case S_MAGIC_MSDOS: return "msdos";
133 case S_MAGIC_FAT: return "fat";
134 case S_MAGIC_NCP: return "novell";
135 case S_MAGIC_NFS: return "nfs";
136 case S_MAGIC_PROC: return "proc";
137 case S_MAGIC_SMB: return "smb";
138 case S_MAGIC_XENIX: return "xenix";
139 case S_MAGIC_SYSV4: return "sysv4";
140 case S_MAGIC_SYSV2: return "sysv2";
141 case S_MAGIC_COH: return "coh";
142 case S_MAGIC_UFS: return "ufs";
143 case S_MAGIC_XIAFS: return "xia";
144 case S_MAGIC_NTFS: return "ntfs";
145 case S_MAGIC_TMPFS: return "tmpfs";
146 case S_MAGIC_REISERFS: return "reiserfs";
147 case S_MAGIC_CRAMFS: return "cramfs";
148 case S_MAGIC_ROMFS: return "romfs";
149 case S_MAGIC_RAMFS: return "ramfs";
150 case S_MAGIC_SQUASHFS: return "squashfs";
151 case S_MAGIC_SYSFS: return "sysfs";
152 default: {
153 static char buf[sizeof("UNKNOWN (0x%lx)") - 3
154 + (sizeof(f_type) * CHAR_BIT + 3) / 4];
155 sprintf(buf, "UNKNOWN (0x%lx)", f_type);
156 return buf;
157 }
158 }
159} 128}
160 129
161#ifdef CONFIG_FEATURE_STAT_FORMAT 130#ifdef CONFIG_FEATURE_STAT_FORMAT