termux-packages/packages/parted/01_devmapper.patch

55 lines
1.7 KiB
Diff
Raw Normal View History

Fix disabling of libdevmapper.
Fix bugs related to disabling libdevmapper. Parted is rarely compiled without
devmapper. So couple of syntax errors for the cas3 of disabled devmapper
sneaked in.
diff -ur src-orig/libparted/arch/linux.c src/libparted/arch/linux.c
--- src-orig/libparted/arch/linux.c 2017-08-31 15:47:07.007674598 +0200
+++ src/libparted/arch/linux.c 2017-08-31 15:50:01.487860337 +0200
@@ -2304,6 +2304,7 @@
return r < 0 ? NULL : resultp;
}
+#ifdef ENABLE_DEVICE_MAPPER
static char *
dm_canonical_path (PedDevice const *dev)
{
@@ -2326,12 +2327,17 @@
err:
return NULL;
}
+#endif
static char*
_device_get_part_path (PedDevice const *dev, int num)
{
+#ifdef ENABLE_DEVICE_MAPPER
char *devpath = (dev->type == PED_DEVICE_DM
? dm_canonical_path (dev) : dev->path);
+#else
+ char *devpath = dev->path;
+#endif
size_t path_len = strlen (devpath);
char *result;
/* Check for devfs-style /disc => /partN transformation
@@ -2946,10 +2948,18 @@
if (disk->dev->type == PED_DEVICE_DM) {
+#ifdef ENABLE_DEVICE_MAPPER
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
+ ped_exception_throw (
+ PED_EXCEPTION_BUG,
+ PED_EXCEPTION_CANCEL,
+ "This parted is compiled without devmapper support");
+ return 0;
+#endif
} else {
add_partition = _blkpg_add_partition;
remove_partition = _blkpg_remove_partition;