return 0;
}
-static void set_uuid(blkid_dev dev, uuid_t uuid)
+static void set_uuid(blkid_dev dev, uuid_t uuid, char *tag)
{
char str[37];
if (!uuid_is_null(uuid)) {
uuid_unparse(uuid, str);
- blkid_set_tag(dev, "UUID", str, sizeof(str));
+ blkid_set_tag(dev, tag ? tag : "UUID", str, sizeof(str));
}
}
label = es->s_volume_name;
blkid_set_tag(dev, "LABEL", label, sizeof(es->s_volume_name));
- set_uuid(dev, es->s_uuid);
+ set_uuid(dev, es->s_uuid, 0);
}
static int probe_ext3(struct blkid_probe *probe,
unsigned char *buf)
{
struct ext2_super_block *es;
-
+ char uuid[37];
es = (struct ext2_super_block *)buf;
/* Distinguish between jbd and ext2/3 fs */
get_ext2_info(probe->dev, buf);
+ if ((es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+ !uuid_is_null(es->s_journal_uuid))
+ set_uuid(probe->dev, es->s_journal_uuid, "EXT_JOURNAL");
+
blkid_set_tag(probe->dev, "SEC_TYPE", "ext2", sizeof("ext2"));
return 0;
if (strlen(xs->xs_fname))
label = xs->xs_fname;
blkid_set_tag(probe->dev, "LABEL", label, sizeof(xs->xs_fname));
- set_uuid(probe->dev, xs->xs_uuid);
+ set_uuid(probe->dev, xs->xs_uuid, 0);
return 0;
}
if (id->bim_magic[6] == '2' || id->bim_magic[6] == '3') {
if (strlen(rs->rs_label))
label = rs->rs_label;
- set_uuid(probe->dev, rs->rs_uuid);
+ set_uuid(probe->dev, rs->rs_uuid, 0);
}
blkid_set_tag(probe->dev, "LABEL", label, sizeof(rs->rs_label));
if (strlen((char *) rs4->rs4_label))
label = rs4->rs4_label;
- set_uuid(probe->dev, rs4->rs4_uuid);
+ set_uuid(probe->dev, rs4->rs4_uuid, 0);
blkid_set_tag(probe->dev, "LABEL", (const char *) label,
sizeof(rs4->rs4_label));
if (strlen((char *) js->js_label))
label = (char *) js->js_label;
blkid_set_tag(probe->dev, "LABEL", label, sizeof(js->js_label));
- set_uuid(probe->dev, js->js_uuid);
+ set_uuid(probe->dev, js->js_uuid, 0);
return 0;
}
blkid_set_tag(probe->dev, "LABEL", sws->sws_volume,
sizeof(sws->sws_volume));
if (sws->sws_uuid[0])
- set_uuid(probe->dev, sws->sws_uuid);
+ set_uuid(probe->dev, sws->sws_uuid, 0);
}
return 0;
}
blkid_set_tag(probe->dev, "LABEL", ovl.label, ocfslabellen(ovl));
blkid_set_tag(probe->dev, "MOUNT", ovh.mount, ocfsmountlen(ovh));
- set_uuid(probe->dev, ovl.vol_id);
+ set_uuid(probe->dev, ovl.vol_id, 0);
return 0;
}
osb = (struct ocfs2_super_block *)buf;
blkid_set_tag(probe->dev, "LABEL", osb->s_label, sizeof(osb->s_label));
- set_uuid(probe->dev, osb->s_uuid);
+ set_uuid(probe->dev, osb->s_uuid, 0);
return 0;
}
{
struct blkid_magic *id;
struct blkid_probe probe;
+ blkid_tag_iterate iter;
unsigned char *buf;
- const char *type;
+ const char *type, *value;
struct stat st;
time_t diff, now;
int idx;
uuid_t uuid;
if (check_mdraid(probe.fd, uuid) == 0) {
- set_uuid(dev, uuid);
+ set_uuid(dev, uuid, 0);
type = "mdraid";
goto found_type;
}
if (!id->bim_type && dev->bid_type) {
/*
- * Zap the device filesystem type and try again
+ * Zap the device filesystem information and try again
*/
- blkid_set_tag(dev, "TYPE", 0, 0);
- blkid_set_tag(dev, "SEC_TYPE", 0, 0);
- blkid_set_tag(dev, "LABEL", 0, 0);
- blkid_set_tag(dev, "UUID", 0, 0);
+ iter = blkid_tag_iterate_begin(dev);
+ while (blkid_tag_next(iter, &type, &value) == 0)
+ blkid_set_tag(dev, type, 0, 0);
+ blkid_tag_iterate_end(iter);
goto try_again;
}