From 80ec018c6a0cf321f7b5d57de948354b0850cc8a Mon Sep 17 00:00:00 2001 From: Tony Asleson Date: Thu, 8 Mar 2018 15:41:26 -0600 Subject: libblkid: ignore private Stratis devices [kzak@redhat.com: - tiny coding style changes] References: 20e1c3dc03399d6988ef35dedc1364cfc12e9263 Signed-off-by: Tony Asleson Signed-off-by: Karel Zak --- lib/sysfs.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'lib') 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 format (important + * is the "LVM" prefix and "-" postfix). + */ + if (strncmp(id, "LVM-", 4) == 0) { + char *p = strrchr(id + 4, '-'); - /* Private LVM devices use "LVM--" uuid format (important - * is the "LVM" prefix and "-" 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); -- cgit v1.2.3-55-g7522