From: Karel Zak Date: Thu, 9 Oct 2008 10:00:20 +0000 (+0200) Subject: blkid: add HFS and HFS+ X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a0f4c4e678513af123f19c91b0c6903bcbb80bd;p=util-linux blkid: add HFS and HFS+ Signed-off-by: Karel Zak --- diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index 0872a0ea..ee59c2c7 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -63,7 +63,9 @@ static const struct blkid_idinfo *idinfos[] = &oracleasm_idinfo, &reiser_idinfo, &reiser4_idinfo, - &jbd_idinfo + &jbd_idinfo, + &hfsplus_idinfo, + &hfs_idinfo }; #ifndef ARRAY_SIZE @@ -541,8 +543,7 @@ static size_t encode_to_utf8(int enc, unsigned char *dest, size_t len, size_t i, j; uint16_t c; - j = 0; - for (i = 0; i + 2 <= count; i += 2) { + for (j = i = 0; i + 2 <= count; i += 2) { if (enc == BLKID_ENC_UTF16LE) c = (src[i+1] << 8) | src[i]; else /* BLKID_ENC_UTF16BE */ @@ -584,8 +585,8 @@ int blkid_probe_set_utf8label(blkid_probe pr, unsigned char *label, v = blkid_probe_assign_value(pr, "LABEL"); if (!v) return -1; + v->len = encode_to_utf8(enc, v->data, sizeof(v->data), label, len); - v->len++; /* \0 */ return 0; } diff --git a/libs/blkid/src/probers/Makefile.am b/libs/blkid/src/probers/Makefile.am index 790bf782..67a68183 100644 --- a/libs/blkid/src/probers/Makefile.am +++ b/libs/blkid/src/probers/Makefile.am @@ -23,6 +23,7 @@ libprobers_a_SOURCES = probers.h \ gfs.c \ ocfs.c \ reiserfs.c \ - romfs.c + romfs.c \ + hfs.c all-local: $(lib_LIBRARIES) diff --git a/libs/blkid/src/probers/probers.h b/libs/blkid/src/probers/probers.h index 7acf33e2..4a44a22e 100644 --- a/libs/blkid/src/probers/probers.h +++ b/libs/blkid/src/probers/probers.h @@ -43,6 +43,8 @@ extern const struct blkid_idinfo ocfs2_idinfo; extern const struct blkid_idinfo oracleasm_idinfo; extern const struct blkid_idinfo reiser_idinfo; extern const struct blkid_idinfo reiser4_idinfo; +extern const struct blkid_idinfo hfs_idinfo; +extern const struct blkid_idinfo hfsplus_idinfo; #endif /* _BLKID_PROBE_H */