[blkid]Displaying hfsx inspite of hfsplus

2008-10-10
2012-11-28
  • Wael MAAOUI
    Wael MAAOUI
    2008-10-10

    It would be easier to display  hfsx when we execute blkid then to display hfsplus when hfsx partition is detected so we can do the following modification :

    replacing  the line N°1350 in lib/blkid/probe.c :

    { "hfsplus",     1,      0,  2, "HX",                   probe_hfsplus },

    by

    { "hfsx",        1,      0,  2, "HX",                   probe_hfsplus },

    so we get the following structure
    /*
    * Various filesystem magics that we can check for.  Note that kboff and
    * sboff are in kilobytes and bytes respectively.  All magics are in
    * byte strings so we don't worry about endian issues.
    */
    static struct blkid_magic type_array[] = {
    /*  type     kboff   sboff len  magic                   probe */
      { "oracleasm", 0,     32,  8, "ORCLDISK",             probe_oracleasm },
      { "ntfs",      0,      3,  8, "NTFS    ",             probe_ntfs },
      { "jbd",       1,   0x38,  2, "\123\357",             probe_jbd },
      { "ext4dev",   1,   0x38,  2, "\123\357",             probe_ext4dev },
      { "ext4",      1,   0x38,  2, "\123\357",             probe_ext4 },
      { "ext3",      1,   0x38,  2, "\123\357",             probe_ext3 },
      { "ext2",      1,   0x38,  2, "\123\357",             probe_ext2 },
      { "reiserfs",  8,   0x34,  8, "ReIsErFs",             probe_reiserfs },
      { "reiserfs", 64,   0x34,  9, "ReIsEr2Fs",            probe_reiserfs },
      { "reiserfs", 64,   0x34,  9, "ReIsEr3Fs",            probe_reiserfs },
      { "reiserfs", 64,   0x34,  8, "ReIsErFs",             probe_reiserfs },
      { "reiserfs",  8,     20,  8, "ReIsErFs",             probe_reiserfs },
      { "reiser4",  64,      0,  7, "ReIsEr4",              probe_reiserfs4 },
      { "gfs2",     64,      0,  4, "\x01\x16\x19\x70",     probe_gfs2 },
      { "gfs",      64,      0,  4, "\x01\x16\x19\x70",     probe_gfs },
      { "vfat",      0,   0x52,  5, "MSWIN",                probe_fat },
      { "vfat",      0,   0x52,  8, "FAT32   ",             probe_fat },
      { "vfat",      0,   0x36,  5, "MSDOS",                probe_fat },
      { "vfat",      0,   0x36,  8, "FAT16   ",             probe_fat },
      { "vfat",      0,   0x36,  8, "FAT12   ",             probe_fat },
      { "vfat",      0,      0,  1, "\353",                 probe_fat_nomagic },
      { "vfat",      0,      0,  1, "\351",                 probe_fat_nomagic },
      { "vfat",      0,  0x1fe,  2, "\125\252",             probe_fat_nomagic },
      { "minix",     1,   0x10,  2, "\177\023",             0 },
      { "minix",     1,   0x10,  2, "\217\023",             0 },
      { "minix",     1,   0x10,  2, "\150\044",             0 },
      { "minix",     1,   0x10,  2, "\170\044",             0 },
      { "vxfs",      1,      0,  4, "\365\374\001\245",     0 },
      { "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\050",           probe_cramfs },
      { "qnx4",      0,      4,  6, "QNX4FS",               0 },
      { "udf",      32,      1,  5, "BEA01",                probe_udf },
      { "udf",      32,      1,  5, "BOOT2",                probe_udf },
      { "udf",      32,      1,  5, "CD001",                probe_udf },
      { "udf",      32,      1,  5, "CDW02",                probe_udf },
      { "udf",      32,      1,  5, "NSR02",                probe_udf },
      { "udf",      32,      1,  5, "NSR03",                probe_udf },
      { "udf",      32,      1,  5, "TEA01",                probe_udf },
      { "iso9660",  32,      1,  5, "CD001",                probe_iso9660 },
      { "iso9660",  32,      9,  5, "CDROM",                probe_iso9660 },
      { "jfs",      32,      0,  4, "JFS1",                 probe_jfs },
      { "zfs",       8,      0,  8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
      { "zfs",       8,      0,  8, "\x0c\xb1\x07\xb0\xf5\x02\0\0", probe_zfs },
      { "zfs",     264,      0,  8, "\0\0\x02\xf5\xb0\x07\xb1\x0c", probe_zfs },
      { "zfs",     264,      0,  8, "\x0c\xb1\x07\xb0\xf5\x02\0\0", probe_zfs },
      { "hfsplus",   1,      0,  2, "BD",                   probe_hfsplus },
      { "hfsplus",   1,      0,  2, "H+",                   probe_hfsplus },
      { "hfsx",      1,      0,  2, "HX",                   probe_hfsplus },
      { "hfs",       1,      0,  2, "BD",                   probe_hfs },
      { "ufs",       8,  0x55c,  4, "T\031\001\000",        0 },
      { "hpfs",      8,      0,  4, "I\350\225\371",        0 },
      { "sysv",      0,  0x3f8,  4, "\020~\030\375",        0 },
      { "swap",      0,  0xff6, 10, "SWAP-SPACE",           probe_swap0 },
      { "swap",      0,  0xff6, 10, "SWAPSPACE2",           probe_swap1 },
      { "swsuspend", 0,  0xff6,  9, "S1SUSPEND",            probe_swap1 },
      { "swsuspend", 0,  0xff6,  9, "S2SUSPEND",            probe_swap1 },
      { "swap",      0, 0x1ff6, 10, "SWAP-SPACE",           probe_swap0 },
      { "swap",      0, 0x1ff6, 10, "SWAPSPACE2",           probe_swap1 },
      { "swsuspend", 0, 0x1ff6,  9, "S1SUSPEND",            probe_swap1 },
      { "swsuspend", 0, 0x1ff6,  9, "S2SUSPEND",            probe_swap1 },
      { "swap",      0, 0x3ff6, 10, "SWAP-SPACE",           probe_swap0 },
      { "swap",      0, 0x3ff6, 10, "SWAPSPACE2",           probe_swap1 },
      { "swsuspend", 0, 0x3ff6,  9, "S1SUSPEND",            probe_swap1 },
      { "swsuspend", 0, 0x3ff6,  9, "S2SUSPEND",            probe_swap1 },
      { "swap",      0, 0x7ff6, 10, "SWAP-SPACE",           probe_swap0 },
      { "swap",      0, 0x7ff6, 10, "SWAPSPACE2",           probe_swap1 },
      { "swsuspend", 0, 0x7ff6,  9, "S1SUSPEND",            probe_swap1 },
      { "swsuspend", 0, 0x7ff6,  9, "S2SUSPEND",            probe_swap1 },
      { "swap",      0, 0xfff6, 10, "SWAP-SPACE",           probe_swap0 },
      { "swap",      0, 0xfff6, 10, "SWAPSPACE2",           probe_swap1 },
      { "swsuspend", 0, 0xfff6,  9, "S1SUSPEND",            probe_swap1 },
      { "swsuspend", 0, 0xfff6,  9, "S2SUSPEND",            probe_swap1 },
      { "ocfs",      0,      8,  9, "OracleCFS",            probe_ocfs },
      { "ocfs2",     1,      0,  6, "OCFSV2",               probe_ocfs2 },
      { "ocfs2",     2,      0,  6, "OCFSV2",               probe_ocfs2 },
      { "ocfs2",     4,      0,  6, "OCFSV2",               probe_ocfs2 },
      { "ocfs2",     8,      0,  6, "OCFSV2",               probe_ocfs2 },
      { "crypt_LUKS", 0,     0,  6, "LUKS\xba\xbe",         probe_luks },
      { "squashfs",  0,      0,  4, "sqsh",                 0 },
      { "squashfs",  0,      0,  4, "hsqs",                 0 },
      { "lvm2pv",    0,  0x218,  8, "LVM2 001",             probe_lvm2 },
      { "lvm2pv",    0,  0x018,  8, "LVM2 001",             probe_lvm2 },
      { "lvm2pv",    1,  0x018,  8, "LVM2 001",             probe_lvm2 },
      { "lvm2pv",    1,  0x218,  8, "LVM2 001",             probe_lvm2 },
      {   NULL,      0,      0,  0, NULL,                   NULL }
    };