aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-04-17 12:02:10 +0100
committerRon Yorston <rmy@pobox.com>2019-04-17 12:02:10 +0100
commite4bc2cb29c5465cbec2dec1ba3b325139007d03a (patch)
tree3556d0a31ca4f75807345aef3f8a377bebf725f7 /coreutils
parent9752b1d082e6bdb51f8fbec5e751087a687c0062 (diff)
parent1d37186fe2361f80c821e334cc61f41e2f4eeb72 (diff)
downloadbusybox-w32-e4bc2cb29c5465cbec2dec1ba3b325139007d03a.tar.gz
busybox-w32-e4bc2cb29c5465cbec2dec1ba3b325139007d03a.tar.bz2
busybox-w32-e4bc2cb29c5465cbec2dec1ba3b325139007d03a.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/stat.c96
1 files changed, 49 insertions, 47 deletions
diff --git a/coreutils/stat.c b/coreutils/stat.c
index 78b60603d..d9287b34e 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -168,6 +168,43 @@ static const char *human_time(time_t t)
168} 168}
169 169
170#if ENABLE_FEATURE_STAT_FILESYSTEM 170#if ENABLE_FEATURE_STAT_FILESYSTEM
171#define FS_TYPE_LIST \
172FS_TYPE(0xADFF, "affs") \
173FS_TYPE(0x1CD1, "devpts") \
174FS_TYPE(0x137D, "ext") \
175FS_TYPE(0xEF51, "ext2") \
176FS_TYPE(0xEF53, "ext2/ext3") \
177FS_TYPE(0x3153464a, "jfs") \
178FS_TYPE(0x58465342, "xfs") \
179FS_TYPE(0xF995E849, "hpfs") \
180FS_TYPE(0x9660, "isofs") \
181FS_TYPE(0x4000, "isofs") \
182FS_TYPE(0x4004, "isofs") \
183FS_TYPE(0x137F, "minix") \
184FS_TYPE(0x138F, "minix (30 char.)") \
185FS_TYPE(0x2468, "minix v2") \
186FS_TYPE(0x2478, "minix v2 (30 char.)") \
187FS_TYPE(0x4d44, "msdos") \
188FS_TYPE(0x4006, "fat") \
189FS_TYPE(0x564c, "novell") \
190FS_TYPE(0x6969, "nfs") \
191FS_TYPE(0x9fa0, "proc") \
192FS_TYPE(0x517B, "smb") \
193FS_TYPE(0x012FF7B4, "xenix") \
194FS_TYPE(0x012FF7B5, "sysv4") \
195FS_TYPE(0x012FF7B6, "sysv2") \
196FS_TYPE(0x012FF7B7, "coh") \
197IF_PLATFORM_MINGW32(FS_TYPE(0x15013346, "udf")) \
198FS_TYPE(0x00011954, "ufs") \
199FS_TYPE(0x012FD16D, "xia") \
200FS_TYPE(0x5346544e, "ntfs") \
201FS_TYPE(0x1021994, "tmpfs") \
202FS_TYPE(0x52654973, "reiserfs") \
203FS_TYPE(0x28cd3d45, "cramfs") \
204FS_TYPE(0x7275, "romfs") \
205FS_TYPE(0x858458f6, "ramfs") \
206FS_TYPE(0x73717368, "squashfs") \
207FS_TYPE(0x62656572, "sysfs")
171/* Return the type of the specified file system. 208/* Return the type of the specified file system.
172 * Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris) 209 * Some systems have statfvs.f_basetype[FSTYPSZ]. (AIX, HP-UX, and Solaris)
173 * Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2) 210 * Others have statfs.f_fstypename[MFSNAMELEN]. (NetBSD 1.5.2)
@@ -175,57 +212,22 @@ static const char *human_time(time_t t)
175 */ 212 */
176static const char *human_fstype(uint32_t f_type) 213static const char *human_fstype(uint32_t f_type)
177{ 214{
178 static const struct types { 215# define FS_TYPE(type, name) type,
179 uint32_t type; 216 static const uint32_t fstype[] = {
180 const char *const fs; 217 FS_TYPE_LIST
181 } humantypes[] = {
182 { 0xADFF, "affs" },
183 { 0x1Cd1, "devpts" },
184 { 0x137D, "ext" },
185 { 0xEF51, "ext2" },
186 { 0xEF53, "ext2/ext3" },
187 { 0x3153464a, "jfs" },
188 { 0x58465342, "xfs" },
189 { 0xF995E849, "hpfs" },
190 { 0x9660, "isofs" },
191 { 0x4000, "isofs" },
192 { 0x4004, "isofs" },
193 { 0x137F, "minix" },
194 { 0x138F, "minix (30 char.)" },
195 { 0x2468, "minix v2" },
196 { 0x2478, "minix v2 (30 char.)" },
197 { 0x4d44, "msdos" },
198 { 0x4006, "fat" },
199 { 0x564c, "novell" },
200 { 0x6969, "nfs" },
201 { 0x9fa0, "proc" },
202 { 0x517B, "smb" },
203 { 0x012FF7B4, "xenix" },
204 { 0x012FF7B5, "sysv4" },
205 { 0x012FF7B6, "sysv2" },
206 { 0x012FF7B7, "coh" },
207#if ENABLE_PLATFORM_MINGW32
208 { 0x15013346, "udf" },
209#endif
210 { 0x00011954, "ufs" },
211 { 0x012FD16D, "xia" },
212 { 0x5346544e, "ntfs" },
213 { 0x1021994, "tmpfs" },
214 { 0x52654973, "reiserfs" },
215 { 0x28cd3d45, "cramfs" },
216 { 0x7275, "romfs" },
217 { 0x858458f6, "ramfs" },
218 { 0x73717368, "squashfs" },
219 { 0x62656572, "sysfs" },
220 { 0, "UNKNOWN" }
221 }; 218 };
222 219# undef FS_TYPE
220# define FS_TYPE(type, name) name"\0"
221 static const char humanname[] ALIGN1 =
222 FS_TYPE_LIST
223 "UNKNOWN";
224# undef FS_TYPE
223 int i; 225 int i;
224 226
225 for (i = 0; humantypes[i].type; ++i) 227 for (i = 0; i < ARRAY_SIZE(fstype); ++i)
226 if (humantypes[i].type == f_type) 228 if (fstype[i] == f_type)
227 break; 229 break;
228 return humantypes[i].fs; 230 return nth_string(humanname, i);
229} 231}
230 232
231/* "man statfs" says that statfsbuf->f_fsid is a mess */ 233/* "man statfs" says that statfsbuf->f_fsid is a mess */