2017-10-08 01:06:11 +02:00
|
|
|
From 141c4309d7164dcd4e09d137fc075c1726fd8dbb Mon Sep 17 00:00:00 2001
|
2017-06-30 14:45:23 +02:00
|
|
|
From: Felix Janda <felix.janda@posteo.de>
|
|
|
|
Date: Sun, 3 May 2015 10:33:15 +0200
|
|
|
|
Subject: [PATCH] libparted/arch/linux.c: Compile without ENABLE_DEVICE_MAPPER
|
|
|
|
|
|
|
|
Signed-off-by: Brian C. Lane <bcl@redhat.com>
|
|
|
|
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
|
|
|
|
---
|
|
|
|
libparted/arch/linux.c | 21 +++++++++++++++++----
|
|
|
|
1 file changed, 17 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
|
2017-10-08 01:06:11 +02:00
|
|
|
index 0f18904..cf38c6f 100644
|
2017-06-30 14:45:23 +02:00
|
|
|
--- a/libparted/arch/linux.c
|
|
|
|
+++ b/libparted/arch/linux.c
|
|
|
|
@@ -2304,6 +2304,7 @@ zasprintf (const char *format, ...)
|
|
|
|
return r < 0 ? NULL : resultp;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef ENABLE_DEVICE_MAPPER
|
|
|
|
static char *
|
|
|
|
dm_canonical_path (PedDevice const *dev)
|
|
|
|
{
|
|
|
|
@@ -2326,14 +2327,21 @@ dm_canonical_path (PedDevice const *dev)
|
|
|
|
err:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
static char*
|
|
|
|
_device_get_part_path (PedDevice const *dev, int num)
|
|
|
|
{
|
|
|
|
- char *devpath = (dev->type == PED_DEVICE_DM
|
|
|
|
- ? dm_canonical_path (dev) : dev->path);
|
|
|
|
- size_t path_len = strlen (devpath);
|
|
|
|
+ char *devpath;
|
|
|
|
+ size_t path_len;
|
|
|
|
char *result;
|
|
|
|
+#ifdef ENABLE_DEVICE_MAPPER
|
|
|
|
+ devpath = (dev->type == PED_DEVICE_DM
|
|
|
|
+ ? dm_canonical_path (dev) : dev->path);
|
|
|
|
+#else
|
|
|
|
+ devpath = dev->path;
|
|
|
|
+#endif
|
|
|
|
+ path_len = strlen (devpath);
|
|
|
|
/* Check for devfs-style /disc => /partN transformation
|
|
|
|
unconditionally; the system might be using udev with devfs rules,
|
|
|
|
and if not the test is harmless. */
|
|
|
|
@@ -2349,8 +2357,10 @@ _device_get_part_path (PedDevice const *dev, int num)
|
|
|
|
? "p" : "");
|
|
|
|
result = zasprintf ("%s%s%d", devpath, p, num);
|
|
|
|
}
|
|
|
|
+#ifdef ENABLE_DEVICE_MAPPER
|
|
|
|
if (dev->type == PED_DEVICE_DM)
|
|
|
|
free (devpath);
|
|
|
|
+#endif
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-10-08 01:06:11 +02:00
|
|
|
@@ -2945,12 +2955,15 @@ _disk_sync_part_table (PedDisk* disk)
|
2017-06-30 14:45:23 +02:00
|
|
|
unsigned long long *length);
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef ENABLE_DEVICE_MAPPER
|
|
|
|
if (disk->dev->type == PED_DEVICE_DM) {
|
|
|
|
add_partition = _dm_add_partition;
|
|
|
|
remove_partition = _dm_remove_partition;
|
|
|
|
resize_partition = _dm_resize_partition;
|
|
|
|
get_partition_start_and_length = _dm_get_partition_start_and_length;
|
|
|
|
- } else {
|
|
|
|
+ } else
|
|
|
|
+#endif
|
|
|
|
+ {
|
|
|
|
add_partition = _blkpg_add_partition;
|
|
|
|
remove_partition = _blkpg_remove_partition;
|
|
|
|
#ifdef BLKPG_RESIZE_PARTITION
|
|
|
|
--
|
2017-10-08 01:06:11 +02:00
|
|
|
2.14.2
|
2017-06-30 14:45:23 +02:00
|
|
|
|