Skip to content

Commit ef1c698

Browse files
Merge pull request #1182 from vojtechtrefny/master_lvm-json
Switch to JSON-based output parsing for LVM commands
2 parents 9dc822a + 9663e3d commit ef1c698

30 files changed

Lines changed: 656 additions & 656 deletions

configure.ac

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ AS_IF([test "x$with_dm" != "xno" -o "x$with_lvm" != "xno" -o "x$with_lvm_dbus" !
226226
[])
227227

228228
AS_IF([test "x$with_lvm" != "xno" -o "x$with_lvm_dbus" != "xno"],
229-
[LIBBLOCKDEV_PKG_CHECK_MODULES([YAML], [yaml-0.1])],
229+
[LIBBLOCKDEV_PKG_CHECK_MODULES([YAML], [yaml-0.1])
230+
LIBBLOCKDEV_PKG_CHECK_MODULES([JSON_GLIB], [json-glib-1.0])],
230231
[])
231232

232233
AS_IF([test "x$with_part" != "xno"],

scripts/boilerplate_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ def get_loading_func(fn_infos, module_name):
198198
ret += ' char *error = NULL;\n'
199199
ret += ' gboolean (*init_fn) (void) = NULL;\n\n'
200200

201-
ret += ' handle = dlopen(so_name, RTLD_LAZY);\n'
201+
ret += ' handle = dlopen(so_name, RTLD_LAZY | RTLD_NODELETE);\n'
202202
ret += ' if (!handle) {\n'
203203
ret += ' bd_utils_log_format (BD_UTILS_LOG_WARNING, "failed to load module {0}: %s", dlerror());\n'.format(module_name)
204204
ret += ' return NULL;\n'

src/plugins/btrfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ gboolean bd_btrfs_init (void) {
150150
*
151151
*/
152152
void bd_btrfs_close (void) {
153-
/* nothing to do here */
153+
g_atomic_int_set (&avail_deps, 0);
154+
g_atomic_int_set (&avail_module_deps, 0);
154155
}
155156

156157

src/plugins/dm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ gboolean bd_dm_init (void) {
8989
void bd_dm_close (void) {
9090
dm_log_with_errno_init (NULL);
9191
dm_log_init_verbose (0);
92+
g_atomic_int_set (&avail_deps, 0);
9293
}
9394

9495
/**

src/plugins/fs.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <check_deps.h>
2424
#include "fs.h"
25+
#include "fs/common.h"
2526

2627
/**
2728
* SECTION: fs
@@ -72,7 +73,15 @@ gboolean bd_fs_init (void) {
7273
*
7374
*/
7475
void bd_fs_close (void) {
75-
/* nothing to do here */
76+
_fs_ext_reset_avail_deps ();
77+
_fs_xfs_reset_avail_deps ();
78+
_fs_vfat_reset_avail_deps ();
79+
_fs_ntfs_reset_avail_deps ();
80+
_fs_exfat_reset_avail_deps ();
81+
_fs_btrfs_reset_avail_deps ();
82+
_fs_udf_reset_avail_deps ();
83+
_fs_f2fs_reset_avail_deps ();
84+
_fs_nilfs_reset_avail_deps ();
7685
}
7786

7887
/**

src/plugins/fs/btrfs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
static volatile guint avail_deps = 0;
2929
static GMutex deps_check_lock;
3030

31+
G_GNUC_INTERNAL
32+
void _fs_btrfs_reset_avail_deps (void) {
33+
g_atomic_int_set (&avail_deps, 0);
34+
}
35+
3136
#define DEPS_MKFSBTRFS 0
3237
#define DEPS_MKFSBTRFS_MASK (1 << DEPS_MKFSBTRFS)
3338
#define DEPS_BTRFSCK 1

src/plugins/fs/common.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ gint synced_close (gint fd);
1111
gboolean get_uuid_label (const gchar *device, gchar **uuid, gchar **label, GError **error);
1212
gboolean check_uuid (const gchar *uuid, GError **error);
1313

14+
void _fs_ext_reset_avail_deps (void);
15+
void _fs_xfs_reset_avail_deps (void);
16+
void _fs_vfat_reset_avail_deps (void);
17+
void _fs_ntfs_reset_avail_deps (void);
18+
void _fs_exfat_reset_avail_deps (void);
19+
void _fs_btrfs_reset_avail_deps (void);
20+
void _fs_udf_reset_avail_deps (void);
21+
void _fs_f2fs_reset_avail_deps (void);
22+
void _fs_nilfs_reset_avail_deps (void);
23+
1424
#endif /* BD_FS_COMMON */

src/plugins/fs/exfat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
static volatile guint avail_deps = 0;
2828
static GMutex deps_check_lock;
2929

30+
G_GNUC_INTERNAL
31+
void _fs_exfat_reset_avail_deps (void) {
32+
g_atomic_int_set (&avail_deps, 0);
33+
}
34+
3035
#define DEPS_MKEXFAT 0
3136
#define DEPS_MKEXFAT_MASK (1 << DEPS_MKEXFAT)
3237
#define DEPS_FSCKEXFAT 1

src/plugins/fs/ext.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
static volatile guint avail_deps = 0;
3535
static GMutex deps_check_lock;
3636

37+
G_GNUC_INTERNAL
38+
void _fs_ext_reset_avail_deps (void) {
39+
g_atomic_int_set (&avail_deps, 0);
40+
}
41+
3742
#define DEPS_MKE2FS 0
3843
#define DEPS_MKE2FS_MASK (1 << DEPS_MKE2FS)
3944
#define DEPS_E2FSCK 1

src/plugins/fs/f2fs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ static volatile guint avail_deps = 0;
2828
static volatile guint avail_shrink_deps = 0;
2929
static GMutex deps_check_lock;
3030

31+
G_GNUC_INTERNAL
32+
void _fs_f2fs_reset_avail_deps (void) {
33+
g_atomic_int_set (&avail_deps, 0);
34+
g_atomic_int_set (&avail_shrink_deps, 0);
35+
}
36+
3137
#define DEPS_MKFSF2FS 0
3238
#define DEPS_MKFSF2FS_MASK (1 << DEPS_MKFSF2FS)
3339
#define DEPS_CHECKF2FS 1

0 commit comments

Comments
 (0)