]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/parted/0001-libparted-arch-linux.c-Compile-without-ENABLE_DEVICE.patch
parted: properly link with libiconv
[coffee/buildroot.git] / package / parted / 0001-libparted-arch-linux.c-Compile-without-ENABLE_DEVICE.patch
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
5
6 Signed-off-by: Brian C. Lane <bcl@redhat.com>
7 Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
8 ---
9  libparted/arch/linux.c | 21 +++++++++++++++++----
10  1 file changed, 17 insertions(+), 4 deletions(-)
11
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;
18  }
19  
20 +#ifdef ENABLE_DEVICE_MAPPER
21  static char *
22  dm_canonical_path (PedDevice const *dev)
23  {
24 @@ -2326,14 +2327,21 @@ dm_canonical_path (PedDevice const *dev)
25  err:
26          return NULL;
27  }
28 +#endif
29  
30  static char*
31  _device_get_part_path (PedDevice const *dev, int num)
32  {
33 -        char *devpath = (dev->type == PED_DEVICE_DM
34 -                         ? dm_canonical_path (dev) : dev->path);
35 -        size_t path_len = strlen (devpath);
36 +        char *devpath;
37 +        size_t path_len;
38          char *result;
39 +#ifdef ENABLE_DEVICE_MAPPER
40 +        devpath = (dev->type == PED_DEVICE_DM
41 +                         ? dm_canonical_path (dev) : dev->path);
42 +#else
43 +        devpath = dev->path;
44 +#endif
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)
50                                   ? "p" : "");
51                  result = zasprintf ("%s%s%d", devpath, p, num);
52          }
53 +#ifdef ENABLE_DEVICE_MAPPER
54          if (dev->type == PED_DEVICE_DM)
55                  free (devpath);
56 +#endif
57          return result;
58  }
59  
60 @@ -2945,12 +2955,15 @@ _disk_sync_part_table (PedDisk* disk)
61                                                 unsigned long long *length);
62  
63  
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;
70 -        } else {
71 +        } else
72 +#endif
73 +        {
74                  add_partition = _blkpg_add_partition;
75                  remove_partition = _blkpg_remove_partition;
76  #ifdef BLKPG_RESIZE_PARTITION
77 -- 
78 2.14.2
79