|
|
e1e9d4 |
daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c | 2 +-
|
|
|
e1e9d4 |
tools/lvm2cmd-static.c | 7 ++++++-
|
|
|
e1e9d4 |
tools/lvm2cmd.c | 7 ++++++-
|
|
|
e1e9d4 |
tools/lvm2cmd.h | 6 ++++++
|
|
|
e1e9d4 |
tools/lvm2cmdline.h | 4 ++--
|
|
|
e1e9d4 |
tools/lvmcmdlib.c | 4 ++--
|
|
|
e1e9d4 |
tools/lvmcmdline.c | 8 +++++---
|
|
|
e1e9d4 |
7 files changed, 28 insertions(+), 10 deletions(-)
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
diff --git a/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c b/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
|
|
|
e1e9d4 |
index be58aac..5c52867 100644
|
|
|
e1e9d4 |
--- a/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
|
|
|
e1e9d4 |
+++ b/daemons/dmeventd/plugins/lvm2/dmeventd_lvm.c
|
|
|
e1e9d4 |
@@ -71,7 +71,7 @@ int dmeventd_lvm2_init(void)
|
|
|
e1e9d4 |
if (!_lvm_handle) {
|
|
|
e1e9d4 |
lvm2_log_fn(_lvm2_print_log);
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
- if (!(_lvm_handle = lvm2_init()))
|
|
|
e1e9d4 |
+ if (!(_lvm_handle = lvm2_init_threaded()))
|
|
|
e1e9d4 |
goto out;
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
/*
|
|
|
e1e9d4 |
diff --git a/tools/lvm2cmd-static.c b/tools/lvm2cmd-static.c
|
|
|
e1e9d4 |
index 4fb109c..31c7515 100644
|
|
|
e1e9d4 |
--- a/tools/lvm2cmd-static.c
|
|
|
e1e9d4 |
+++ b/tools/lvm2cmd-static.c
|
|
|
e1e9d4 |
@@ -17,5 +17,10 @@
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
void *lvm2_init(void)
|
|
|
e1e9d4 |
{
|
|
|
e1e9d4 |
- return cmdlib_lvm2_init(1);
|
|
|
e1e9d4 |
+ return cmdlib_lvm2_init(1, 0);
|
|
|
e1e9d4 |
+}
|
|
|
e1e9d4 |
+
|
|
|
e1e9d4 |
+void *lvm2_init_threaded(void)
|
|
|
e1e9d4 |
+{
|
|
|
e1e9d4 |
+ return cmdlib_lvm2_init(1, 1);
|
|
|
e1e9d4 |
}
|
|
|
e1e9d4 |
diff --git a/tools/lvm2cmd.c b/tools/lvm2cmd.c
|
|
|
e1e9d4 |
index 235540c..aca3e65 100644
|
|
|
e1e9d4 |
--- a/tools/lvm2cmd.c
|
|
|
e1e9d4 |
+++ b/tools/lvm2cmd.c
|
|
|
e1e9d4 |
@@ -17,7 +17,12 @@
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
void *lvm2_init(void)
|
|
|
e1e9d4 |
{
|
|
|
e1e9d4 |
- return cmdlib_lvm2_init(0);
|
|
|
e1e9d4 |
+ return cmdlib_lvm2_init(0, 0);
|
|
|
e1e9d4 |
+}
|
|
|
e1e9d4 |
+
|
|
|
e1e9d4 |
+void *lvm2_init_threaded(void)
|
|
|
e1e9d4 |
+{
|
|
|
e1e9d4 |
+ return cmdlib_lvm2_init(0, 1);
|
|
|
e1e9d4 |
}
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
int lvm_shell(struct cmd_context *cmd __attribute__((unused)),
|
|
|
e1e9d4 |
diff --git a/tools/lvm2cmd.h b/tools/lvm2cmd.h
|
|
|
e1e9d4 |
index cd2e0ec..39a8d60 100644
|
|
|
e1e9d4 |
--- a/tools/lvm2cmd.h
|
|
|
e1e9d4 |
+++ b/tools/lvm2cmd.h
|
|
|
e1e9d4 |
@@ -59,6 +59,12 @@ void lvm2_log_fn(lvm2_log_fn_t log_fn);
|
|
|
e1e9d4 |
void *lvm2_init(void);
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
/*
|
|
|
e1e9d4 |
+ * Initialise library for threaded user
|
|
|
e1e9d4 |
+ * Returns a handle so repeated use of lvm2_run is more efficient.
|
|
|
e1e9d4 |
+ */
|
|
|
e1e9d4 |
+void *lvm2_init_threaded(void);
|
|
|
e1e9d4 |
+
|
|
|
e1e9d4 |
+/*
|
|
|
e1e9d4 |
* Disable any dmeventd calls that the library may otherwise do. Useful to avoid
|
|
|
e1e9d4 |
* recursive calls from dmeventd to itself.
|
|
|
e1e9d4 |
*/
|
|
|
e1e9d4 |
diff --git a/tools/lvm2cmdline.h b/tools/lvm2cmdline.h
|
|
|
e1e9d4 |
index 0073f90..84cab93 100644
|
|
|
e1e9d4 |
--- a/tools/lvm2cmdline.h
|
|
|
e1e9d4 |
+++ b/tools/lvm2cmdline.h
|
|
|
e1e9d4 |
@@ -28,10 +28,10 @@ struct cmdline_context {
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
int lvm2_main(int argc, char **argv);
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
-void *cmdlib_lvm2_init(unsigned static_compile);
|
|
|
e1e9d4 |
+void *cmdlib_lvm2_init(unsigned static_compile, unsigned threaded);
|
|
|
e1e9d4 |
void lvm_fin(struct cmd_context *cmd);
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
-struct cmd_context *init_lvm(unsigned set_connections, unsigned set_filters);
|
|
|
e1e9d4 |
+struct cmd_context *init_lvm(unsigned set_connections, unsigned set_filters, unsigned threaded);
|
|
|
e1e9d4 |
int lvm_register_commands(struct cmd_context *cmdtool, const char *name);
|
|
|
e1e9d4 |
int lvm_split(char *str, int *argc, char **argv, int max);
|
|
|
e1e9d4 |
int lvm_run_command(struct cmd_context *cmd, int argc, char **argv);
|
|
|
e1e9d4 |
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
|
|
|
e1e9d4 |
index 5944576..a2754ea 100644
|
|
|
e1e9d4 |
--- a/tools/lvmcmdlib.c
|
|
|
e1e9d4 |
+++ b/tools/lvmcmdlib.c
|
|
|
e1e9d4 |
@@ -26,12 +26,12 @@
|
|
|
e1e9d4 |
#include <time.h>
|
|
|
e1e9d4 |
#include <sys/resource.h>
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
-void *cmdlib_lvm2_init(unsigned static_compile)
|
|
|
e1e9d4 |
+void *cmdlib_lvm2_init(unsigned static_compile, unsigned threaded)
|
|
|
e1e9d4 |
{
|
|
|
e1e9d4 |
struct cmd_context *cmd;
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
init_is_static(static_compile);
|
|
|
e1e9d4 |
- if (!(cmd = init_lvm(1, 1)))
|
|
|
e1e9d4 |
+ if (!(cmd = init_lvm(1, 1, threaded)))
|
|
|
e1e9d4 |
return NULL;
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
if (!lvm_register_commands(cmd, NULL))
|
|
|
e1e9d4 |
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
|
|
|
e1e9d4 |
index 75a0401..f6814ad 100644
|
|
|
e1e9d4 |
--- a/tools/lvmcmdline.c
|
|
|
e1e9d4 |
+++ b/tools/lvmcmdline.c
|
|
|
e1e9d4 |
@@ -3311,7 +3311,9 @@ static int _close_stray_fds(const char *command, struct custom_fds *custom_fds)
|
|
|
e1e9d4 |
return 1;
|
|
|
e1e9d4 |
}
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
-struct cmd_context *init_lvm(unsigned set_connections, unsigned set_filters)
|
|
|
e1e9d4 |
+struct cmd_context *init_lvm(unsigned set_connections,
|
|
|
e1e9d4 |
+ unsigned set_filters,
|
|
|
e1e9d4 |
+ unsigned threaded)
|
|
|
e1e9d4 |
{
|
|
|
e1e9d4 |
struct cmd_context *cmd;
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
@@ -3325,7 +3327,7 @@ struct cmd_context *init_lvm(unsigned set_connections, unsigned set_filters)
|
|
|
e1e9d4 |
*/
|
|
|
e1e9d4 |
dm_set_name_mangling_mode(DM_STRING_MANGLING_NONE);
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
- if (!(cmd = create_toolcontext(0, NULL, 1, 0,
|
|
|
e1e9d4 |
+ if (!(cmd = create_toolcontext(0, NULL, 1, threaded,
|
|
|
e1e9d4 |
set_connections, set_filters))) {
|
|
|
e1e9d4 |
udev_fin_library_context();
|
|
|
e1e9d4 |
return_NULL;
|
|
|
e1e9d4 |
@@ -3514,7 +3516,7 @@ int lvm2_main(int argc, char **argv)
|
|
|
e1e9d4 |
if (!alias && (argc > 2) && !strcmp(argv[2], "-?"))
|
|
|
e1e9d4 |
argv[2] = (char *)"-h";
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
- if (!(cmd = init_lvm(0, 0)))
|
|
|
e1e9d4 |
+ if (!(cmd = init_lvm(0, 0, 0)))
|
|
|
e1e9d4 |
return EINIT_FAILED;
|
|
|
e1e9d4 |
|
|
|
e1e9d4 |
/* Store original argv location so we may customise it if we become a daemon */
|