[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ped_partition_get_path with LUKS
From: |
Matthias Gehre |
Subject: |
Re: ped_partition_get_path with LUKS |
Date: |
Wed, 5 Sep 2012 21:09:57 +0200 |
Please consider the following patch to solve the issue.
>From b86d53346776859b80e3709be7519d02cdd81936 Mon Sep 17 00:00:00 2001
From: Matthias Gehre <address@hidden>
Date: Wed, 5 Sep 2012 21:04:40 +0200
Subject: [PATCH] libparted: fix ped_partition_get_path on loop disk labels
---
libparted/arch/linux.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index e2c4139..9bd1acc 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2231,6 +2231,12 @@ _device_get_part_path (PedDevice *dev, int num)
size_t path_len = strlen (dev->path);
char *result;
+ PedDisk* disk = ped_disk_new(dev);
+
+ if( disk && !strcmp(disk->type->name, "loop") ) {
+ /* partition on loop disk label _is_ the device */
+ result = strdup(dev->path);
+ } else
/* Check for devfs-style /disc => /partN transformation
unconditionally; the system might be using udev with devfs rules,
and if not the test is harmless. */
@@ -2247,6 +2253,9 @@ _device_get_part_path (PedDevice *dev, int num)
result = zasprintf ("%s%s%d", dev->path, p, num);
}
+ if(disk)
+ ped_disk_destroy(disk);
+
return result;
}
--
1.7.9.5