• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
2index b8b6558..1111c93 100644
3--- a/lib/blkid/probe.c
4+++ b/lib/blkid/probe.c
5@@ -1440,6 +1440,24 @@ static int probe_f2fs(struct blkid_probe *probe,
6     return 0;
7 }
8
9+static int probe_hmfs(struct blkid_probe *probe,
10+                      struct blkid_magic *id __BLKID_ATTR((unused)),
11+                      unsigned char *buf)
12+{
13+    hmfs_super_block *bs = NULL;
14+    if (buf == NULL) {
15+        return -1;
16+    }
17+    bs = (hmfs_super_block *)buf;
18+    set_uuid(probe->dev, bs->uuid, 0);
19+    if (bs->volume_name[0] != 0) {
20+        unsigned char vol_name_utf8[513] = {0};
21+        unicode_16le_to_utf8(vol_name_utf8, 512, (const unsigned char*)bs->volume_name, 512 * sizeof(__u16));
22+        blkid_set_tag(probe->dev, "LABEL", vol_name_utf8, 512);
23+    }
24+    return 0;
25+}
26+
27 static uint64_t exfat_block_to_offset(const struct exfat_super_block *sb,
28                                       uint64_t block)
29 {
30@@ -1646,6 +1664,7 @@ static struct blkid_magic type_array[] = {
31   { "lvm2pv",	 1,  0x218,  8, "LVM2 001",		probe_lvm2 },
32   { "btrfs",	 64,  0x40,  8, "_BHRfS_M",		probe_btrfs },
33   { "f2fs",	 1,      0,  4, "\x10\x20\xf5\xf2",	probe_f2fs },
34+  { "hmfs",  1,      0,  4, "\x24\x20\xf5\xfe", probe_hmfs },
35   { "exfat",     0,      3,  8, "EXFAT   ",             probe_exfat },
36   {   NULL,	 0,	 0,  0, NULL,			NULL }
37 };
38diff --git a/lib/blkid/probe.h b/lib/blkid/probe.h
39index dea4081..be79c42 100644
40--- a/lib/blkid/probe.h
41+++ b/lib/blkid/probe.h
42@@ -765,6 +765,8 @@ struct f2fs_super_block {
43     __u8 extension_list[F2FS_MAX_EXTENSION][8]; /* extension array */
44 } __attribute__((__packed__));
45
46+typedef struct f2fs_super_block hmfs_super_block;
47+
48 struct exfat_super_block {
49     uint8_t jump[3];
50     uint8_t oem_name[8];
51