integ/filesystem/parted/centos/patches/fix-disable-device-mapper-build-error.patch
chendongqi c22c377b98 CentOS 8: Upgrade parted to version 3.2.36
(1)Release Version Upgrade

(2)Matching code changes with el7 to el8

(3)Delete redundant patches
The patch contents have been fixed in the upstream package(el8)

(4)Modify compilation problem
Add 0001-fix-disable-device-mapper-build-error.patch,
fix-disable-device-mapper-build-error.patch,
fix "DM" undeclared compilation problems after adding "--disable-device-mapper".
Refer to an upstream patch correction.
http://git.savannah.gnu.org/cgit/parted.git/commit/?id=7e87ca3c531228d35e13e802d2622006138b104c

Story: 2006729
Task: 37658
Depends-On: https://review.opendev.org/#/c/696481/
Depends-On: https://review.opendev.org/#/c/696050/
Change-Id: I0cb1b36cb899ef549430e42a9ba741723cdae781
Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
2019-12-20 08:25:32 +00:00

84 lines
2.7 KiB
Diff

From 7e87ca3c531228d35e13e802d2622006138b104c Mon Sep 17 00:00:00 2001
From: Felix Janda <felix.janda@posteo.de>
Date: Sun, 3 May 2015 10:33:15 +0200
Subject: libparted/arch/linux.c: Compile without ENABLE_DEVICE_MAPPER
The patch is an upstream patch.
http://git.savannah.gnu.org/cgit/parted.git/commit
/?id=7e87ca3c531228d35e13e802d2622006138b104c
Signed-off-by: Brian C. Lane <bcl@redhat.com>
Signed-off-by: Dongqi Chen <chen.dq@neusoft.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
index 7771a8b..327e949 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2379,6 +2379,7 @@ zasprintf (const char *format, ...)
return r < 0 ? NULL : resultp;
}
+#ifdef ENABLE_DEVICE_MAPPER
static char *
dm_canonical_path (PedDevice const *dev)
{
@@ -2401,14 +2402,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. */
@@ -2424,8 +2432,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;
}
@@ -3041,12 +3051,15 @@ _disk_sync_part_table (PedDisk* disk)
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
--
2.7.4