Fix libblkid's magic number recognition for the cramfs filesystem,

and add support to pull out the label for cramfs filesystems.  
Thanks to Karel Zak (kzak at redhat.com) for the patch.
bitmap-optimize
Theodore Ts'o 2005-05-05 18:06:04 -04:00
parent 64777391eb
commit 4c4e3f7843
3 changed files with 40 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2005-05-05 Theodore Ts'o <tytso@mit.edu>
* probe.c (probe_cramfs), probe.h: Fix magic number recognition
for the cramfs filesystem, and add support to pull out the
label for cramfs filesystems. Thanks to Karel Zak (kzak
at redhat.com) for the patch.
2005-03-31 Theodore Ts'o <tytso@mit.edu>
* cache.c (blkid_get_cache): Use a much more paranoid

View File

@ -303,6 +303,23 @@ static int probe_romfs(int fd __BLKID_ATTR((unused)),
return 0;
}
static int probe_cramfs(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
{
struct cramfs_super_block *csb;
const char *label = 0;
csb = (struct cramfs_super_block *)buf;
if (strlen((char *) csb->name))
label = (char *) csb->name;
blkid_set_tag(dev, "LABEL", label, 0);
return 0;
}
static int probe_swap0(int fd __BLKID_ATTR((unused)),
blkid_cache cache __BLKID_ATTR((unused)),
blkid_dev dev,
@ -489,7 +506,7 @@ static struct blkid_magic type_array[] = {
{ "xfs", 0, 0, 4, "XFSB", probe_xfs },
{ "romfs", 0, 0, 8, "-rom1fs-", probe_romfs },
{ "bfs", 0, 0, 4, "\316\372\173\033", 0 },
{ "cramfs", 0, 0, 4, "E=\315\034", 0 },
{ "cramfs", 0, 0, 4, "E=\315\050", probe_cramfs },
{ "qnx4", 0, 4, 6, "QNX4FS", 0 },
{ "udf", 32, 1, 5, "BEA01", probe_udf },
{ "udf", 32, 1, 5, "BOOT2", probe_udf },

View File

@ -108,6 +108,21 @@ struct romfs_super_block {
unsigned char ros_volume[16];
};
struct cramfs_super_block {
__u8 magic[4];
__u32 size;
__u32 flags;
__u32 future;
__u8 signature[16];
struct cramfs_info {
__u32 crc;
__u32 edition;
__u32 blocks;
__u32 files;
} info;
__u8 name[16];
};
struct swap_id_block {
/* unsigned char sws_boot[1024]; */
__u32 sws_version;