1 From 141c4309d7164dcd4e09d137fc075c1726fd8dbb Mon Sep 17 00:00:00 2001
2 From: Felix Janda <felix.janda@posteo.de>
3 Date: Sun, 3 May 2015 10:33:15 +0200
4 Subject: [PATCH] libparted/arch/linux.c: Compile without ENABLE_DEVICE_MAPPER
6 Signed-off-by: Brian C. Lane <bcl@redhat.com>
7 Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
9 libparted/arch/linux.c | 21 +++++++++++++++++----
10 1 file changed, 17 insertions(+), 4 deletions(-)
12 diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
13 index 0f18904..cf38c6f 100644
14 --- a/libparted/arch/linux.c
15 +++ b/libparted/arch/linux.c
16 @@ -2304,6 +2304,7 @@ zasprintf (const char *format, ...)
17 return r < 0 ? NULL : resultp;
20 +#ifdef ENABLE_DEVICE_MAPPER
22 dm_canonical_path (PedDevice const *dev)
24 @@ -2326,14 +2327,21 @@ dm_canonical_path (PedDevice const *dev)
31 _device_get_part_path (PedDevice const *dev, int num)
33 - char *devpath = (dev->type == PED_DEVICE_DM
34 - ? dm_canonical_path (dev) : dev->path);
35 - size_t path_len = strlen (devpath);
39 +#ifdef ENABLE_DEVICE_MAPPER
40 + devpath = (dev->type == PED_DEVICE_DM
41 + ? dm_canonical_path (dev) : dev->path);
43 + devpath = dev->path;
45 + path_len = strlen (devpath);
46 /* Check for devfs-style /disc => /partN transformation
47 unconditionally; the system might be using udev with devfs rules,
48 and if not the test is harmless. */
49 @@ -2349,8 +2357,10 @@ _device_get_part_path (PedDevice const *dev, int num)
51 result = zasprintf ("%s%s%d", devpath, p, num);
53 +#ifdef ENABLE_DEVICE_MAPPER
54 if (dev->type == PED_DEVICE_DM)
60 @@ -2945,12 +2955,15 @@ _disk_sync_part_table (PedDisk* disk)
61 unsigned long long *length);
64 +#ifdef ENABLE_DEVICE_MAPPER
65 if (disk->dev->type == PED_DEVICE_DM) {
66 add_partition = _dm_add_partition;
67 remove_partition = _dm_remove_partition;
68 resize_partition = _dm_resize_partition;
69 get_partition_start_and_length = _dm_get_partition_start_and_length;
74 add_partition = _blkpg_add_partition;
75 remove_partition = _blkpg_remove_partition;
76 #ifdef BLKPG_RESIZE_PARTITION