Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jb39820' into 'master'
[libblockdev] Add initial packaging. Contributes to JB#39820 See merge request !1
- Loading branch information
Showing
7 changed files
with
526 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "libblockdev"] | ||
path = libblockdev | ||
url = https://github.com/storaged-project/libblockdev.git |
Submodule libblockdev
added at
226bb9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
From 1556bb275f87f7860511b8cd81a53c77265c8fad Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Tue, 28 Nov 2017 15:32:52 +0200 | ||
Subject: [PATCH 1/4] Fix acinclude mktemp | ||
|
||
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com> | ||
--- | ||
acinclude.m4 | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/acinclude.m4 b/acinclude.m4 | ||
index 5c54d4a..df638f3 100644 | ||
--- a/acinclude.m4 | ||
+++ b/acinclude.m4 | ||
@@ -65,7 +65,7 @@ dnl file that just includes the HEADER using the given CFLAGS. In case of | ||
dnl failure, the ERR_MSG will be printed using the LIBBLOCKDEV_FAILURES macro. | ||
AC_DEFUN([LIBBLOCKDEV_CHECK_HEADER], [dnl | ||
echo -n "Checking header [$1] existence and usability..." | ||
-temp_file=$(mktemp --tmpdir XXXXX.c) | ||
+temp_file=$(mktemp) | ||
echo "#include <$1>" > $temp_file | ||
${CC} -c [$2] $temp_file | ||
status=$? | ||
-- | ||
2.7.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
From f8063c58688051c51e3173a8e6f58805ee2c985b Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Tue, 28 Nov 2017 15:33:09 +0200 | ||
Subject: [PATCH 2/4] Drop Python | ||
|
||
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com> | ||
--- | ||
src/Makefile.am | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/src/Makefile.am b/src/Makefile.am | ||
index 3e18de0..cb850a9 100644 | ||
--- a/src/Makefile.am | ||
+++ b/src/Makefile.am | ||
@@ -1,3 +1,3 @@ | ||
-SUBDIRS = utils plugins lib python | ||
+SUBDIRS = utils plugins lib | ||
|
||
MAINTAINERCLEANFILES = Makefile.in | ||
-- | ||
2.7.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
From 046ac6848e0c2c5fcab4eaa596630d523d0f5c20 Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Thu, 7 Dec 2017 10:53:04 +0200 | ||
Subject: [PATCH 3/4] Make vfat resizing optional | ||
|
||
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com> | ||
--- | ||
src/plugins/fs.c | 20 +++++++++++++++++++- | ||
1 file changed, 19 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/plugins/fs.c b/src/plugins/fs.c | ||
index 48faa07..6b03d62 100644 | ||
--- a/src/plugins/fs.c | ||
+++ b/src/plugins/fs.c | ||
@@ -18,8 +18,12 @@ | ||
*/ | ||
|
||
#define _GNU_SOURCE | ||
-#include <unistd.h> | ||
|
||
+#ifndef ENABLE_VFAT_RESIZE | ||
+#define ENABLE_VFAT_RESIZE 0 | ||
+#endif | ||
+ | ||
+#include <unistd.h> | ||
#include <blockdev/utils.h> | ||
#include <fcntl.h> | ||
#include <string.h> | ||
@@ -2954,6 +2958,7 @@ BDFSVfatInfo* bd_fs_vfat_get_info (const gchar *device, GError **error) { | ||
* Tech category: %BD_FS_TECH_VFAT-%BD_FS_TECH_MODE_RESIZE | ||
*/ | ||
gboolean bd_fs_vfat_resize (const gchar *device, guint64 new_size, GError **error) { | ||
+#if ENABLE_VFAT_RESIZE | ||
PedDevice *ped_dev = NULL; | ||
PedGeometry geom = {0}; | ||
PedGeometry new_geom = {0}; | ||
@@ -3032,7 +3037,20 @@ gboolean bd_fs_vfat_resize (const gchar *device, guint64 new_size, GError **erro | ||
bd_utils_report_finished (progress_id, "Completed"); | ||
|
||
return TRUE; | ||
+#else | ||
+ gchar *msg = NULL; | ||
+ guint64 progress_id = 0; | ||
+ msg = g_strdup_printf ("Unsupported resize operation '%s'", device); | ||
+ progress_id = bd_utils_report_started (msg); | ||
+ g_free (msg); | ||
+ (void)new_size; | ||
|
||
+ g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_NOT_SUPPORTED, | ||
+ "Resize operation in not supported '%s'", device); | ||
+ bd_utils_report_finished (progress_id, (*error)->message); | ||
+ set_parted_error (error, BD_FS_ERROR_NOT_SUPPORTED); | ||
+ return FALSE; | ||
+#endif | ||
} | ||
|
||
/** | ||
-- | ||
2.7.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
From 3ecf1beeeaaf7d7cbc8b85082f2933dcc659ca43 Mon Sep 17 00:00:00 2001 | ||
From: Raine Makelainen <raine.makelainen@jolla.com> | ||
Date: Thu, 7 Dec 2017 10:53:37 +0200 | ||
Subject: [PATCH 4/4] Drop libparted dependencies | ||
|
||
Signed-off-by: Raine Makelainen <raine.makelainen@jolla.com> | ||
--- | ||
configure.ac | 10 ++-------- | ||
src/plugins/fs.c | 9 +++++++++ | ||
src/plugins/part.c | 6 ++++++ | ||
src/plugins/part_err.c | 8 ++++++++ | ||
src/plugins/part_err.h | 8 +++++++- | ||
5 files changed, 32 insertions(+), 9 deletions(-) | ||
|
||
diff --git a/configure.ac b/configure.ac | ||
index 9e720e1..1414d4b 100644 | ||
--- a/configure.ac | ||
+++ b/configure.ac | ||
@@ -169,7 +169,7 @@ AS_IF([test "x$with_kbd" != "xno"], | ||
[]) | ||
|
||
|
||
-AS_IF([test "x$with_part" != "xno" -o "x$with_fs" != "xno"], | ||
+AS_IF([test "x$with_part" != "xno"], | ||
[LIBBLOCKDEV_PKG_CHECK_MODULES([PARTED], [libparted >= 3.1])] | ||
[]) | ||
|
||
@@ -184,13 +184,7 @@ AS_IF([test "x$with_fs" != "xno"], | ||
# define it as 0 (neutral value for bit combinations of flags) | ||
AS_IF([$PKG_CONFIG --atleast-version=2.27.0 blkid], [], | ||
[AC_DEFINE([BLKID_SUBLKS_BADCSUM], [0], | ||
- [Define as neutral value if libblkid doesn't provide the definition])]) | ||
- | ||
- # older versions of parted don't provide the libparted-fs-resize.pc file | ||
- AS_IF([$PKG_CONFIG libparted-fs-resize], | ||
- [LIBBLOCKDEV_PKG_CHECK_MODULES([PARTED_FS], [libparted-fs-resize >= 3.2])], | ||
- [AC_SUBST([PARTED_FS_LIBS], [-lparted-fs-resize]) | ||
- AC_SUBST([PARTED_FS_CFLAGS], [])])], | ||
+ [Define as neutral value if libblkid doesn't provide the definition])])], | ||
[]) | ||
|
||
AS_IF([test "x$with_btrfs" != "xno" -o "x$with_mdraid" != "xno" -o "x$with_kbd" != "xno"], | ||
diff --git a/src/plugins/fs.c b/src/plugins/fs.c | ||
index 6b03d62..1dd2790 100644 | ||
--- a/src/plugins/fs.c | ||
+++ b/src/plugins/fs.c | ||
@@ -23,13 +23,20 @@ | ||
#define ENABLE_VFAT_RESIZE 0 | ||
#endif | ||
|
||
+#ifndef HAVE_PARTED | ||
+#define HAVE_PARTED 0 | ||
+#endif | ||
+ | ||
#include <unistd.h> | ||
#include <blockdev/utils.h> | ||
#include <fcntl.h> | ||
#include <string.h> | ||
+#include <stdlib.h> | ||
#include <blkid.h> | ||
#include <ctype.h> | ||
+#if HAVE_PARTED | ||
#include <parted/parted.h> | ||
+#endif | ||
#include <part_err.h> | ||
#include <libmount/libmount.h> | ||
#include <sys/types.h> | ||
@@ -367,7 +374,9 @@ gboolean bd_fs_check_deps () { | ||
* | ||
*/ | ||
gboolean bd_fs_init () { | ||
+#if HAVE_PARTED | ||
ped_exception_set_handler ((PedExceptionHandler*) bd_exc_handler); | ||
+#endif | ||
return TRUE; | ||
} | ||
|
||
diff --git a/src/plugins/part.c b/src/plugins/part.c | ||
index 8f0d7fd..a38d30b 100644 | ||
--- a/src/plugins/part.c | ||
+++ b/src/plugins/part.c | ||
@@ -17,8 +17,14 @@ | ||
* Author: Vratislav Podzimek <vpodzime@redhat.com> | ||
*/ | ||
|
||
+#ifndef HAVE_PARTED | ||
+#define HAVE_PARTED 0 | ||
+#endif | ||
+ | ||
#include <string.h> | ||
+#if HAVE_PARTED | ||
#include <parted/parted.h> | ||
+#endif | ||
#include <ctype.h> | ||
#include <stdlib.h> | ||
#include <math.h> | ||
diff --git a/src/plugins/part_err.c b/src/plugins/part_err.c | ||
index 87d6c2e..f31bb9f 100644 | ||
--- a/src/plugins/part_err.c | ||
+++ b/src/plugins/part_err.c | ||
@@ -17,13 +17,20 @@ | ||
* Author: Vojtech Trefny <vtrefny@redhat.com> | ||
*/ | ||
|
||
+#ifndef HAVE_PARTED | ||
+#define HAVE_PARTED 0 | ||
+#endif | ||
+ | ||
#include <glib.h> | ||
+#if HAVE_PARTED | ||
#include <parted/parted.h> | ||
+#endif | ||
|
||
#include "part_err.h" | ||
|
||
static __thread gchar *error_msg = NULL; | ||
|
||
+#if HAVE_PARTED | ||
PedExceptionOption bd_exc_handler (PedException *ex) { | ||
if (ex->type <= PED_EXCEPTION_WARNING && (ex->options & PED_EXCEPTION_IGNORE) != 0) { | ||
g_warning ("[parted] %s", ex->message); | ||
@@ -32,6 +39,7 @@ PedExceptionOption bd_exc_handler (PedException *ex) { | ||
error_msg = g_strdup (ex->message); | ||
return PED_EXCEPTION_UNHANDLED; | ||
} | ||
+#endif | ||
|
||
gchar * bd_get_error_msg () { | ||
return g_strdup (error_msg); | ||
diff --git a/src/plugins/part_err.h b/src/plugins/part_err.h | ||
index 252c4cb..cfb24a8 100644 | ||
--- a/src/plugins/part_err.h | ||
+++ b/src/plugins/part_err.h | ||
@@ -1,10 +1,16 @@ | ||
#include <glib.h> | ||
-#include <parted/parted.h> | ||
|
||
#ifndef BD_UTILS_PARTED | ||
#define BD_UTILS_PARTED | ||
|
||
+#if HAVE_PARTED | ||
+#include <parted/parted.h> | ||
+#endif | ||
+ | ||
+#if HAVE_PARTED | ||
PedExceptionOption bd_exc_handler (PedException *ex); | ||
+#endif | ||
gchar * bd_get_error_msg (); | ||
|
||
+ | ||
#endif /* BD_UTILS_PARTED */ | ||
-- | ||
2.7.4 | ||
|
Oops, something went wrong.