e2fsprogs/e2fsprogs-blkid_probe_hfsplus.patch

87 lines
2.9 KiB
Diff

Index: e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329/lib/blkid/probe.c
===================================================================
--- e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329.orig/lib/blkid/probe.c
+++ e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329/lib/blkid/probe.c
@@ -725,6 +725,19 @@ static int probe_gfs2(struct blkid_probe
return 1;
}
+static int probe_hfsplus(struct blkid_probe *probe,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
+{
+ struct hfs_mdb *sbd = (struct hfs_mdb *)buf;
+
+ /* Check for a HFS+ volume embedded in a HFS volume */
+ if (memcmp(sbd->embed_sig, "H+", 2) == 0)
+ return 0;
+
+ return 1;
+}
+
/*
* BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
* in the type_array table below + bim_kbalign.
@@ -782,6 +795,8 @@ static struct blkid_magic type_array[] =
{ "iso9660", 32, 1, 5, "CD001", probe_iso9660 },
{ "iso9660", 32, 9, 5, "CDROM", probe_iso9660 },
{ "jfs", 32, 0, 4, "JFS1", probe_jfs },
+ { "hfsplus", 1, 0, 2, "BD", probe_hfsplus },
+ { "hfsplus", 1, 0, 2, "H+", 0 },
{ "hfs", 1, 0, 2, "BD", 0 },
{ "ufs", 8, 0x55c, 4, "T\031\001\000", 0 },
{ "hpfs", 8, 0, 4, "I\350\225\371", 0 },
Index: e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329/lib/blkid/probe.h
===================================================================
--- e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329.orig/lib/blkid/probe.h
+++ e2fsprogs-1.39+1.40_WIP_20061114+PATCH20070329/lib/blkid/probe.h
@@ -395,6 +395,48 @@ struct gfs2_sb {
/* In gfs1, quota and license dinodes followed */
};
+/* HFS / HFS+ */
+struct hfs_finder_info {
+ __u32 boot_folder;
+ __u32 start_app;
+ __u32 open_folder;
+ __u32 os9_folder;
+ __u32 reserved;
+ __u32 osx_folder;
+ __u8 id[8];
+} __attribute__((packed));
+
+struct hfs_mdb {
+ __u8 signature[2];
+ __u32 cr_date;
+ __u32 ls_Mod;
+ __u16 atrb;
+ __u16 nm_fls;
+ __u16 vbm_st;
+ __u16 alloc_ptr;
+ __u16 nm_al_blks;
+ __u32 al_blk_size;
+ __u32 clp_size;
+ __u16 al_bl_st;
+ __u32 nxt_cnid;
+ __u16 free_bks;
+ __u8 label_len;
+ __u8 label[27];
+ __u32 vol_bkup;
+ __u16 vol_seq_num;
+ __u32 wr_cnt;
+ __u32 xt_clump_size;
+ __u32 ct_clump_size;
+ __u16 num_root_dirs;
+ __u32 file_count;
+ __u32 dir_count;
+ struct hfs_finder_info finder_info;
+ __u8 embed_sig[2];
+ __u16 embed_startblock;
+ __u16 embed_blockcount;
+} __attribute__((packed));
+
+
/*
* Byte swap functions
*/