summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTony Asleson2018-03-08 22:41:26 +0100
committerKarel Zak2018-03-09 13:34:42 +0100
commit80ec018c6a0cf321f7b5d57de948354b0850cc8a (patch)
tree258ccad7df7c329d00bf48bf945d9ad7ce387c87 /lib
parentdocs: add new idea to TODO list (diff)
downloadkernel-qcow2-util-linux-80ec018c6a0cf321f7b5d57de948354b0850cc8a.tar.gz
kernel-qcow2-util-linux-80ec018c6a0cf321f7b5d57de948354b0850cc8a.tar.xz
kernel-qcow2-util-linux-80ec018c6a0cf321f7b5d57de948354b0850cc8a.zip
libblkid: ignore private Stratis devices
[kzak@redhat.com: - tiny coding style changes] References: 20e1c3dc03399d6988ef35dedc1364cfc12e9263 Signed-off-by: Tony Asleson <tasleson@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/sysfs.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c
index b1b67c59f..e5437f43a 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -844,10 +844,10 @@ err:
}
/*
- * Returns 1 if the device is private LVM device. The @uuid (if not NULL)
- * returns DM device UUID, use free() to deallocate.
+ * Returns 1 if the device is private device mapper device. The @uuid
+ * (if not NULL) returns DM device UUID, use free() to deallocate.
*/
-int sysfs_devno_is_lvm_private(dev_t devno, char **uuid)
+int sysfs_devno_is_dm_private(dev_t devno, char **uuid)
{
struct sysfs_cxt cxt = UL_SYSFSCXT_EMPTY;
char *id = NULL;
@@ -857,15 +857,21 @@ int sysfs_devno_is_lvm_private(dev_t devno, char **uuid)
return 0;
id = sysfs_strdup(&cxt, "dm/uuid");
+ if (id) {
+ /* Private LVM devices use "LVM-<uuid>-<name>" uuid format (important
+ * is the "LVM" prefix and "-<name>" postfix).
+ */
+ if (strncmp(id, "LVM-", 4) == 0) {
+ char *p = strrchr(id + 4, '-');
- /* Private LVM devices use "LVM-<uuid>-<name>" uuid format (important
- * is the "LVM" prefix and "-<name>" postfix).
- */
- if (id && strncmp(id, "LVM-", 4) == 0) {
- char *p = strrchr(id + 4, '-');
+ if (p && *(p + 1))
+ rc = 1;
- if (p && *(p + 1))
+ /* Private Stratis devices prefix the UUID with "stratis-1-private"
+ */
+ } else if (strncmp(id, "stratis-1-private", 17) == 0) {
rc = 1;
+ }
}
sysfs_deinit(&cxt);