Skip to contentSkip to conversation

main - fix device name from devno for partitions

PATCH David Teigland 1 participant 1 message Nov 5, 2021

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b4067e84c7884f2b46effdf31418f66cc0b902bb
Commit:        b4067e84c7884f2b46effdf31418f66cc0b902bb
Parent:        62533ae3fad9fece6f27e3fae7b56e40c66438fa
Author:        David Teigland <[email protected]>
AuthorDate:    Fri Nov 5 16:21:23 2021 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Fri Nov 5 16:21:23 2021 -0500

fix device name from devno for partitions

sysfs files for partitions are different from whole devices and will require more work to translate to device names.

---
 lib/device/dev-cache.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/device/dev-cache.c +2 -1
index ce82a9303..e71cef38d 100644
@@ -2125,7 +2125,7 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno)
 		}
 
 		if (!(dir = opendir(path)))
-			return NULL;
+			goto try_partition;
 
 		while ((dirent = readdir(dir))) {
 			if (dirent->d_name[0] == '.')
@@ -2175,6 +2175,7 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno)
 	 * major minor #blocks name
 	 */
 
+try_partition:
 	if (!(fp = fopen("/proc/partitions", "r")))
 		return NULL;