On Mon, Nov 13, 2017 at 06:45:13PM -0600, jgroves@xxxxxxxxxx wrote: > +const char *no = "no"; > +const char *yes = "yes"; > + > +static int probe_mpool(blkid_probe pr, const struct blkid_idmag *mag) > +{ > + struct omf_sb_descriptor *osd; > + uint32_t sb_crc; > + > + osd = blkid_probe_get_sb(pr, mag, struct omf_sb_descriptor); > + if (!osd) > + return errno ? -errno : 1; > + > + sb_crc = crc32c(~0L, (const void *)osd, > + offsetof(struct omf_sb_descriptor, osb_cksum1)); > + sb_crc ^= ~0L; > + > + if (!blkid_probe_verify_csum(pr, sb_crc, osd->osb_cksum1)) { > + blkid_probe_set_value(pr, "VALID", > + (unsigned char *)no, strlen(no) + 1); > + return -EINVAL; > + } The function blkid_probe_verify_csum() defines SBBADCSUM variable if the checksum is invalid and the application cares about such things (used BLKID_SUBLKS_BADCSUM probing flag). The return code should be "1" rather than -EINVAL. Why we need "VALID"? See for example libblkid/src/superblocks/lvm.c. > + > + blkid_probe_set_value(pr, "VALID", > + (unsigned char *)yes, strlen(yes) + 1); > + blkid_probe_set_label(pr, osd->osb_name, sizeof(osd->osb_name)); > + blkid_probe_set_uuid(pr, osd->osb_poolid); > + > + return 0; > +} > + > +/** > + * Superblock (sb) -- magic = ASCII "mpoolDev" > + */ > +#define MPOOL_SB_MAGIC "\x6D\x70\x6f\x6f\x6c\x44\x65\x76" > + > +const struct blkid_idinfo mpool_idinfo = > +{ > + .name = "mpool", > + .usage = BLKID_USAGE_FILESYSTEM, > + .probefunc = probe_mpool, > + .magics = > + { > + { .magic = MPOOL_SB_MAGIC, .len = 8}, > + { NULL } > + } > +}; It would be nice to have some reference (e.g. URL to docs) about Micron mpool in code or in commit message ;-) Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html