aboutsummaryrefslogtreecommitdiff
path: root/toys/other/blkid.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2014-12-18 11:05:06 -0600
committerRob Landley <rob@landley.net>2014-12-18 11:05:06 -0600
commitbce0e002dc5d25ae109e0b72da071986f211cf9c (patch)
tree56fb310214d2181615c4a266721e1310de590a36 /toys/other/blkid.c
parenta1ea6bb8ea8143cc18fa00703e58819929501654 (diff)
downloadtoybox-bce0e002dc5d25ae109e0b72da071986f211cf9c.tar.gz
Give fstype its own config symbol (separate from blkid), and fix blkid not using more accurate ext3/ext4 filesystem sub-type.
Diffstat (limited to 'toys/other/blkid.c')
-rw-r--r--toys/other/blkid.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/toys/other/blkid.c b/toys/other/blkid.c
index 5c69a1ef..725f163d 100644
--- a/toys/other/blkid.c
+++ b/toys/other/blkid.c
@@ -5,15 +5,23 @@
* See ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.24/libblkid-docs/api-index-full.html
USE_BLKID(NEWTOY(blkid, "<1", TOYFLAG_BIN))
-USE_BLKID(OLDTOY(fstype, blkid, "<1", TOYFLAG_BIN))
+USE_FSTYPE(NEWTOY(fstype, "<1", TOYFLAG_BIN))
config BLKID
bool "blkid"
default y
help
- usage: blkid [block device...]
+ usage: blkid DEV...
- Prints type, label and UUID of filesystem.
+ Prints type, label and UUID of filesystem on a block device or image.
+
+config FSTYPE
+ bool "fstype"
+ default y
+ help
+ usage: fstype DEV...
+
+ Prints type of filesystem on a block device or image.
*/
#define FOR_blkid
@@ -26,9 +34,8 @@ struct fstype {
};
static const struct fstype fstypes[] = {
- // ext3 = buf[1116]&4 ext4 = buf[1120]&64
- {"ext2", 0xEF53, 2, 1080, 1128, 16, 1144},
- // label actually 8/16 0x4d80 but horrible: 16 bit wide characters via
+ {"ext2", 0xEF53, 2, 1080, 1128, 16, 1144}, // keep this first for ext3/4 check
+ // NTFS label actually 8/16 0x4d80 but horrible: 16 bit wide characters via
// codepage, something called a uuid that's only 8 bytes long...
{"ntfs", 0x5346544e, 4, 3, 0x48+(8<<24), 0, 0},
@@ -124,10 +131,15 @@ void do_blkid(int fd, char *name)
printf("\"");
}
- printf(" TYPE=\"%s\"\n", fstypes[i].name);
+ printf(" TYPE=\"%s\"\n", type);
}
void blkid_main(void)
{
loopfiles(toys.optargs, do_blkid);
}
+
+void fstype_main(void)
+{
+ blkid_main();
+}