diff options
author | David Härdeman <david@hardeman.nu> | 2006-09-14 00:31:20 +0200 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-09-14 23:14:37 -0700 |
commit | ecec9ae7b5d3c1fb98d66ae24da2f530e9a9db2b (patch) | |
tree | a6c68be705499bf3885199fb7d35b6d814e3e64b | |
parent | 8690a425a89bc3985738e2055eed19923a755726 (diff) | |
download | klibc-ecec9ae7b5d3c1fb98d66ae24da2f530e9a9db2b.tar.gz |
add iso9660 detection to fstypeklibc-1.4.29
The attached patch adds iso9660 detection support to fstype.
Signed-off-by: David Härdeman <david@hardeman.nu>
--
fstype.c | 17 +++++++++++++++++
iso9660_sb.h | 24 ++++++++++++++++++++++++
2 files changed, 41 insertions(+)
-rw-r--r-- | usr/kinit/fstype/fstype.c | 17 | ||||
-rw-r--r-- | usr/kinit/fstype/iso9660_sb.h | 24 |
2 files changed, 41 insertions, 0 deletions
diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c index 76ff988466c2e..ac29fe8aee872 100644 --- a/usr/kinit/fstype/fstype.c +++ b/usr/kinit/fstype/fstype.c @@ -31,6 +31,7 @@ #include "xfs_sb.h" #include "luks_fs.h" #include "lvm2_sb.h" +#include "iso9660_sb.h" /* * Slightly cleaned up version of jfs_superblock to @@ -221,6 +222,21 @@ static int lvm2_image(const void *buf, unsigned long long *blocks) return 0; } +static int iso_image(const void *buf, unsigned long long *blocks) +{ + const struct iso_volume_descriptor *isovd = + (const struct iso_volume_descriptor *)buf; + const struct iso_hs_volume_descriptor *isohsvd = + (const struct iso_hs_volume_descriptor *)buf; + + if (!memcmp(isovd->id, ISO_MAGIC, ISO_MAGIC_L) || + !memcmp(isohsvd->id, ISO_HS_MAGIC, ISO_HS_MAGIC_L)) { + *blocks = 0; + return 1; + } + return 0; +} + struct imagetype { off_t block; const char name[12]; @@ -250,6 +266,7 @@ static struct imagetype images[] = { {8, "reiserfs", reiserfs_image}, {64, "reiserfs", reiserfs_image}, {32, "jfs", jfs_image}, + {32, "iso9660", iso_image}, {0, "luks", luks_image}, {0, "lvm2", lvm2_image}, {1, "lvm2", lvm2_image}, diff --git a/usr/kinit/fstype/iso9660_sb.h b/usr/kinit/fstype/iso9660_sb.h new file mode 100644 index 0000000000000..efe0733ee5771 --- /dev/null +++ b/usr/kinit/fstype/iso9660_sb.h @@ -0,0 +1,24 @@ +#ifndef __ISO9660_SB_H +#define __ISO9660_SB_H + +#define ISO_MAGIC_L 5 +#define ISO_MAGIC "CD001" +#define ISO_HS_MAGIC_L 5 +#define ISO_HS_MAGIC "CDROM" + +/* ISO9660 Volume Descriptor */ +struct iso_volume_descriptor { + __u8 type; + char id[ISO_MAGIC_L]; + __u8 version; +}; + +/* High Sierra Volume Descriptor */ +struct iso_hs_volume_descriptor { + char foo[8]; + __u8 type; + char id[ISO_HS_MAGIC_L]; + __u8 version; +}; + +#endif |