diff options
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r-- | lib/sysfs.c | 24 |
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); |