From: Petr Uzel Subject: libparted: Change partition naming for SUSE needs References: bsc#1056508 Patch-mainline: no, custom SUSE patch Device mapper partitions always use the suffix "-part%d" for partition names. Other devices with a trailing number in their name use the "p%d" suffix. All other devices 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] [sparschauer: Dropped "_part" suffix, bsc#1078820, bsc#1081547] Signed-off-by: Sebastian Parschauer --- libparted/arch/linux.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) Index: parted-3.3/libparted/arch/linux.c =================================================================== --- parted-3.3.orig/libparted/arch/linux.c +++ parted-3.3/libparted/arch/linux.c @@ -2456,11 +2456,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 - || dev->type == PED_DEVICE_ATARAID - || isdigit (devpath[path_len - 1]) - ? "p" : ""); + const char *p; + if (dev->type == PED_DEVICE_ATARAID || + dev->type == PED_DEVICE_CPQARRAY || + dev->type == PED_DEVICE_DAC960 || + dev->type == PED_DEVICE_SDMMC) + p = "p"; + else if (dev->type == PED_DEVICE_DM) + p = "-part"; + else + p = (isdigit (devpath[path_len - 1]) + ? "p" : ""); result = zasprintf ("%s%s%d", devpath, p, num); } #ifdef ENABLE_DEVICE_MAPPER @@ -2927,7 +2933,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; @@ -3004,7 +3010,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;