diff options
author | Hongxu Jia <hongxu.jia@windriver.com> | 2017-07-27 04:44:24 -0400 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2017-08-13 13:19:41 +0200 |
commit | 0b4f7491798ad7e2eed1c380a4143f600c63f3ce (patch) | |
tree | 23c392aba0a061a2eb0affe0297c1f8ce194da3e | |
parent | 1f56b4212369b1ab90c27ae87954c1b3d990c555 (diff) | |
download | meta-openembedded-0b4f7491798ad7e2eed1c380a4143f600c63f3ce.tar.gz |
libblockdev: add recipe 2.10
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
5 files changed, 679 insertions, 0 deletions
diff --git a/meta-oe/recipes-extended/libblockdev/files/0001-fix-configure-and-compile-failures.patch b/meta-oe/recipes-extended/libblockdev/files/0001-fix-configure-and-compile-failures.patch new file mode 100644 index 0000000000..914ee99db2 --- /dev/null +++ b/meta-oe/recipes-extended/libblockdev/files/0001-fix-configure-and-compile-failures.patch | |||
@@ -0,0 +1,79 @@ | |||
1 | From 86686ccbf43c5d9e8c8dc97c66ba09e522050e5e Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 27 Jul 2017 10:06:24 +0800 | ||
4 | Subject: [PATCH 1/3] fix configure and compile failures | ||
5 | |||
6 | 1. Fix do_configure failure | ||
7 | --------------------------- | ||
8 | |Checking header volume_key/libvolume_key.h existence and usability. | ||
9 | ../tmp/6tvtK.c:1:38: fatal error: volume_key/libvolume_key.h: | ||
10 | No such file or directory | ||
11 | | #include <volume_key/libvolume_key.h> | ||
12 | |Checking header dmraid/dmraid.h existence and usability.../tmp/ | ||
13 | ktVJ6.c:1:27: fatal error: dmraid/dmraid.h: No such file or directory | ||
14 | | #include <dmraid/dmraid.h> | ||
15 | --------------------------- | ||
16 | We explictly add volume_key and dmraid to DEPENDS, do not need | ||
17 | configure to test. | ||
18 | |||
19 | 2. Fix config.h not found | ||
20 | Add it to configure.ac | ||
21 | |||
22 | 3. Correct AC_DEFINE | ||
23 | ... | ||
24 | autoheader: warning: missing template: LIBMOUNT_NEW_ERR_API | ||
25 | autoheader: Use AC_DEFINE([LIBMOUNT_NEW_ERR_API], [], [Description]) | ||
26 | ... | ||
27 | |||
28 | Upstream-Status: Inappropriate [oe specific] | ||
29 | |||
30 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
31 | --- | ||
32 | configure.ac | 10 ++++------ | ||
33 | 1 file changed, 4 insertions(+), 6 deletions(-) | ||
34 | |||
35 | diff --git a/configure.ac b/configure.ac | ||
36 | index 0270c99..b7c7368 100644 | ||
37 | --- a/configure.ac | ||
38 | +++ b/configure.ac | ||
39 | @@ -9,6 +9,8 @@ AC_DISABLE_STATIC | ||
40 | AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-syntax -Wno-portability]) | ||
41 | AC_CONFIG_MACRO_DIR([m4]) | ||
42 | |||
43 | +AC_CONFIG_HEADERS([config.h]) | ||
44 | + | ||
45 | AM_PATH_PYTHON | ||
46 | |||
47 | AM_PROG_AR | ||
48 | @@ -129,7 +131,6 @@ LIBBLOCKDEV_PKG_CHECK_MODULES([UDEV], [libudev >= 216]) | ||
49 | AS_IF([test "x$with_crypto" != "xno"], | ||
50 | [LIBBLOCKDEV_PKG_CHECK_MODULES([CRYPTSETUP], [libcryptsetup >= 1.6.7]) | ||
51 | LIBBLOCKDEV_PKG_CHECK_MODULES([NSS], [nss >= 3.18.0]) | ||
52 | - LIBBLOCKDEV_CHECK_HEADER([volume_key/libvolume_key.h], [$GLIB_CFLAGS $NSS_CFLAGS], [libvolume_key.h not available]) | ||
53 | ], | ||
54 | []) | ||
55 | |||
56 | @@ -137,10 +138,6 @@ AS_IF([test "x$with_dm" != "xno" -o "x$with_lvm" != "xno" -o "x$with_lvm_dbus" ! | ||
57 | [LIBBLOCKDEV_PKG_CHECK_MODULES([DEVMAPPER], [devmapper >= 1.02.93])], | ||
58 | []) | ||
59 | |||
60 | -AS_IF([test "x$with_dm" != "xno"], | ||
61 | - [LIBBLOCKDEV_CHECK_HEADER([dmraid/dmraid.h], [], [dmraid.h not available])], | ||
62 | - []) | ||
63 | - | ||
64 | AS_IF([test "x$with_kbd" != "xno"], | ||
65 | [LIBBLOCKDEV_PKG_CHECK_MODULES([KMOD], [libkmod >= 19])], | ||
66 | []) | ||
67 | @@ -154,7 +151,8 @@ AS_IF([test "x$with_fs" != "xno"], | ||
68 | [LIBBLOCKDEV_PKG_CHECK_MODULES([MOUNT], [mount >= 2.23.0]) | ||
69 | # new versions of libmount has some new functions we can use | ||
70 | AS_IF([$PKG_CONFIG --atleast-version=2.30.0 mount], | ||
71 | - [AC_DEFINE([LIBMOUNT_NEW_ERR_API])], []) | ||
72 | + [AC_DEFINE([LIBMOUNT_NEW_ERR_API], [1], [new versions of libmount has some new functions we can use])], | ||
73 | + []) | ||
74 | |||
75 | LIBBLOCKDEV_PKG_CHECK_MODULES([BLKID], [blkid >= 2.23.0]) | ||
76 | # older versions of libblkid don't support BLKID_SUBLKS_BADCSUM so let's just | ||
77 | -- | ||
78 | 1.8.3.1 | ||
79 | |||
diff --git a/meta-oe/recipes-extended/libblockdev/files/0002-remove-python2-support.patch b/meta-oe/recipes-extended/libblockdev/files/0002-remove-python2-support.patch new file mode 100644 index 0000000000..0719759cdb --- /dev/null +++ b/meta-oe/recipes-extended/libblockdev/files/0002-remove-python2-support.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From 40dae7ea6450cb30f066da8443eabf063b5b0ad7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Mon, 8 May 2017 02:05:40 -0400 | ||
4 | Subject: [PATCH 2/3] remove python2 support | ||
5 | |||
6 | Only python3 is required. | ||
7 | |||
8 | Upstream-Status: Inappropriate [wr-installer specific] | ||
9 | |||
10 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
11 | --- | ||
12 | src/python/gi/overrides/Makefile.am | 5 ----- | ||
13 | 1 file changed, 5 deletions(-) | ||
14 | |||
15 | diff --git a/src/python/gi/overrides/Makefile.am b/src/python/gi/overrides/Makefile.am | ||
16 | index a2927ac..6385502 100644 | ||
17 | --- a/src/python/gi/overrides/Makefile.am | ||
18 | +++ b/src/python/gi/overrides/Makefile.am | ||
19 | @@ -1,8 +1,3 @@ | ||
20 | -pylibdir = $(shell python -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,prefix='${exec_prefix}'))") | ||
21 | - | ||
22 | -overridesdir = $(pylibdir)/gi/overrides | ||
23 | -dist_overrides_DATA = BlockDev.py | ||
24 | - | ||
25 | if WITH_PYTHON3 | ||
26 | py3libdir = $(shell python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0,prefix='${exec_prefix}'))") | ||
27 | py3overridesdir = $(py3libdir)/gi/overrides | ||
28 | -- | ||
29 | 1.8.3.1 | ||
30 | |||
diff --git a/meta-oe/recipes-extended/libblockdev/files/0003-remove-dmraid-while-compiling-with-with-dm.patch b/meta-oe/recipes-extended/libblockdev/files/0003-remove-dmraid-while-compiling-with-with-dm.patch new file mode 100644 index 0000000000..3d9cb6d018 --- /dev/null +++ b/meta-oe/recipes-extended/libblockdev/files/0003-remove-dmraid-while-compiling-with-with-dm.patch | |||
@@ -0,0 +1,470 @@ | |||
1 | From bda7c937ba544182a5cae2a9cf0c173e0ba268c9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 27 Jul 2017 09:47:23 +0800 | ||
4 | Subject: [PATCH 3/3] remove dmraid while compiling with --with-dm | ||
5 | |||
6 | Fix the following failure: | ||
7 | |||
8 | ... | ||
9 | Perhaps you should add the directory containing `dmraid.pc' | ||
10 | to the PKG_CONFIG_PATH environment variable | ||
11 | No package 'dmraid' found | ||
12 | ... | ||
13 | |||
14 | ... | ||
15 | ../../../git/src/plugins/dm.c:24:10: fatal error: dmraid/dmraid.h: No | ||
16 | such file or directory | ||
17 | #include <dmraid/dmraid.h> | ||
18 | ^~~~~~~~~~~~~~~~~ | ||
19 | ... | ||
20 | |||
21 | Upstream-Status: Inappropriate [oe specific] | ||
22 | |||
23 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
24 | --- | ||
25 | src/lib/plugin_apis/dm.api | 41 ----- | ||
26 | src/plugins/Makefile.am | 2 +- | ||
27 | src/plugins/dm.c | 318 ------------------------------------ | ||
28 | src/plugins/dm.h | 5 - | ||
29 | src/python/gi/overrides/BlockDev.py | 6 - | ||
30 | 5 files changed, 1 insertion(+), 371 deletions(-) | ||
31 | |||
32 | diff --git a/src/lib/plugin_apis/dm.api b/src/lib/plugin_apis/dm.api | ||
33 | index a885bba..ec86b80 100644 | ||
34 | --- a/src/lib/plugin_apis/dm.api | ||
35 | +++ b/src/lib/plugin_apis/dm.api | ||
36 | @@ -68,44 +68,3 @@ gchar* bd_dm_node_from_name (const gchar *map_name, GError **error); | ||
37 | */ | ||
38 | gboolean bd_dm_map_exists (const gchar *map_name, gboolean live_only, gboolean active_only, GError **error); | ||
39 | |||
40 | -/** | ||
41 | - * bd_dm_get_member_raid_sets: | ||
42 | - * @name: (allow-none): name of the member | ||
43 | - * @uuid: (allow-none): uuid of the member | ||
44 | - * @major: major number of the device or -1 if not specified | ||
45 | - * @minor: minor number of the device or -1 if not specified | ||
46 | - * @error: (out): variable to store error (if any) | ||
47 | - * | ||
48 | - * Returns: (transfer full) (array zero-terminated=1): list of names of the RAID sets related to | ||
49 | - * the member or %NULL in case of error | ||
50 | - * | ||
51 | - * One of @name, @uuid or @major:@minor has to be given. | ||
52 | - */ | ||
53 | -gchar** bd_dm_get_member_raid_sets (const gchar *name, const gchar *uuid, gint major, gint minor, GError **error); | ||
54 | - | ||
55 | -/** | ||
56 | - * bd_dm_activate_raid_set: | ||
57 | - * @name: name of the DM RAID set to activate | ||
58 | - * @error: (out): variable to store error (if any) | ||
59 | - * | ||
60 | - * Returns: whether the RAID set @name was successfully activate or not | ||
61 | - */ | ||
62 | -gboolean bd_dm_activate_raid_set (const gchar *name, GError **error); | ||
63 | - | ||
64 | -/** | ||
65 | - * bd_dm_deactivate_raid_set: | ||
66 | - * @name: name of the DM RAID set to deactivate | ||
67 | - * @error: (out): variable to store error (if any) | ||
68 | - * | ||
69 | - * Returns: whether the RAID set @name was successfully deactivate or not | ||
70 | - */ | ||
71 | -gboolean bd_dm_deactivate_raid_set (const gchar *name, GError **error); | ||
72 | - | ||
73 | -/** | ||
74 | - * bd_dm_get_raid_set_type: | ||
75 | - * @name: name of the DM RAID set to get the type of | ||
76 | - * @error: (out): variable to store error (if any) | ||
77 | - * | ||
78 | - * Returns: string representation of the @name RAID set's type | ||
79 | - */ | ||
80 | -gchar* bd_dm_get_raid_set_type (const gchar *name, GError **error); | ||
81 | diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am | ||
82 | index 6c4038f..59dc5e3 100644 | ||
83 | --- a/src/plugins/Makefile.am | ||
84 | +++ b/src/plugins/Makefile.am | ||
85 | @@ -76,7 +76,7 @@ endif | ||
86 | |||
87 | if WITH_DM | ||
88 | libbd_dm_la_CFLAGS = $(GLIB_CFLAGS) $(DEVMAPPER_CFLAGS) $(UDEV_CFLAGS) -Wall -Wextra -Werror | ||
89 | -libbd_dm_la_LIBADD = $(GLIB_LIBS) $(DEVMAPPER_LIBS) $(UDEV_LIBS) -ldmraid ${builddir}/../utils/libbd_utils.la | ||
90 | +libbd_dm_la_LIBADD = $(GLIB_LIBS) $(DEVMAPPER_LIBS) $(UDEV_LIBS) ${builddir}/../utils/libbd_utils.la | ||
91 | libbd_dm_la_LDFLAGS = -L${srcdir}/../utils/ -version-info 2:0:0 -Wl,--no-undefined | ||
92 | # Dear author of libdmdraid, VERSION really is not a good name for an enum member! | ||
93 | libbd_dm_la_CPPFLAGS = -I${builddir}/../../include/ -UVERSION | ||
94 | diff --git a/src/plugins/dm.c b/src/plugins/dm.c | ||
95 | index 9cee742..fd7c7ba 100644 | ||
96 | --- a/src/plugins/dm.c | ||
97 | +++ b/src/plugins/dm.c | ||
98 | @@ -21,16 +21,10 @@ | ||
99 | #include <unistd.h> | ||
100 | #include <blockdev/utils.h> | ||
101 | #include <libdevmapper.h> | ||
102 | -#include <dmraid/dmraid.h> | ||
103 | #include <libudev.h> | ||
104 | |||
105 | #include "dm.h" | ||
106 | |||
107 | -/* macros taken from the pyblock/dmraid.h file plus one more*/ | ||
108 | -#define for_each_raidset(_c, _n) list_for_each_entry(_n, LC_RS(_c), list) | ||
109 | -#define for_each_subset(_rs, _n) list_for_each_entry(_n, &(_rs)->sets, list) | ||
110 | -#define for_each_device(_rs, _d) list_for_each_entry(_d, &(_rs)->devs, devs) | ||
111 | - | ||
112 | /** | ||
113 | * SECTION: dm | ||
114 | * @short_description: plugin for basic operations with device mapper | ||
115 | @@ -286,315 +280,3 @@ gboolean bd_dm_map_exists (const gchar *map_name, gboolean live_only, gboolean a | ||
116 | return ret; | ||
117 | } | ||
118 | |||
119 | -/** | ||
120 | - * init_dmraid_stack: (skip) | ||
121 | - * | ||
122 | - * Initializes the dmraid stack by creating the library context, discovering | ||
123 | - * devices, raid sets, etc. | ||
124 | - */ | ||
125 | -static struct lib_context* init_dmraid_stack (GError **error) { | ||
126 | - gint rc = 0; | ||
127 | - gchar *argv[] = {"blockdev.dmraid", NULL}; | ||
128 | - struct lib_context *lc; | ||
129 | - | ||
130 | - /* the code for this function was cherry-picked from the pyblock code */ | ||
131 | - /* XXX: do this all just once, store global lc and provide a reinit | ||
132 | - * function? */ | ||
133 | - | ||
134 | - /* initialize dmraid library context */ | ||
135 | - lc = libdmraid_init (1, (gchar **)argv); | ||
136 | - | ||
137 | - rc = discover_devices (lc, NULL); | ||
138 | - if (!rc) { | ||
139 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_FAIL, | ||
140 | - "Failed to discover devices"); | ||
141 | - libdmraid_exit (lc); | ||
142 | - return NULL; | ||
143 | - } | ||
144 | - discover_raid_devices (lc, NULL); | ||
145 | - | ||
146 | - if (!count_devices (lc, RAID)) { | ||
147 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_NO_DEVS, | ||
148 | - "No RAIDs discovered"); | ||
149 | - libdmraid_exit (lc); | ||
150 | - return NULL; | ||
151 | - } | ||
152 | - | ||
153 | - argv[0] = NULL; | ||
154 | - if (!group_set (lc, argv)) { | ||
155 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_FAIL, | ||
156 | - "Failed to group_set"); | ||
157 | - libdmraid_exit (lc); | ||
158 | - return NULL; | ||
159 | - } | ||
160 | - | ||
161 | - return lc; | ||
162 | -} | ||
163 | - | ||
164 | -/** | ||
165 | - * raid_dev_matches_spec: (skip) | ||
166 | - * | ||
167 | - * Returns: whether the device specified by @sysname matches the spec given by @name, | ||
168 | - * @uuid, @major and @minor | ||
169 | - */ | ||
170 | -static gboolean raid_dev_matches_spec (struct raid_dev *raid_dev, const gchar *name, const gchar *uuid, gint major, gint minor) { | ||
171 | - gchar const *dev_name = NULL; | ||
172 | - gchar const *dev_uuid; | ||
173 | - gchar const *major_str; | ||
174 | - gchar const *minor_str; | ||
175 | - struct udev *context; | ||
176 | - struct udev_device *device; | ||
177 | - gboolean ret = TRUE; | ||
178 | - | ||
179 | - /* find the second '/' to get name (the rest of the string) */ | ||
180 | - dev_name = strchr (raid_dev->di->path, '/'); | ||
181 | - if (dev_name && strlen (dev_name) > 1) { | ||
182 | - dev_name++; | ||
183 | - dev_name = strchr (dev_name, '/'); | ||
184 | - } | ||
185 | - if (dev_name && strlen (dev_name) > 1) { | ||
186 | - dev_name++; | ||
187 | - } | ||
188 | - else | ||
189 | - dev_name = NULL; | ||
190 | - | ||
191 | - /* if we don't have the name, we cannot check any match */ | ||
192 | - g_return_val_if_fail (dev_name, FALSE); | ||
193 | - | ||
194 | - if (name && strcmp (dev_name, name) != 0) { | ||
195 | - return FALSE; | ||
196 | - } | ||
197 | - | ||
198 | - context = udev_new (); | ||
199 | - device = udev_device_new_from_subsystem_sysname (context, "block", dev_name); | ||
200 | - dev_uuid = udev_device_get_property_value (device, "UUID"); | ||
201 | - major_str = udev_device_get_property_value (device, "MAJOR"); | ||
202 | - minor_str = udev_device_get_property_value (device, "MINOR"); | ||
203 | - | ||
204 | - if (uuid && (g_strcmp0 (uuid, "") != 0) && (g_strcmp0 (uuid, dev_uuid) != 0)) | ||
205 | - ret = FALSE; | ||
206 | - | ||
207 | - if (major >= 0 && (atoi (major_str) != major)) | ||
208 | - ret = FALSE; | ||
209 | - | ||
210 | - if (minor >= 0 && (atoi (minor_str) != minor)) | ||
211 | - ret = FALSE; | ||
212 | - | ||
213 | - udev_device_unref (device); | ||
214 | - udev_unref (context); | ||
215 | - | ||
216 | - return ret; | ||
217 | -} | ||
218 | - | ||
219 | -/** | ||
220 | - * find_raid_sets_for_dev: (skip) | ||
221 | - */ | ||
222 | -static void find_raid_sets_for_dev (const gchar *name, const gchar *uuid, gint major, gint minor, struct lib_context *lc, struct raid_set *rs, GPtrArray *ret_sets) { | ||
223 | - struct raid_set *subset; | ||
224 | - struct raid_dev *dev; | ||
225 | - | ||
226 | - if (T_GROUP(rs) || !list_empty(&(rs->sets))) { | ||
227 | - for_each_subset (rs, subset) | ||
228 | - find_raid_sets_for_dev (name, uuid, major, minor, lc, subset, ret_sets); | ||
229 | - } else { | ||
230 | - for_each_device (rs, dev) { | ||
231 | - if (raid_dev_matches_spec (dev, name, uuid, major, minor)) | ||
232 | - g_ptr_array_add (ret_sets, g_strdup (rs->name)); | ||
233 | - } | ||
234 | - } | ||
235 | -} | ||
236 | - | ||
237 | -/** | ||
238 | - * bd_dm_get_member_raid_sets: | ||
239 | - * @name: (allow-none): name of the member | ||
240 | - * @uuid: (allow-none): uuid of the member | ||
241 | - * @major: major number of the device or -1 if not specified | ||
242 | - * @minor: minor number of the device or -1 if not specified | ||
243 | - * @error: (out): variable to store error (if any) | ||
244 | - * | ||
245 | - * Returns: (transfer full) (array zero-terminated=1): list of names of the RAID sets related to | ||
246 | - * the member or %NULL in case of error | ||
247 | - * | ||
248 | - * One of @name, @uuid or @major:@minor has to be given. | ||
249 | - */ | ||
250 | -gchar** bd_dm_get_member_raid_sets (const gchar *name, const gchar *uuid, gint major, gint minor, GError **error) { | ||
251 | - guint64 i = 0; | ||
252 | - struct lib_context *lc = NULL; | ||
253 | - struct raid_set *rs = NULL; | ||
254 | - GPtrArray *ret_sets = g_ptr_array_new (); | ||
255 | - gchar **ret = NULL; | ||
256 | - | ||
257 | - lc = init_dmraid_stack (error); | ||
258 | - if (!lc) | ||
259 | - /* error is already populated */ | ||
260 | - return NULL; | ||
261 | - | ||
262 | - for_each_raidset (lc, rs) { | ||
263 | - find_raid_sets_for_dev (name, uuid, major, minor, lc, rs, ret_sets); | ||
264 | - } | ||
265 | - | ||
266 | - /* now create the return value -- NULL-terminated array of strings */ | ||
267 | - ret = g_new0 (gchar*, ret_sets->len + 1); | ||
268 | - for (i=0; i < ret_sets->len; i++) | ||
269 | - ret[i] = (gchar*) g_ptr_array_index (ret_sets, i); | ||
270 | - ret[i] = NULL; | ||
271 | - | ||
272 | - g_ptr_array_free (ret_sets, FALSE); | ||
273 | - | ||
274 | - libdmraid_exit (lc); | ||
275 | - return ret; | ||
276 | -} | ||
277 | - | ||
278 | -/** | ||
279 | - * find_in_raid_sets: (skip) | ||
280 | - * | ||
281 | - * Runs @eval_fn with @data on each set (traversing recursively) and returns the | ||
282 | - * first RAID set that @eval_fn returns. Thus the @eval_fn should return %NULL | ||
283 | - * on all RAID sets that don't fulfill the search criteria. | ||
284 | - */ | ||
285 | -static struct raid_set* find_in_raid_sets (struct raid_set *rs, RSEvalFunc eval_fn, gpointer data) { | ||
286 | - struct raid_set *subset = NULL; | ||
287 | - struct raid_set *ret = NULL; | ||
288 | - | ||
289 | - ret = eval_fn (rs, data); | ||
290 | - if (ret) | ||
291 | - return ret; | ||
292 | - | ||
293 | - if (T_GROUP(rs) || !list_empty(&(rs->sets))) { | ||
294 | - for_each_subset (rs, subset) { | ||
295 | - ret = find_in_raid_sets (subset, eval_fn, data); | ||
296 | - if (ret) | ||
297 | - return ret; | ||
298 | - } | ||
299 | - } | ||
300 | - | ||
301 | - return ret; | ||
302 | -} | ||
303 | - | ||
304 | -static struct raid_set* rs_matches_name (struct raid_set *rs, gpointer *name_data) { | ||
305 | - gchar *name = (gchar*) name_data; | ||
306 | - | ||
307 | - if (g_strcmp0 (rs->name, name) == 0) | ||
308 | - return rs; | ||
309 | - else | ||
310 | - return NULL; | ||
311 | -} | ||
312 | - | ||
313 | -static gboolean change_set_by_name (const gchar *name, enum activate_type action, GError **error) { | ||
314 | - gint rc = 0; | ||
315 | - struct lib_context *lc; | ||
316 | - struct raid_set *iter_rs; | ||
317 | - struct raid_set *match_rs = NULL; | ||
318 | - | ||
319 | - lc = init_dmraid_stack (error); | ||
320 | - if (!lc) | ||
321 | - /* error is already populated */ | ||
322 | - return FALSE; | ||
323 | - | ||
324 | - for_each_raidset (lc, iter_rs) { | ||
325 | - match_rs = find_in_raid_sets (iter_rs, (RSEvalFunc)rs_matches_name, (gchar *)name); | ||
326 | - if (match_rs) | ||
327 | - break; | ||
328 | - } | ||
329 | - | ||
330 | - if (!match_rs) { | ||
331 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_NO_EXIST, | ||
332 | - "RAID set %s doesn't exist", name); | ||
333 | - libdmraid_exit (lc); | ||
334 | - return FALSE; | ||
335 | - } | ||
336 | - | ||
337 | - rc = change_set (lc, action, match_rs); | ||
338 | - if (!rc) { | ||
339 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_FAIL, | ||
340 | - "Failed to activate the RAID set '%s'", name); | ||
341 | - libdmraid_exit (lc); | ||
342 | - return FALSE; | ||
343 | - } | ||
344 | - | ||
345 | - libdmraid_exit (lc); | ||
346 | - return TRUE; | ||
347 | -} | ||
348 | - | ||
349 | -/** | ||
350 | - * bd_dm_activate_raid_set: | ||
351 | - * @name: name of the DM RAID set to activate | ||
352 | - * @error: (out): variable to store error (if any) | ||
353 | - * | ||
354 | - * Returns: whether the RAID set @name was successfully activate or not | ||
355 | - */ | ||
356 | -gboolean bd_dm_activate_raid_set (const gchar *name, GError **error) { | ||
357 | - guint64 progress_id = 0; | ||
358 | - gchar *msg = NULL; | ||
359 | - gboolean ret = FALSE; | ||
360 | - | ||
361 | - msg = g_strdup_printf ("Activating DM RAID set '%s'", name); | ||
362 | - progress_id = bd_utils_report_started (msg); | ||
363 | - g_free (msg); | ||
364 | - ret = change_set_by_name (name, A_ACTIVATE, error); | ||
365 | - bd_utils_report_finished (progress_id, "Completed"); | ||
366 | - return ret; | ||
367 | -} | ||
368 | - | ||
369 | -/** | ||
370 | - * bd_dm_deactivate_raid_set: | ||
371 | - * @name: name of the DM RAID set to deactivate | ||
372 | - * @error: (out): variable to store error (if any) | ||
373 | - * | ||
374 | - * Returns: whether the RAID set @name was successfully deactivate or not | ||
375 | - */ | ||
376 | -gboolean bd_dm_deactivate_raid_set (const gchar *name, GError **error) { | ||
377 | - guint64 progress_id = 0; | ||
378 | - gchar *msg = NULL; | ||
379 | - gboolean ret = FALSE; | ||
380 | - | ||
381 | - msg = g_strdup_printf ("Deactivating DM RAID set '%s'", name); | ||
382 | - progress_id = bd_utils_report_started (msg); | ||
383 | - g_free (msg); | ||
384 | - ret = change_set_by_name (name, A_DEACTIVATE, error); | ||
385 | - bd_utils_report_finished (progress_id, "Completed"); | ||
386 | - return ret; | ||
387 | -} | ||
388 | - | ||
389 | -/** | ||
390 | - * bd_dm_get_raid_set_type: | ||
391 | - * @name: name of the DM RAID set to get the type of | ||
392 | - * @error: (out): variable to store error (if any) | ||
393 | - * | ||
394 | - * Returns: string representation of the @name RAID set's type | ||
395 | - */ | ||
396 | -gchar* bd_dm_get_raid_set_type (const gchar *name, GError **error) { | ||
397 | - struct lib_context *lc; | ||
398 | - struct raid_set *iter_rs; | ||
399 | - struct raid_set *match_rs = NULL; | ||
400 | - const gchar *type = NULL; | ||
401 | - | ||
402 | - lc = init_dmraid_stack (error); | ||
403 | - if (!lc) | ||
404 | - /* error is already populated */ | ||
405 | - return NULL; | ||
406 | - | ||
407 | - for_each_raidset (lc, iter_rs) { | ||
408 | - match_rs = find_in_raid_sets (iter_rs, (RSEvalFunc)rs_matches_name, (gchar *)name); | ||
409 | - if (match_rs) | ||
410 | - break; | ||
411 | - } | ||
412 | - | ||
413 | - if (!match_rs) { | ||
414 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_NO_EXIST, | ||
415 | - "RAID set %s doesn't exist", name); | ||
416 | - libdmraid_exit (lc); | ||
417 | - return NULL; | ||
418 | - } | ||
419 | - | ||
420 | - type = get_set_type (lc, match_rs); | ||
421 | - if (!type) { | ||
422 | - g_set_error (error, BD_DM_ERROR, BD_DM_ERROR_RAID_FAIL, | ||
423 | - "Failed to get RAID set's type"); | ||
424 | - libdmraid_exit (lc); | ||
425 | - return NULL; | ||
426 | - } | ||
427 | - | ||
428 | - libdmraid_exit (lc); | ||
429 | - return g_strdup (type); | ||
430 | -} | ||
431 | diff --git a/src/plugins/dm.h b/src/plugins/dm.h | ||
432 | index 859fb80..80acd49 100644 | ||
433 | --- a/src/plugins/dm.h | ||
434 | +++ b/src/plugins/dm.h | ||
435 | @@ -1,5 +1,4 @@ | ||
436 | #include <glib.h> | ||
437 | -#include <dmraid/dmraid.h> | ||
438 | |||
439 | #ifndef BD_DM | ||
440 | #define BD_DM | ||
441 | @@ -35,9 +34,5 @@ gboolean bd_dm_remove (const gchar *map_name, GError **error); | ||
442 | gchar* bd_dm_name_from_node (const gchar *dm_node, GError **error); | ||
443 | gchar* bd_dm_node_from_name (const gchar *map_name, GError **error); | ||
444 | gboolean bd_dm_map_exists (const gchar *map_name, gboolean live_only, gboolean active_only, GError **error); | ||
445 | -gchar** bd_dm_get_member_raid_sets (const gchar *name, const gchar *uuid, gint major, gint minor, GError **error); | ||
446 | -gboolean bd_dm_activate_raid_set (const gchar *name, GError **error); | ||
447 | -gboolean bd_dm_deactivate_raid_set (const gchar *name, GError **error); | ||
448 | -gchar* bd_dm_get_raid_set_type (const gchar *name, GError **error); | ||
449 | |||
450 | #endif /* BD_DM */ | ||
451 | diff --git a/src/python/gi/overrides/BlockDev.py b/src/python/gi/overrides/BlockDev.py | ||
452 | index fb3ffb4..eed0a38 100644 | ||
453 | --- a/src/python/gi/overrides/BlockDev.py | ||
454 | +++ b/src/python/gi/overrides/BlockDev.py | ||
455 | @@ -233,12 +233,6 @@ def dm_create_linear(map_name, device, length, uuid=None): | ||
456 | return _dm_create_linear(map_name, device, length, uuid) | ||
457 | __all__.append("dm_create_linear") | ||
458 | |||
459 | -_dm_get_member_raid_sets = BlockDev.dm_get_member_raid_sets | ||
460 | -@override(BlockDev.dm_get_member_raid_sets) | ||
461 | -def dm_get_member_raid_sets(name=None, uuid=None, major=-1, minor=-1): | ||
462 | - return _dm_get_member_raid_sets(name, uuid, major, minor) | ||
463 | -__all__.append("dm_get_member_raid_sets") | ||
464 | - | ||
465 | |||
466 | _loop_setup = BlockDev.loop_setup | ||
467 | @override(BlockDev.loop_setup) | ||
468 | -- | ||
469 | 1.8.3.1 | ||
470 | |||
diff --git a/meta-oe/recipes-extended/libblockdev/files/0004-fix-compile-failure-against-musl-C-library.patch b/meta-oe/recipes-extended/libblockdev/files/0004-fix-compile-failure-against-musl-C-library.patch new file mode 100644 index 0000000000..f18b569285 --- /dev/null +++ b/meta-oe/recipes-extended/libblockdev/files/0004-fix-compile-failure-against-musl-C-library.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 59fbd57acd1df25b1972a131dc6a77a4fe147729 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 27 Jul 2017 10:45:02 +0800 | ||
4 | Subject: [PATCH] fix compile failure against musl C library | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
9 | --- | ||
10 | src/plugins/crypto.c | 2 +- | ||
11 | src/plugins/part.c | 3 ++- | ||
12 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c | ||
15 | index 8fbce4f..66e11e5 100644 | ||
16 | --- a/src/plugins/crypto.c | ||
17 | +++ b/src/plugins/crypto.c | ||
18 | @@ -22,7 +22,7 @@ | ||
19 | #include <libcryptsetup.h> | ||
20 | #include <nss.h> | ||
21 | #include <volume_key/libvolume_key.h> | ||
22 | -#include <sys/fcntl.h> | ||
23 | +#include <fcntl.h> | ||
24 | #include <sys/ioctl.h> | ||
25 | #include <linux/random.h> | ||
26 | #include <locale.h> | ||
27 | diff --git a/src/plugins/part.c b/src/plugins/part.c | ||
28 | index 12d2ef7..3afe297 100644 | ||
29 | --- a/src/plugins/part.c | ||
30 | +++ b/src/plugins/part.c | ||
31 | @@ -25,6 +25,7 @@ | ||
32 | #include <inttypes.h> | ||
33 | #include <unistd.h> | ||
34 | #include <sys/file.h> | ||
35 | +#include <fcntl.h> | ||
36 | #include <blockdev/utils.h> | ||
37 | #include <part_err.h> | ||
38 | |||
39 | @@ -1224,7 +1225,7 @@ static gboolean set_gpt_flags (const gchar *device, int part_num, guint64 flags, | ||
40 | real_flags |= 0x4000000000000000; /* 1 << 62 */ | ||
41 | if (flags & BD_PART_FLAG_GPT_NO_AUTOMOUNT) | ||
42 | real_flags |= 0x8000000000000000; /* 1 << 63 */ | ||
43 | - mask_str = g_strdup_printf ("%.16"__PRI64_PREFIX"x", real_flags); | ||
44 | + mask_str = g_strdup_printf ("%.16"__PRI64"x", real_flags); | ||
45 | |||
46 | args[2] = g_strdup_printf ("%d:=:%s", part_num, mask_str); | ||
47 | g_free (mask_str); | ||
48 | -- | ||
49 | 1.8.3.1 | ||
50 | |||
diff --git a/meta-oe/recipes-extended/libblockdev/libblockdev_2.10.bb b/meta-oe/recipes-extended/libblockdev/libblockdev_2.10.bb new file mode 100644 index 0000000000..4806dcd695 --- /dev/null +++ b/meta-oe/recipes-extended/libblockdev/libblockdev_2.10.bb | |||
@@ -0,0 +1,50 @@ | |||
1 | DESCRIPTION = "libblockdev is a C library supporting GObject introspection for manipulation of \ | ||
2 | block devices. It has a plugin-based architecture where each technology (like \ | ||
3 | LVM, Btrfs, MD RAID, Swap,...) is implemented in a separate plugin, possibly \ | ||
4 | with multiple implementations (e.g. using LVM CLI or the new LVM DBus API)." | ||
5 | HOMEPAGE = "http://rhinstaller.github.io/libblockdev/" | ||
6 | LICENSE = "LGPLv2+" | ||
7 | SECTION = "devel/lib" | ||
8 | |||
9 | LIC_FILES_CHKSUM = "file://LICENSE;md5=c07cb499d259452f324bb90c3067d85c" | ||
10 | |||
11 | S = "${WORKDIR}/git" | ||
12 | B = "${S}" | ||
13 | |||
14 | SRCREV = "c1dda45001542edd7d7f1ffc6451c5a74623f805" | ||
15 | SRC_URI = "git://github.com/rhinstaller/libblockdev;branch=master \ | ||
16 | file://0001-fix-configure-and-compile-failures.patch \ | ||
17 | file://0002-remove-python2-support.patch \ | ||
18 | file://0003-remove-dmraid-while-compiling-with-with-dm.patch \ | ||
19 | " | ||
20 | SRC_URI_append_libc-musl = " \ | ||
21 | file://0004-fix-compile-failure-against-musl-C-library.patch \ | ||
22 | " | ||
23 | |||
24 | inherit autotools python3native gobject-introspection | ||
25 | |||
26 | DEPENDS += " \ | ||
27 | cryptsetup \ | ||
28 | nss \ | ||
29 | volume-key \ | ||
30 | libbytesize \ | ||
31 | btrfs-tools \ | ||
32 | " | ||
33 | RDEPENDS_${PN} += " \ | ||
34 | lvm2 \ | ||
35 | " | ||
36 | |||
37 | FILES_${PN} += "${PYTHON_SITEPACKAGES_DIR}" | ||
38 | |||
39 | PACKAGECONFIG ??= "python3 lvm dm kmod parted fs" | ||
40 | PACKAGECONFIG[python3] = "--with-python3, --without-python3,,python3" | ||
41 | PACKAGECONFIG[lvm] = "--with-lvm, --without-lvm, multipath-tools" | ||
42 | PACKAGECONFIG[dm] = "--with-dm, --without-dm" | ||
43 | PACKAGECONFIG[kmod] = "--with-kbd, --without-kbd, kmod" | ||
44 | PACKAGECONFIG[parted] = "--with-part, --without-part, parted" | ||
45 | PACKAGECONFIG[fs] = "--with-fs, --without-fs, util-linux" | ||
46 | PACKAGECONFIG[doc] = "--with-gtk-doc, --without-gtk-doc, gtk-doc-native" | ||
47 | |||
48 | export STAGING_INCDIR | ||
49 | export GIR_EXTRA_LIBS_PATH="${B}/src/utils/.libs" | ||
50 | |||