forked from pool/parted
- Make SUSE parted pass all tests in upstream test suite - Fix partition naming for dm devices not ending in a digit and also fix resizing of dm partitions (bsc#1056508) OBS-URL: https://build.opensuse.org/request/show/525898 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=133
63 lines
2.5 KiB
Diff
63 lines
2.5 KiB
Diff
From: Petr Uzel <petr.uzel@suse.cz>
|
|
Subject: libparted: Change partition naming for SUSE needs
|
|
References: bsc#1056508
|
|
Patch-mainline: no, custom SUSE patch
|
|
|
|
Device mapper partitions should always use the suffix "-part%d"
|
|
for partition names. CPQ arrays and SDMMC devices should always
|
|
use the "p%d" suffix. DAC960, ATARAID, and devices with a trailing
|
|
number in their name should always use the "_part%d" suffix.
|
|
All other devices should use the "%d" suffix.
|
|
|
|
YaST depends on this.
|
|
|
|
[mwilck: Fixed dm part name in _dm_add_partition(), bsc#1056508]
|
|
[sparschauer: Fixed dm part name in _dm_resize_partition(), bsc#1056508]
|
|
[sparschauer: Wrote the patch description]
|
|
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
|
|
---
|
|
libparted/arch/linux.c | 14 ++++++++++----
|
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
|
--- a/libparted/arch/linux.c
|
|
+++ b/libparted/arch/linux.c
|
|
@@ -2342,11 +2342,17 @@ _device_get_part_path (PedDevice const *
|
|
result = zasprintf ("%.*s/part%d",
|
|
(int) (path_len - 5), devpath, num);
|
|
} else {
|
|
- char const *p = (dev->type == PED_DEVICE_DAC960
|
|
- || dev->type == PED_DEVICE_CPQARRAY
|
|
+ const char *p;
|
|
+ if (dev->type == PED_DEVICE_CPQARRAY ||
|
|
+ dev->type == PED_DEVICE_SDMMC)
|
|
+ p = "p";
|
|
+ else if (dev->type == PED_DEVICE_DM)
|
|
+ p = "-part";
|
|
+ else
|
|
+ p = (dev->type == PED_DEVICE_DAC960
|
|
|| dev->type == PED_DEVICE_ATARAID
|
|
|| isdigit (devpath[path_len - 1])
|
|
- ? "p" : "");
|
|
+ ? "_part" : "");
|
|
result = zasprintf ("%s%s%d", devpath, p, num);
|
|
}
|
|
if (dev->type == PED_DEVICE_DM)
|
|
@@ -2797,7 +2803,7 @@ _dm_add_partition (PedDisk* disk, const
|
|
size_t name_len = strlen (dev_name);
|
|
vol_name = zasprintf ("%s%s%d",
|
|
dev_name,
|
|
- isdigit (dev_name[name_len - 1]) ? "p" : "",
|
|
+ "-part",
|
|
part->num);
|
|
if (vol_name == NULL)
|
|
goto err;
|
|
@@ -2870,7 +2876,7 @@ _dm_resize_partition (PedDisk* disk, con
|
|
size_t name_len = strlen (dev_name);
|
|
vol_name = zasprintf ("%s%s%d",
|
|
dev_name,
|
|
- isdigit (dev_name[name_len - 1]) ? "p" : "",
|
|
+ "-part",
|
|
part->num);
|
|
if (vol_name == NULL)
|
|
goto err;
|