Device mapper type should not automatically mean add 'p'
before the partition number.  Fall back to adding it only
if the previous character is a digit.  This compilies
with kpartx behavior.

Index: parted/libparted/arch/linux.c
===================================================================
--- parted.orig/libparted/arch/linux.c	2011-03-04 21:17:20.481991942 -0500
+++ parted/libparted/arch/linux.c	2011-03-04 21:17:36.681991907 -0500
@@ -2215,7 +2215,6 @@
         } else if (dev->type == PED_DEVICE_DAC960
                         || dev->type == PED_DEVICE_CPQARRAY
                         || dev->type == PED_DEVICE_ATARAID
-                        || dev->type == PED_DEVICE_DM
                         || isdigit (dev->path[path_len - 1]))
                 snprintf (result, result_len, "%sp%d", dev->path, num);
         else
@@ -2735,7 +2734,11 @@
 
         dev_name = dm_task_get_name (task);
 
-        if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
+        if (isdigit(dev_name[strlen(dev_name)-1]))
+        {
+                if (asprintf (&vol_name, "%sp%d", dev_name, part->num) == -1)
+                        goto err;
+        } else if (asprintf (&vol_name, "%s%d", dev_name, part->num) == -1)
                 goto err;
 
         /* Caution: dm_task_destroy frees dev_name.  */

_______________________________________________
parted-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/parted-devel

Reply via email to