<div dir="ltr">there's already a list of fstypes in toys/other/blkid.c. it would probably make more sense to move that into lib and share it.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 7, 2015 at 3:59 AM, Hyejin Kim <span dir="ltr"><<a href="mailto:hj8296@gmail.com" target="_blank">hj8296@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Hi.</div><div> </div><div>As need internally, added %T format to print filesystem type as human readable form.</div><div>Plz, have a look.</div><div> </div><div>smackfs currently commented but will support later.</div><div> </div><div> </div><div> </div><div>diff --git a/toys/other/stat.c b/toys/other/stat.c<br>index a96c1de..a9f4685 100644<br>--- a/toys/other/stat.c<br>+++ b/toys/other/stat.c<br>@@ -29,7 +29,7 @@ config STAT<br> %a Available blocks |%b Total blocks |%c Total inodes<br> %d Free inodes |%f Free blocks |%i File system ID<br> %l Max filename length |%n File name |%s Fragment size<br>- %S Best transfer size |%t File system type<br>+ %S Best transfer size |%t File system type |%T Type in human readable form<br> */<br> <br> #define FOR_stat<br>@@ -46,6 +46,35 @@ GLOBALS(<br> struct group *group_name;<br> )<br> <br>+static char* ftype_to_string(uint64_t ftype)<br>+{<br>+ switch (ftype) {<br>+ case 0xADFF: return "affs";<br>+ case 0x5346544e: return "ntfs";<br>+ case 0x1Cd1: return "devpts";<br>+ case 0x137D: return "ext";<br>+ case 0xEF51: return "ext2";<br>+ case 0xEF53: return "ext2/ext3";<br>+ case 0x1BADFACE: return "bfs";<br>+ case 0x9123683E: return "btrfs";<br>+ case 0x28cd3d45: return "cramfs";<br>+ case 0x3153464a: return "jfs";<br>+ case 0x7275: return "romfs";<br>+ case 0x01021994: return "tmpfs";<br>+ case 0x3434: return "nilfs";<br>+ case 0x6969: return "nfs";<br>+ case 0x9fa0: return "proc";<br>+ case 0x534F434B: return "sockfs";<br>+ case 0x62656572: return "sysfs";<br>+ case 0x517B: return "smb";<br>+ case 0x4d44: return "msdos";<br>+ case 0x4006: return "fat";<br>+ //case 0x43415d53: return "smackfs";<br>+ case 0x73717368: return "squashfs";<br>+ default: return "unknown";<br>+ }<br>+}<br>+<br> <br> // Note: the atime, mtime, and ctime fields in struct stat are the start<br> // of embedded struct timespec, but posix won't let them use that<br>@@ -113,6 +142,7 @@ static void print_statfs(char type) {<br> else if (type == 'f') xprintf("%llu", statfs->f_bfree);<br> else if (type == 'l') xprintf("%ld", statfs->f_namelen);<br> else if (type == 't') xprintf("%lx", statfs->f_type);<br>+ else if (type == 'T') xprintf("%s", ftype_to_string(statfs->f_type));<br> else if (type == 'i')<br> xprintf("%08x%08x", statfs->f_fsid.__val[0], statfs->f_fsid.__val[1]);<br> else if (type == 's') xprintf("%d", statfs->f_frsize);<br>@@ -124,7 +154,7 @@ void stat_main(void)<br> {<br> int flagf = toys.optflags & FLAG_f;<br> char *format = flagf<br>- ? " File: \"%n\"\n ID: %i Namelen: %l Type: %t\n"<br>+ ? " File: \"%n\"\n ID: %i Namelen: %l Type: %T\n"<br> "Block Size: %s Fundamental block size: %S\n"<br> "Blocks: Total: %b\tFree: %f\tAvailable: %a\n"<br> "Inodes: Total: %c\tFree: %d"<br>-- </div>
<br>_______________________________________________<br>
Toybox mailing list<br>
<a href="mailto:Toybox@lists.landley.net">Toybox@lists.landley.net</a><br>
<a href="http://lists.landley.net/listinfo.cgi/toybox-landley.net" target="_blank">http://lists.landley.net/listinfo.cgi/toybox-landley.net</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Elliott Hughes - <a href="http://who/enh" target="_blank">http://who/enh</a> - <a href="http://jessies.org/~enh/" target="_blank">http://jessies.org/~enh/</a><br>Android native code/tools questions? Mail me/drop by/add me as a reviewer.</div>
</div>