master - config: remove read_only_lock_modes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=633aea92fbcb22...
Commit: 633aea92fbcb228417ac2b4a1ac3d808460d8df5
Parent: e1733a6271fc0a270bcb5bd2a4b43b62e4a1ddd0
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 6 11:42:52 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 6 11:44:28 2015 -0500
config: remove read_only_lock_modes
It had been added as part of lvmlockd code, but it does
not seem particularly useful.
---
lib/config/config_settings.h | 4 ----
lib/locking/lvmlockd.c | 15 ---------------
2 files changed, 0 insertions(+), 19 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index b300b3a..74d421a 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -845,10 +845,6 @@ cfg(global_sanlock_lv_extend_CFG, "sanlock_lv_extend", global_CFG_SECTION, CFG_D
"the amount specified here. Setting this to 0 disables the\n"
"automatic extension and can cause lvcreate to fail.\n")
-cfg(global_read_only_lock_modes_CFG, "read_only_lock_modes", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 124), NULL, 0, NULL,
- "Limit commands to actions that use read locks.\n"
- "This disallows any actions that require a write (exclusive) lock.\n")
-
cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), "@THIN_CHECK_CMD@", 0, NULL,
"The full path to the thin_check command.\n"
"LVM uses this command to check that a thin metadata\n"
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 9e138d0..4fdb818 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1130,11 +1130,6 @@ int lockd_gl_create(struct cmd_context *cmd, const char *def_mode, const char *v
return 0;
}
- if (!strcmp(mode, "ex") && find_config_tree_bool(cmd, global_read_only_lock_modes_CFG, NULL)) {
- log_error("Exclusive global lock not allowed with read_only_lock_modes");
- return 0;
- }
-
req:
if (!_lockd_request(cmd, "lock_gl",
NULL, vg_lock_type, NULL, NULL, NULL, NULL, mode, NULL,
@@ -1365,11 +1360,6 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
return 0;
}
- if (!strcmp(mode, "ex") && find_config_tree_bool(cmd, global_read_only_lock_modes_CFG, NULL)) {
- log_error("Exclusive global lock not allowed with read_only_lock_modes");
- return 0;
- }
-
req:
log_debug("lockd global mode %s", mode);
@@ -1579,11 +1569,6 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
if (!mode)
mode = cmd->lockd_vg_default_sh ? "sh" : "ex";
- if (!strcmp(mode, "ex") && find_config_tree_bool(cmd, global_read_only_lock_modes_CFG, NULL)) {
- log_error("Exclusive VG lock not allowed with read_only_lock_modes");
- return 0;
- }
-
if (!strcmp(mode, "ex"))
*lockd_state |= LDST_EX;
8 years, 9 months
master - lockd: remove unused code for overriding lock modes
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e1733a6271fc0a...
Commit: e1733a6271fc0a270bcb5bd2a4b43b62e4a1ddd0
Parent: 114744cee1488112f51c49cbe71366ce8bfbd3ea
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 6 11:31:21 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 6 11:44:28 2015 -0500
lockd: remove unused code for overriding lock modes
including the allow_override_lock_modes setting.
It was not possible to override default lock modes any longer,
since the command line options had already been removed.
A mechanism will probably be required later that puts part of
this back.
---
lib/commands/toolcontext.h | 5 --
lib/config/config_settings.h | 3 -
lib/locking/lvmlockd.c | 120 +-----------------------------------------
3 files changed, 1 insertions(+), 127 deletions(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index 5e43dd8..283783f 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -149,11 +149,6 @@ struct cmd_context {
const char *report_list_item_separator;
int hosttags;
- /* Locking */
- const char *lock_gl_mode; /* gl mode, from --lock-gl */
- const char *lock_vg_mode; /* vg mode, from --lock-vg */
- const char *lock_lv_mode; /* lv mode, from --lock-lv */
-
const char *lib_dir; /* Cache value global/library_dir */
char system_dir[PATH_MAX];
char dev_dir[PATH_MAX];
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 16fd0bd..b300b3a 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -845,9 +845,6 @@ cfg(global_sanlock_lv_extend_CFG, "sanlock_lv_extend", global_CFG_SECTION, CFG_D
"the amount specified here. Setting this to 0 disables the\n"
"automatic extension and can cause lvcreate to fail.\n")
-cfg(global_allow_override_lock_modes_CFG, "allow_override_lock_modes", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 124), NULL, 0, NULL,
- "Allow command options to override normal locking.\n")
-
cfg(global_read_only_lock_modes_CFG, "read_only_lock_modes", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 124), NULL, 0, NULL,
"Limit commands to actions that use read locks.\n"
"This disallows any actions that require a write (exclusive) lock.\n")
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index f80ed75..9e138d0 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -828,9 +828,6 @@ int lockd_init_vg(struct cmd_context *cmd, struct volume_group *vg,
int lockd_free_vg_before(struct cmd_context *cmd, struct volume_group *vg)
{
- if (cmd->lock_vg_mode && !strcmp(cmd->lock_vg_mode, "na"))
- return 1;
-
switch (get_lock_type_from_string(vg->lock_type)) {
case LOCK_TYPE_NONE:
case LOCK_TYPE_CLVM:
@@ -849,9 +846,6 @@ int lockd_free_vg_before(struct cmd_context *cmd, struct volume_group *vg)
void lockd_free_vg_final(struct cmd_context *cmd, struct volume_group *vg)
{
- if (cmd->lock_vg_mode && !strcmp(cmd->lock_vg_mode, "na"))
- return;
-
switch (get_lock_type_from_string(vg->lock_type)) {
case LOCK_TYPE_NONE:
case LOCK_TYPE_CLVM:
@@ -892,10 +886,6 @@ int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg)
if (!is_lockd_type(vg->lock_type))
return 1;
- /* Skip starting the vg lockspace when the vg lock is skipped. */
- if (cmd->lock_vg_mode && !strcmp(cmd->lock_vg_mode, "na"))
- return 1;
-
if (!_use_lvmlockd) {
log_error("VG %s start failed: lvmlockd is not enabled", vg->name);
return 0;
@@ -1056,36 +1046,6 @@ int lockd_start_wait(struct cmd_context *cmd)
return ret;
}
-static int _mode_num(const char *mode)
-{
- if (!strcmp(mode, "na"))
- return -2;
- if (!strcmp(mode, "un"))
- return -1;
- if (!strcmp(mode, "nl"))
- return 0;
- if (!strcmp(mode, "sh"))
- return 1;
- if (!strcmp(mode, "ex"))
- return 2;
- return -3;
-}
-
-/* same rules as strcmp */
-static int _mode_compare(const char *m1, const char *m2)
-{
- int n1 = _mode_num(m1);
- int n2 = _mode_num(m2);
-
- if (n1 < n2)
- return -1;
- if (n1 == n2)
- return 0;
- if (n1 > n2)
- return 1;
- return -2;
-}
-
/*
* lockd_gl_create() is a variation of lockd_gl() used only by vgcreate.
* It handles the case that when using sanlock, the global lock does
@@ -1161,21 +1121,6 @@ int lockd_gl_create(struct cmd_context *cmd, const char *def_mode, const char *v
return 0;
}
- /*
- * A specific lock mode was given on the command line.
- */
- if (cmd->lock_gl_mode) {
- mode = cmd->lock_gl_mode;
- if (mode && def_mode && strcmp(mode, "enable") && (_mode_compare(mode, def_mode) < 0)) {
- if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-gl mode \"%s\"", mode);
- return 0;
- } else {
- log_warn("WARNING: overriding default global lock mode.");
- }
- }
- }
-
log_debug("lockd global lock_type %s", vg_lock_type);
if (!mode)
@@ -1409,28 +1354,10 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
return 1;
if (def_mode && !strcmp(def_mode, "un")) {
- if (cmd->lock_gl_mode && !strcmp(cmd->lock_gl_mode, "na"))
- return 1;
-
mode = "un";
goto req;
}
- /*
- * A specific lock mode was given on the command line.
- */
- if (cmd->lock_gl_mode) {
- mode = cmd->lock_gl_mode;
- if (mode && def_mode && (_mode_compare(mode, def_mode) < 0)) {
- if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-gl mode \"%s\"", mode);
- return 0;
- } else {
- log_warn("WARNING: overriding default global lock mode.");
- }
- }
- }
-
if (!mode)
mode = def_mode;
if (!mode) {
@@ -1629,9 +1556,6 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
* passed back to lockd_vg() for the corresponding unlock.
*/
if (def_mode && !strcmp(def_mode, "un")) {
- if (cmd->lock_vg_mode && !strcmp(cmd->lock_vg_mode, "na"))
- return 1;
-
if (prev_state & LDST_FAIL) {
log_debug("VG %s unlock skipped: lockd_state is failed", vg_name);
return 1;
@@ -1642,21 +1566,6 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
}
/*
- * A specific lock mode was given on the command line.
- */
- if (cmd->lock_vg_mode) {
- mode = cmd->lock_vg_mode;
- if (mode && def_mode && (_mode_compare(mode, def_mode) < 0)) {
- if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-vg mode \"%s\"", mode);
- return 0;
- } else {
- log_warn("WARNING: overriding default VG lock mode.");
- }
- }
- }
-
- /*
* The default mode may not have been provided in the
* function args. This happens when lockd_vg is called
* from a process_each function that handles different
@@ -1918,30 +1827,9 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
* For lvchange/vgchange activation, def_mode is "sh" or "ex"
* according to the specific -a{e,s}y mode designation.
* No e,s designation gives NULL def_mode.
- *
- * The --lock-lv option is saved in cmd->lock_lv_mode.
*/
- if (cmd->lock_lv_mode && def_mode && strcmp(cmd->lock_lv_mode, "na") &&
- strcmp(cmd->lock_lv_mode, def_mode)) {
- log_error("Different LV lock modes from activation %s and lock-lv %s",
- def_mode, cmd->lock_lv_mode);
- return 0;
- }
-
- /* A specific lock mode was given on the command line. */
- if (cmd->lock_lv_mode && (_mode_compare(cmd->lock_lv_mode, "sh") < 0)) {
- if (!find_config_tree_bool(cmd, global_allow_override_lock_modes_CFG, NULL)) {
- log_error("Disallowed lock-lv mode \"%s\"", cmd->lock_lv_mode);
- return 0;
- } else {
- log_warn("WARNING: overriding default LV lock mode.");
- }
- }
-
- if (cmd->lock_lv_mode)
- mode = cmd->lock_lv_mode;
- else if (def_mode)
+ if (def_mode)
mode = def_mode;
if (mode && !strcmp(mode, "sh") && (flags & LDLV_MODE_NO_SH)) {
@@ -2250,9 +2138,6 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
{
int lock_type_num = get_lock_type_from_string(vg->lock_type);
- if (cmd->lock_lv_mode && !strcmp(cmd->lock_lv_mode, "na"))
- return 1;
-
switch (lock_type_num) {
case LOCK_TYPE_NONE:
case LOCK_TYPE_CLVM:
@@ -2374,9 +2259,6 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg,
const char *lv_name, struct id *lv_id, const char *lock_args)
{
- if (cmd->lock_lv_mode && !strcmp(cmd->lock_lv_mode, "na"))
- return 1;
-
switch (get_lock_type_from_string(vg->lock_type)) {
case LOCK_TYPE_NONE:
case LOCK_TYPE_CLVM:
8 years, 9 months
master - config: rename lock_retries lvmlockd_lock_retries
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=114744cee14881...
Commit: 114744cee1488112f51c49cbe71366ce8bfbd3ea
Parent: dfe3eb12d074eb25063ce62a913825cfbc90a37b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 6 11:19:17 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 6 11:44:28 2015 -0500
config: rename lock_retries lvmlockd_lock_retries
Because it only applies to lvmlockd requests, but
sounded too general.
---
lib/config/config_settings.h | 2 +-
lib/config/defaults.h | 2 +-
lib/locking/lvmlockd.c | 6 +++---
man/lvmlockd.8.in | 8 ++++----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 5d042c9..16fd0bd 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -834,7 +834,7 @@ cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL,
cfg(global_use_lvmlockd_CFG, "use_lvmlockd", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 124), NULL, 0, NULL,
"Use lvmlockd for locking among hosts using LVM on shared storage.\n")
-cfg(global_lock_retries_CFG, "lock_retries", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_LOCK_RETRIES, vsn(2, 2, 124), NULL, 0, NULL,
+cfg(global_lvmlockd_lock_retries_CFG, "lvmlockd_lock_retries", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_LVMLOCKD_LOCK_RETRIES, vsn(2, 2, 124), NULL, 0, NULL,
"Retry lvmlockd lock requests this many times.\n")
cfg(global_sanlock_lv_extend_CFG, "sanlock_lv_extend", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_INT, DEFAULT_SANLOCK_LV_EXTEND_MB, vsn(2, 2, 124), NULL, 0, NULL,
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 6d3fec0..491c64b 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -51,7 +51,7 @@
#define DEFAULT_FALLBACK_TO_LOCAL_LOCKING 1
#define DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING 1
#define DEFAULT_WAIT_FOR_LOCKS 1
-#define DEFAULT_LOCK_RETRIES 3
+#define DEFAULT_LVMLOCKD_LOCK_RETRIES 3
#define DEFAULT_PRIORITISE_WRITE_LOCKS 1
#define DEFAULT_USE_MLOCKALL 0
#define DEFAULT_METADATA_READ_ONLY 0
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 5d0cc07..f80ed75 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1200,7 +1200,7 @@ int lockd_gl_create(struct cmd_context *cmd, const char *def_mode, const char *v
}
if (result == -EAGAIN) {
- if (retries < find_config_tree_int(cmd, global_lock_retries_CFG, NULL)) {
+ if (retries < find_config_tree_int(cmd, global_lvmlockd_lock_retries_CFG, NULL)) {
log_warn("Retrying %s global lock", mode);
sleep(1);
retries++;
@@ -1467,7 +1467,7 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
}
if (result == -EAGAIN) {
- if (retries < find_config_tree_int(cmd, global_lock_retries_CFG, NULL)) {
+ if (retries < find_config_tree_int(cmd, global_lvmlockd_lock_retries_CFG, NULL)) {
log_warn("Retrying %s global lock", mode);
sleep(1);
retries++;
@@ -1710,7 +1710,7 @@ int lockd_vg(struct cmd_context *cmd, const char *vg_name, const char *def_mode,
}
if (result == -EAGAIN) {
- if (retries < find_config_tree_int(cmd, global_lock_retries_CFG, NULL)) {
+ if (retries < find_config_tree_int(cmd, global_lvmlockd_lock_retries_CFG, NULL)) {
log_warn("Retrying %s lock on VG %s", mode, vg_name);
sleep(1);
retries++;
diff --git a/man/lvmlockd.8.in b/man/lvmlockd.8.in
index 79a3218..3710df6 100644
--- a/man/lvmlockd.8.in
+++ b/man/lvmlockd.8.in
@@ -442,9 +442,9 @@ only while an LVM command is running.
If a request for a GL or VG lock fails due to a lock conflict with another
host, lvmlockd automatically retries for a short time before returning a
failure to the LVM command. The LVM command will then retry the entire
-lock request a number of times specified by global/lock_retries before
-failing. If a request for an LV lock fails due to a lock conflict, the
-command fails immediately.
+lock request a number of times specified by global/lvmlockd_lock_retries
+before failing. If a request for an LV lock fails due to a lock conflict,
+the command fails immediately.
.SS sanlock global lock
@@ -740,7 +740,7 @@ vgchange --lock-stop.
.IP \[bu] 2
Long lasting lock contention among hosts may result in a command giving up
and failing. The number of lock retries can be adjusted with
-global/lock_retries.
+global/lvmlockd_lock_retries.
.IP \[bu] 2
The reporting options locktype and lockargs can be used to view lockd VG
8 years, 9 months
master - include: Standardise around new tool.h.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dfe3eb12d074eb...
Commit: dfe3eb12d074eb25063ce62a913825cfbc90a37b
Parent: d3605b81f36d0e534172ab376466308042142ab8
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 6 17:30:18 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 6 17:30:18 2015 +0100
include: Standardise around new tool.h.
---
WHATS_NEW_DM | 1 +
daemons/clvmd/clvmd-common.h | 9 ++-------
daemons/dmeventd/dmeventd.c | 16 ++++------------
daemons/dmeventd/libdevmapper-event.c | 5 -----
daemons/lvmetad/lvmetad-core.c | 8 ++++----
daemons/lvmetad/testclient.c | 15 +++++++++++++++
daemons/lvmlockd/lvmlockctl.c | 10 ++--------
daemons/lvmlockd/lvmlockd-core.c | 13 +++++--------
daemons/lvmlockd/lvmlockd-dlm.c | 32 ++++++++++++--------------------
daemons/lvmlockd/lvmlockd-sanlock.c | 23 ++++++++---------------
daemons/lvmpolld/lvmpolld-common.h | 7 +------
include/.symlinks.in | 1 +
lib/log/log.h | 2 --
libdaemon/client/config-util.c | 10 ++++------
libdaemon/client/config-util.h | 4 ----
libdaemon/client/daemon-client.c | 8 ++++----
libdaemon/client/daemon-client.h | 1 -
libdaemon/client/daemon-io.c | 8 ++++----
libdaemon/client/daemon-io.h | 6 ------
libdaemon/server/daemon-log.c | 17 +++++++++++++++++
libdaemon/server/daemon-server.c | 6 ++++--
tools/dmsetup.c | 9 +--------
tools/lvchange.c | 1 +
tools/lvconvert.c | 1 +
tools/lvconvert_poll.c | 4 ++--
tools/lvm-static.c | 1 +
tools/lvm.c | 1 +
tools/lvmcmdlib.c | 1 +
tools/lvmcmdline.c | 1 +
tools/lvpoll.c | 1 +
tools/polldaemon.c | 5 +++--
tools/pvmove.c | 1 +
tools/pvmove_poll.c | 3 ++-
tools/reporter.c | 1 +
tools/tool.h | 31 +++++++++++++++++++++++++++++++
tools/toollib.c | 1 +
tools/tools.h | 12 ++----------
37 files changed, 139 insertions(+), 137 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index fe3b5de..728290f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.102 -
================================
+ Include tool.h for default non-library use.
Introduce format macros with embedded % such as FMTu64.
Version 1.02.101 - 3rd July 2015
diff --git a/daemons/clvmd/clvmd-common.h b/daemons/clvmd/clvmd-common.h
index 3070e49..6df1eb2 100644
--- a/daemons/clvmd/clvmd-common.h
+++ b/daemons/clvmd/clvmd-common.h
@@ -18,15 +18,10 @@
#ifndef _LVM_CLVMD_COMMON_H
#define _LVM_CLVMD_COMMON_H
-#include "configure.h"
-
#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-#include "libdevmapper.h"
-#include "lvm-logging.h"
+#include "tool.h"
-#include <unistd.h>
+#include "lvm-logging.h"
#endif
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index fcfa423..1ff5bf9 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -16,26 +16,21 @@
* dmeventd - dm event daemon to monitor active mapped devices
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "tool.h"
-#include "configure.h"
-#include "libdevmapper.h"
-#include "libdevmapper-event.h"
-#include "dmeventd.h"
//#include "libmultilog.h"
#include "dm-logging.h"
-#include <stdarg.h>
+#include "libdevmapper-event.h"
+#include "dmeventd.h"
+
#include <dlfcn.h>
-#include <errno.h>
#include <pthread.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
-#include <unistd.h>
#include <signal.h>
#include <arpa/inet.h> /* for htonl, ntohl */
#include <fcntl.h> /* for musl libc */
@@ -1567,9 +1562,6 @@ static void _process_request(struct dm_event_fifos *fifos)
{
int die;
struct dm_event_daemon_message msg = { 0 };
-#ifdef DEBUG
- const char *cmd;
-#endif
/*
* Read the request from the client (client_read, client_write
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index 6e41b0a..81f18c9 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -17,15 +17,10 @@
//#include "libmultilog.h"
#include "dmeventd.h"
-#include <errno.h>
#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <sys/file.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <sys/wait.h>
#include <arpa/inet.h> /* for htonl, ntohl */
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 7f2405c..f4e77b7 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -14,17 +14,17 @@
#define _XOPEN_SOURCE 500 /* pthread */
-#include "configure.h"
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
-#include "config-util.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "lvm-version.h"
#include <assert.h>
#include <pthread.h>
-#include <stdint.h>
-#include <unistd.h>
#define LVMETAD_SOCKET DEFAULT_RUN_DIR "/lvmetad.socket"
diff --git a/daemons/lvmetad/testclient.c b/daemons/lvmetad/testclient.c
index 8ea068d..fbf7b65 100644
--- a/daemons/lvmetad/testclient.c
+++ b/daemons/lvmetad/testclient.c
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2011-2014 Red Hat, Inc.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include "tool.h"
+
#include "lvmetad-client.h"
#include "label.h"
#include "lvmcache.h"
diff --git a/daemons/lvmlockd/lvmlockctl.c b/daemons/lvmlockd/lvmlockctl.c
index 9349ced..5a4f3f5 100644
--- a/daemons/lvmlockd/lvmlockctl.c
+++ b/daemons/lvmlockd/lvmlockctl.c
@@ -8,21 +8,15 @@
* of the GNU Lesser General Public License v.2.1.
*/
-#define _GNU_SOURCE
-#include "configure.h"
+#include "tool.h"
+
#include "lvmlockd-client.h"
-#include <stdio.h>
-#include <stdint.h>
#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <getopt.h>
-#include <string.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 87daaaf..649c9aa 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -10,25 +10,22 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
+#define _REENTRANT
+
+#include "tool.h"
-#include "configure.h"
#include "daemon-io.h"
#include "daemon-server.h"
#include "daemon-log.h"
-#include "config-util.h"
#include "lvm-version.h"
#include "lvmetad-client.h"
#include "lvmlockd-client.h"
-#include <assert.h>
+/* #include <assert.h> */
+#include <errno.h>
#include <pthread.h>
-#include <stdint.h>
#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <poll.h>
-#include <errno.h>
#include <signal.h>
#include <getopt.h>
#include <syslog.h>
diff --git a/daemons/lvmlockd/lvmlockd-dlm.c b/daemons/lvmlockd/lvmlockd-dlm.c
index 4b4f433..de19532 100644
--- a/daemons/lvmlockd/lvmlockd-dlm.c
+++ b/daemons/lvmlockd/lvmlockd-dlm.c
@@ -10,28 +10,9 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
-#include <assert.h>
-#include <pthread.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <poll.h>
-#include <errno.h>
-#include <string.h>
-#include <endian.h>
-#include <fcntl.h>
-#include <byteswap.h>
-#include <syslog.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
+#include "tool.h"
-#include "configure.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "xlate.h"
@@ -45,6 +26,17 @@
*/
#include "libdlm.h"
+#include <pthread.h>
+#include <stddef.h>
+#include <poll.h>
+#include <errno.h>
+#include <endian.h>
+#include <fcntl.h>
+#include <byteswap.h>
+#include <syslog.h>
+#include <dirent.h>
+#include <sys/socket.h>
+
struct lm_dlm {
dlm_lshandle_t *dh;
};
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 5a31edd..f52528f 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -10,23 +10,9 @@
#define _XOPEN_SOURCE 500 /* pthread */
#define _ISOC99_SOURCE
-#define _GNU_SOURCE
-#include <assert.h>
-#include <pthread.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <poll.h>
-#include <errno.h>
-#include <string.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include "tool.h"
-#include "configure.h"
#include "daemon-server.h"
#include "daemon-log.h"
#include "xlate.h"
@@ -39,6 +25,13 @@
#include "sanlock_admin.h"
#include "sanlock_resource.h"
+#include <pthread.h>
+#include <stddef.h>
+#include <poll.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/socket.h>
+
/*
* If access to the pv containing the vg's leases is lost, sanlock cannot renew
* the leases we have acquired for locked LVs. This means that we could soon
diff --git a/daemons/lvmpolld/lvmpolld-common.h b/daemons/lvmpolld/lvmpolld-common.h
index 81423f0..16f7642 100644
--- a/daemons/lvmpolld/lvmpolld-common.h
+++ b/daemons/lvmpolld/lvmpolld-common.h
@@ -18,19 +18,14 @@
#ifndef _LVM_LVMPOLLD_COMMON_H
#define _LVM_LVMPOLLD_COMMON_H
-#include "configure.h"
-
#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-#include "libdevmapper.h"
+#include "tool.h"
#include "lvmpolld-cmd-utils.h"
#include "lvmpolld-protocol.h"
#include <assert.h>
#include <errno.h>
-#include <unistd.h>
#endif /* _LVM_LVMPOLLD_COMMON_H */
diff --git a/include/.symlinks.in b/include/.symlinks.in
index dc4456a..e78072a 100644
--- a/include/.symlinks.in
+++ b/include/.symlinks.in
@@ -76,3 +76,4 @@
@top_srcdir(a)/libdm/misc/kdev_t.h
@top_srcdir(a)/po/pogen.h
@top_srcdir(a)/tools/lvm2cmd.h
+@top_srcdir(a)/tools/tool.h
diff --git a/lib/log/log.h b/lib/log/log.h
index 79e7d77..cb6b0bc 100644
--- a/lib/log/log.h
+++ b/lib/log/log.h
@@ -37,8 +37,6 @@
*
*/
-#include <stdio.h> /* FILE */
-#include <string.h> /* strerror() */
#include <errno.h>
#define EUNCLASSIFIED -1 /* Generic error code */
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index c417def..895815c 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -12,14 +12,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "dm-logging.h"
-#include "util.h"
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
#include <math.h> /* fabs() */
#include <float.h> /* DBL_EPSILON */
diff --git a/libdaemon/client/config-util.h b/libdaemon/client/config-util.h
index 3e0a23f..0e7de7e 100644
--- a/libdaemon/client/config-util.h
+++ b/libdaemon/client/config-util.h
@@ -15,10 +15,6 @@
#ifndef _LVM_DAEMON_CONFIG_UTIL_H
#define _LVM_DAEMON_CONFIG_UTIL_H
-#include "libdevmapper.h"
-
-#include <stdarg.h>
-
struct buffer {
int allocated;
int used;
diff --git a/libdaemon/client/daemon-client.c b/libdaemon/client/daemon-client.c
index 991bf8a..39a6401 100644
--- a/libdaemon/client/daemon-client.c
+++ b/libdaemon/client/daemon-client.c
@@ -12,16 +12,16 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "daemon-client.h"
#include "dm-logging.h"
#include <sys/un.h>
#include <sys/socket.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h> // ENOMEM
daemon_handle daemon_open(daemon_info i)
{
diff --git a/libdaemon/client/daemon-client.h b/libdaemon/client/daemon-client.h
index e1445c1..7f8d2d4 100644
--- a/libdaemon/client/daemon-client.h
+++ b/libdaemon/client/daemon-client.h
@@ -15,7 +15,6 @@
#ifndef _LVM_DAEMON_CLIENT_H
#define _LVM_DAEMON_CLIENT_H
-#include "libdevmapper.h"
#include "config-util.h"
typedef struct {
diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c
index 5ce9dde..a9da68f 100644
--- a/libdaemon/client/daemon-io.c
+++ b/libdaemon/client/daemon-io.c
@@ -12,13 +12,13 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
-#include "libdevmapper.h"
#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
/*
* Read a single message from a (socket) filedescriptor. Messages are delimited
diff --git a/libdaemon/client/daemon-io.h b/libdaemon/client/daemon-io.h
index b48acca..482f033 100644
--- a/libdaemon/client/daemon-io.h
+++ b/libdaemon/client/daemon-io.h
@@ -15,12 +15,6 @@
#ifndef _LVM_DAEMON_IO_H
#define _LVM_DAEMON_IO_H
-#include "configure.h"
-
-#define _REENTRANT
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
#include "config-util.h"
/* TODO function names */
diff --git a/libdaemon/server/daemon-log.c b/libdaemon/server/daemon-log.c
index c1765de..5ea5cdc 100644
--- a/libdaemon/server/daemon-log.c
+++ b/libdaemon/server/daemon-log.c
@@ -1,5 +1,22 @@
+/*
+ * Copyright (C) 2011-2012 Red Hat, Inc.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-server.h"
#include "daemon-log.h"
+
#include <syslog.h>
struct backend {
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 8eda8cf..4f34aaf 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -10,6 +10,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _REENTRANT
+
+#include "tool.h"
+
#include "daemon-io.h"
#include "daemon-server.h"
#include "daemon-log.h"
@@ -78,8 +82,6 @@ static void _exit_handler(int sig __attribute__((unused)))
# define SD_LISTEN_FDS_START 3
# define SD_FD_SOCKET_SERVER SD_LISTEN_FDS_START
-# include <stdio.h>
-
static int _is_idle(daemon_state s)
{
return s.idle && s.idle->is_idle && !s.threads->next;
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 067a677..e6cc44f 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -16,19 +16,12 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
+#include "tool.h"
-#include "configure.h"
-#include "util.h"
#include "dm-logging.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#include <ctype.h>
#include <dirent.h>
-#include <errno.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <locale.h>
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 2a57abb..939614e 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "memlock.h"
static int _lvchange_permission(struct cmd_context *cmd,
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index f967ae4..c7e797b 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -13,6 +13,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "lv_alloc.h"
#include "lvconvert_poll.h"
diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
index 72c8df8..e3a3709 100644
--- a/tools/lvconvert_poll.c
+++ b/tools/lvconvert_poll.c
@@ -12,10 +12,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "libdevmapper.h"
-#include "lvconvert_poll.h"
#include "tools.h"
+#include "lvconvert_poll.h"
+
int lvconvert_mirror_finish(struct cmd_context *cmd,
struct volume_group *vg,
struct logical_volume *lv,
diff --git a/tools/lvm-static.c b/tools/lvm-static.c
index 1be4c24..920127b 100644
--- a/tools/lvm-static.c
+++ b/tools/lvm-static.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
int main(int argc, char **argv)
diff --git a/tools/lvm.c b/tools/lvm.c
index f9ab438..63cc0b4 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
int main(int argc, char **argv)
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 6b641c2..76576c2 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
#include "label.h"
#include "memlock.h"
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 7808c12..c4a78b0 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "lvm2cmdline.h"
#include "label.h"
#include "lvm-version.h"
diff --git a/tools/lvpoll.c b/tools/lvpoll.c
index 178392e..c040b60 100644
--- a/tools/lvpoll.c
+++ b/tools/lvpoll.c
@@ -13,6 +13,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "pvmove_poll.h"
#include "lvconvert_poll.h"
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index d7ba417..da890dc 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -13,13 +13,14 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <time.h>
-
#include "tools.h"
+
#include "polldaemon.h"
#include "lvm2cmdline.h"
#include "lvmpolld-client.h"
+#include <time.h>
+
#define WAIT_AT_LEAST_NANOSECS 100000
progress_t poll_mirror_progress(struct cmd_context *cmd,
diff --git a/tools/pvmove.c b/tools/pvmove.c
index 8efa6b0..17416d4 100644
--- a/tools/pvmove.c
+++ b/tools/pvmove.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "polldaemon.h"
#include "display.h"
#include "pvmove_poll.h"
diff --git a/tools/pvmove_poll.c b/tools/pvmove_poll.c
index df896b5..0f071dc 100644
--- a/tools/pvmove_poll.c
+++ b/tools/pvmove_poll.c
@@ -13,9 +13,10 @@
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "pvmove_poll.h"
#include "tools.h"
+#include "pvmove_poll.h"
+
static int _is_pvmove_image_removable(struct logical_volume *mimage_lv,
void *baton)
{
diff --git a/tools/reporter.c b/tools/reporter.c
index c7a927b..8f7a272 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include "report.h"
static int _process_each_devtype(struct cmd_context *cmd, int argc,
diff --git a/tools/tool.h b/tools/tool.h
new file mode 100644
index 0000000..04c51ee
--- /dev/null
+++ b/tools/tool.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
+ * Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/* Most source files should include this file or lib.h or dmlib.h */
+
+#ifndef _LVM_TOOL_H
+#define _LVM_TOOL_H
+
+#define _GNU_SOURCE
+#define _FILE_OFFSET_BITS 64
+
+#include "configure.h"
+
+#include <unistd.h>
+
+#include "libdevmapper.h"
+#include "util.h"
+
+#endif /* _LVM_TOOL_H */
diff --git a/tools/toollib.c b/tools/toollib.c
index 6b8ce22..15bfa51 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -14,6 +14,7 @@
*/
#include "tools.h"
+
#include <sys/stat.h>
#include <signal.h>
#include <sys/wait.h>
diff --git a/tools/tools.h b/tools/tools.h
index 675867d..5ee5786 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -16,14 +16,10 @@
#ifndef _LVM_TOOLS_H
#define _LVM_TOOLS_H
-#define _GNU_SOURCE
-#define _FILE_OFFSET_BITS 64
-
-#include "configure.h"
-#include <assert.h>
-#include "libdevmapper.h"
+#include "tool.h"
#include "lvm-logging.h"
+
#include "activate.h"
#include "archiver.h"
#include "lvmcache.h"
@@ -47,11 +43,7 @@
#include "toolcontext.h"
#include "toollib.h"
-#include <stdlib.h>
-#include <unistd.h>
#include <ctype.h>
-#include <limits.h>
-#include <stdarg.h>
#include <sys/types.h>
#define CMD_LEN 256
8 years, 9 months
master - configure: enable building lvmlockd without sanlock or dlm
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d3605b81f36d0e...
Commit: d3605b81f36d0e534172ab376466308042142ab8
Parent: 4daea88516e39083ba52d6804c0cd398c899505d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Jul 6 10:42:11 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Jul 6 11:09:58 2015 -0500
configure: enable building lvmlockd without sanlock or dlm
---
configure.in | 47 ++++++-
daemons/lvmlockd/Makefile.in | 23 +++-
daemons/lvmlockd/lvmlockd-internal.h | 255 ++++++++++++++++++++++++++++------
3 files changed, 275 insertions(+), 50 deletions(-)
diff --git a/configure.in b/configure.in
index 21ce581..9e713aa 100644
--- a/configure.in
+++ b/configure.in
@@ -40,6 +40,8 @@ case "$host_os" in
LVMETAD=no
LVMPOLLD=no
LVMLOCKD=no
+ LOCKDSANLOCK=no
+ LOCKDDLM=no
ODIRECT=yes
DM_IOCTLS=yes
SELINUX=yes
@@ -1175,9 +1177,44 @@ AC_DEFINE_UNQUOTED(DEFAULT_USE_LVMLOCKD, [$DEFAULT_USE_LVMLOCKD],
[Use lvmlockd by default.])
################################################################################
-dnl -- Look for sanlock and dlm libraries
-if test "$BUILD_LVMLOCKD" = yes; then
+dnl -- Build lockdsanlock
+AC_MSG_CHECKING(whether to build lockdsanlock)
+AC_ARG_ENABLE(lockd-sanlock,
+ AC_HELP_STRING([--enable-lockd-sanlock],
+ [enable the LVM lock daemon sanlock option]),
+ LOCKDSANLOCK=$enableval)
+AC_MSG_RESULT($LOCKDSANLOCK)
+
+BUILD_LOCKDSANLOCK=$LOCKDSANLOCK
+
+if test "$BUILD_LOCKDSANLOCK" = yes; then
+ AC_DEFINE([LOCKDSANLOCK_SUPPORT], 1, [Define to 1 to include code that uses lvmlockd sanlock option.])
+fi
+
+################################################################################
+dnl -- Build lockddlm
+AC_MSG_CHECKING(whether to build lockddlm)
+AC_ARG_ENABLE(lockd-dlm,
+ AC_HELP_STRING([--enable-lockd-dlm],
+ [enable the LVM lock daemon dlm option]),
+ LOCKDDLM=$enableval)
+AC_MSG_RESULT($LOCKDDLM)
+
+BUILD_LOCKDDLM=$LOCKDDLM
+
+if test "$BUILD_LOCKDDLM" = yes; then
+ AC_DEFINE([LOCKDDLM_SUPPORT], 1, [Define to 1 to include code that uses lvmlockd dlm option.])
+fi
+
+################################################################################
+dnl -- Look for sanlock libraries
+if test "$BUILD_LOCKDSANLOCK" = yes; then
PKG_CHECK_MODULES(LOCKD_SANLOCK, libsanlock_client, [HAVE_LOCKD_SANLOCK=yes], $bailout)
+fi
+
+################################################################################
+dnl -- Look for dlm libraries
+if test "$BUILD_LOCKDDLM" = yes; then
PKG_CHECK_MODULES(LOCKD_DLM, libdlm, [HAVE_LOCKD_DLM=yes], $bailout)
fi
@@ -1804,6 +1841,8 @@ AC_SUBST(BUILD_DMEVENTD)
AC_SUBST(BUILD_LVMETAD)
AC_SUBST(BUILD_LVMPOLLD)
AC_SUBST(BUILD_LVMLOCKD)
+AC_SUBST(BUILD_LOCKDSANLOCK)
+AC_SUBST(BUILD_LOCKDDLM)
AC_SUBST(CACHE)
AC_SUBST(CFLAGS)
AC_SUBST(CFLOW_CMD)
@@ -2039,3 +2078,7 @@ AS_IF([test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMPOLLD" == no],
AS_IF([test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMETAD" == no],
[AC_MSG_WARN([lvmlockd requires lvmetad])])
+
+AS_IF([test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LOCKDDLM" == no && test "$BUILD_LOCKDSANLOCK" == no],
+ [AC_MSG_WARN([lvmlockd requires enabling sanlock or dlm or both])])
+
diff --git a/daemons/lvmlockd/Makefile.in b/daemons/lvmlockd/Makefile.in
index fcdce5c..fed7c22 100644
--- a/daemons/lvmlockd/Makefile.in
+++ b/daemons/lvmlockd/Makefile.in
@@ -15,10 +15,15 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SOURCES = \
- lvmlockd-core.c \
- lvmlockd-sanlock.c \
- lvmlockd-dlm.c
+SOURCES = lvmlockd-core.c
+
+ifeq ("@BUILD_LOCKDSANLOCK@", "yes")
+ SOURCES += lvmlockd-sanlock.c
+endif
+
+ifeq ("@BUILD_LOCKDDLM@", "yes")
+ SOURCES += lvmlockd-dlm.c
+endif
TARGETS = lvmlockd lvmlockctl
@@ -29,7 +34,15 @@ include $(top_builddir)/make.tmpl
INCLUDES += -I$(top_srcdir)/libdaemon/server
LVMLIBS = -ldaemonserver $(LVMINTERNAL_LIBS) -ldevmapper
-LIBS += $(PTHREAD_LIBS) -ldlm_lt -lsanlock_client -lrt
+LIBS += $(PTHREAD_LIBS) -lrt
+
+ifeq ("@BUILD_LOCKDSANLOCK@", "yes")
+ LIBS += -lsanlock_client
+endif
+
+ifeq ("@BUILD_LOCKDDLM@", "yes")
+ LIBS += -ldlm_lt
+endif
LDFLAGS += -L$(top_builddir)/libdaemon/server
CLDFLAGS += -L$(top_builddir)/libdaemon/server
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index f1aaa7e..9eee14a 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -198,49 +198,6 @@ struct val_blk {
/* lm_unlock flags */
#define LMUF_FREE_VG 0x00000001
-struct lockspace *alloc_lockspace(void);
-int lockspaces_empty(void);
-int last_string_from_args(char *args_in, char *last);
-int version_from_args(char *args, unsigned int *major, unsigned int *minor, unsigned int *patch);
-
-int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
-int lm_prepare_lockspace_dlm(struct lockspace *ls);
-int lm_add_lockspace_dlm(struct lockspace *ls, int adopt);
-int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg);
-int lm_lock_dlm(struct lockspace *ls, struct resource *r, int ld_mode,
- uint32_t *r_version, int adopt);
-int lm_convert_dlm(struct lockspace *ls, struct resource *r,
- int ld_mode, uint32_t r_version);
-int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
- uint32_t r_version, uint32_t lmu_flags);
-int lm_rem_resource_dlm(struct lockspace *ls, struct resource *r);
-int lm_get_lockspaces_dlm(struct list_head *ls_rejoin);
-int lm_data_size_dlm(void);
-int lm_is_running_dlm(void);
-
-int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
-int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, uint64_t free_offset);
-int lm_free_lv_sanlock(struct lockspace *ls, struct resource *r);
-int lm_rename_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
-int lm_prepare_lockspace_sanlock(struct lockspace *ls);
-int lm_add_lockspace_sanlock(struct lockspace *ls, int adopt);
-int lm_rem_lockspace_sanlock(struct lockspace *ls, int free_vg);
-int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
- uint32_t *r_version, int *retry, int adopt);
-int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
- int ld_mode, uint32_t r_version);
-int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
- uint32_t r_version, uint32_t lmu_flags);
-int lm_able_gl_sanlock(struct lockspace *ls, int enable);
-int lm_ex_disable_gl_sanlock(struct lockspace *ls);
-int lm_hosts_sanlock(struct lockspace *ls, int notify);
-int lm_rem_resource_sanlock(struct lockspace *ls, struct resource *r);
-int lm_gl_is_enabled(struct lockspace *ls);
-int lm_get_lockspaces_sanlock(struct list_head *ls_rejoin);
-int lm_data_size_sanlock(void);
-int lm_is_running_sanlock(void);
-int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset);
-
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
@@ -370,4 +327,216 @@ void log_level(int level, const char *fmt, ...) __attribute__((format(printf, 2
#define log_error(fmt, args...) log_level(LOG_ERR, fmt, ##args)
#define log_warn(fmt, args...) log_level(LOG_WARNING, fmt, ##args)
+struct lockspace *alloc_lockspace(void);
+int lockspaces_empty(void);
+int last_string_from_args(char *args_in, char *last);
+int version_from_args(char *args, unsigned int *major, unsigned int *minor, unsigned int *patch);
+
+
+#ifdef LOCKDDLM_SUPPORT
+
+int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
+int lm_prepare_lockspace_dlm(struct lockspace *ls);
+int lm_add_lockspace_dlm(struct lockspace *ls, int adopt);
+int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg);
+int lm_lock_dlm(struct lockspace *ls, struct resource *r, int ld_mode,
+ uint32_t *r_version, int adopt);
+int lm_convert_dlm(struct lockspace *ls, struct resource *r,
+ int ld_mode, uint32_t r_version);
+int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
+ uint32_t r_version, uint32_t lmu_flags);
+int lm_rem_resource_dlm(struct lockspace *ls, struct resource *r);
+int lm_get_lockspaces_dlm(struct list_head *ls_rejoin);
+int lm_data_size_dlm(void);
+int lm_is_running_dlm(void);
+
+#else
+
+static inline int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
+{
+ return -1;
+}
+
+static inline int lm_prepare_lockspace_dlm(struct lockspace *ls)
+{
+ return -1;
+}
+
+static inline int lm_add_lockspace_dlm(struct lockspace *ls, int adopt)
+{
+ return -1;
+}
+
+static inline int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg)
+{
+ return -1;
+}
+
+static inline int lm_lock_dlm(struct lockspace *ls, struct resource *r, int ld_mode,
+ uint32_t *r_version, int adopt)
+{
+ return -1;
+}
+
+static inline int lm_convert_dlm(struct lockspace *ls, struct resource *r,
+ int ld_mode, uint32_t r_version)
+{
+ return -1;
+}
+
+static inline int lm_unlock_dlm(struct lockspace *ls, struct resource *r,
+ uint32_t r_version, uint32_t lmu_flags)
+{
+ return -1;
+}
+
+static inline int lm_rem_resource_dlm(struct lockspace *ls, struct resource *r)
+{
+ return -1;
+}
+
+static inline int lm_get_lockspaces_dlm(struct list_head *ls_rejoin)
+{
+ return -1;
+}
+
+static inline int lm_data_size_dlm(void)
+{
+ return -1;
+}
+
+static inline int lm_is_running_dlm(void)
+{
+ return 0;
+}
+
+#endif /* dlm support */
+
+#ifdef LOCKDSANLOCK_SUPPORT
+
+int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
+int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, uint64_t free_offset);
+int lm_free_lv_sanlock(struct lockspace *ls, struct resource *r);
+int lm_rename_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args);
+int lm_prepare_lockspace_sanlock(struct lockspace *ls);
+int lm_add_lockspace_sanlock(struct lockspace *ls, int adopt);
+int lm_rem_lockspace_sanlock(struct lockspace *ls, int free_vg);
+int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
+ uint32_t *r_version, int *retry, int adopt);
+int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
+ int ld_mode, uint32_t r_version);
+int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
+ uint32_t r_version, uint32_t lmu_flags);
+int lm_able_gl_sanlock(struct lockspace *ls, int enable);
+int lm_ex_disable_gl_sanlock(struct lockspace *ls);
+int lm_hosts_sanlock(struct lockspace *ls, int notify);
+int lm_rem_resource_sanlock(struct lockspace *ls, struct resource *r);
+int lm_gl_is_enabled(struct lockspace *ls);
+int lm_get_lockspaces_sanlock(struct list_head *ls_rejoin);
+int lm_data_size_sanlock(void);
+int lm_is_running_sanlock(void);
+int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset);
+
+#else
+
+static inline int lm_init_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
+{
+ return -1;
+}
+
+static inline int lm_init_lv_sanlock(char *ls_name, char *vg_name, char *lv_name, char *vg_args, char *lv_args, uint64_t free_offset)
+{
+ return -1;
+}
+
+static inline int lm_free_lv_sanlock(struct lockspace *ls, struct resource *r)
+{
+ return -1;
+}
+
+static inline int lm_rename_vg_sanlock(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
+{
+ return -1;
+}
+
+static inline int lm_prepare_lockspace_sanlock(struct lockspace *ls)
+{
+ return -1;
+}
+
+static inline int lm_add_lockspace_sanlock(struct lockspace *ls, int adopt)
+{
+ return -1;
+}
+
+static inline int lm_rem_lockspace_sanlock(struct lockspace *ls, int free_vg)
+{
+ return -1;
+}
+
+static inline int lm_lock_sanlock(struct lockspace *ls, struct resource *r, int ld_mode,
+ uint32_t *r_version, int *retry, int adopt)
+{
+ return -1;
+}
+
+static inline int lm_convert_sanlock(struct lockspace *ls, struct resource *r,
+ int ld_mode, uint32_t r_version)
+{
+ return -1;
+}
+
+static inline int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
+ uint32_t r_version, uint32_t lmu_flags)
+{
+ return -1;
+}
+
+static inline int lm_able_gl_sanlock(struct lockspace *ls, int enable)
+{
+ return -1;
+}
+
+static inline int lm_ex_disable_gl_sanlock(struct lockspace *ls)
+{
+ return -1;
+}
+
+static inline int lm_hosts_sanlock(struct lockspace *ls, int notify)
+{
+ return -1;
+}
+
+static inline int lm_rem_resource_sanlock(struct lockspace *ls, struct resource *r)
+{
+ return -1;
+}
+
+static inline int lm_gl_is_enabled(struct lockspace *ls)
+{
+ return -1;
+}
+
+static inline int lm_get_lockspaces_sanlock(struct list_head *ls_rejoin)
+{
+ return -1;
+}
+
+static inline int lm_data_size_sanlock(void)
+{
+ return -1;
+}
+
+static inline int lm_is_running_sanlock(void)
+{
+ return 0;
+}
+
+static inline int lm_find_free_lock_sanlock(struct lockspace *ls, uint64_t *free_offset)
+{
+ return -1;
+}
+
+#endif /* sanlock support */
+
#endif /* _LVM_LVMLOCKD_INTERNAL_H */
8 years, 9 months
master - clean-up: typos s/bellow/below/
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4daea88516e390...
Commit: 4daea88516e39083ba52d6804c0cd398c899505d
Parent: 810ab095e6709364d9f7c86d3754762aab3d976d
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Mon Jul 6 10:15:11 2015 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Mon Jul 6 10:15:11 2015 -0500
clean-up: typos s/bellow/below/
---
lib/metadata/thin_manip.c | 2 +-
lib/misc/lvm-signal.c | 2 +-
libdm/libdevmapper.h | 2 +-
test/shell/lvextend-snapshot-dmeventd.sh | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index dd4e514..181c72e 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -313,7 +313,7 @@ int pool_check_overprovisioning(const struct logical_volume *lv)
txt,
(sz > 0) ? display_size(cmd, sz) : "no free space in volume group");
if (max_threshold > 99)
- log_print_unless_silent("For thin pool auto extension activation/thin_pool_autoextend_threshold should be bellow 100.");
+ log_print_unless_silent("For thin pool auto extension activation/thin_pool_autoextend_threshold should be below 100.");
if (!min_percent)
log_print_unless_silent("For thin pool auto extension activation/thin_pool_autoextend_percent should be above 0.");
}
diff --git a/lib/misc/lvm-signal.c b/lib/misc/lvm-signal.c
index d5dac6f..0d61e73 100644
--- a/lib/misc/lvm-signal.c
+++ b/lib/misc/lvm-signal.c
@@ -95,7 +95,7 @@ void sigint_restore(void)
--_handler_installed >= MAX_SIGINTS)
return;
- /* Nesting count went bellow MAX_SIGINTS. */
+ /* Nesting count went below MAX_SIGINTS. */
if (_oldmasked[_handler_installed]) {
sigset_t sigs;
sigprocmask(0, NULL, &sigs);
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 4ce2e6b..aad2971 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -734,7 +734,7 @@ int dm_tree_node_add_raid_target(struct dm_tree_node *node,
uint64_t flags);
/*
- * Defines bellow are based on kernel's dm-cache.c defines
+ * Defines below are based on kernel's dm-cache.c defines
* DM_CACHE_MIN_DATA_BLOCK_SIZE (32 * 1024 >> SECTOR_SHIFT)
* DM_CACHE_MAX_DATA_BLOCK_SIZE (1024 * 1024 * 1024 >> SECTOR_SHIFT)
*/
diff --git a/test/shell/lvextend-snapshot-dmeventd.sh b/test/shell/lvextend-snapshot-dmeventd.sh
index 1ad4864..aeb18f1 100644
--- a/test/shell/lvextend-snapshot-dmeventd.sh
+++ b/test/shell/lvextend-snapshot-dmeventd.sh
@@ -50,7 +50,7 @@ write_ 1000 1700
pre=$(percent_)
# Normally the usage should be ~66% here, however on slower systems
# dmeventd could be actually 'fast' enough to have COW already resized now
-# so mark test skipped if we are bellow 50% by now
+# so mark test skipped if we are below 50% by now
test $pre -gt 50 || skip
wait_for_change_ $pre
test $pre -gt $(percent_)
8 years, 9 months
master - macros: Wrap PRI with FMT.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=810ab095e67093...
Commit: 810ab095e6709364d9f7c86d3754762aab3d976d
Parent: 5fb71bd53062011dd962d77b233552ffad128238
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jul 6 15:09:17 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jul 6 15:09:17 2015 +0100
macros: Wrap PRI with FMT.
Create a set of wrappers with embedded % such as
#define FMTu64 "%" PRIu64
---
WHATS_NEW_DM | 1 +
daemons/clvmd/clvmd-openais.c | 2 +-
lib/format_text/format-text.c | 2 +-
lib/metadata/cache_manip.c | 2 +-
lib/metadata/lv.c | 2 +-
lib/metadata/lv_manip.c | 4 ++--
lib/metadata/mirror.c | 2 +-
lib/metadata/replicator_manip.c | 2 +-
lib/metadata/thin_manip.c | 2 +-
lib/mirror/mirrored.c | 2 +-
lib/misc/lib.h | 5 -----
lib/misc/util.h | 37 +++++++++++++++++++++++++++++++++++++
lib/raid/raid.c | 2 +-
lib/replicator/replicator.c | 2 +-
lib/uuid/uuid.h | 1 -
libdaemon/client/config-util.c | 5 +++--
libdm/libdm-common.c | 2 +-
libdm/libdm-config.c | 2 +-
libdm/libdm-deptree.c | 8 ++++----
libdm/libdm-report.c | 2 +-
tools/dmsetup.c | 10 ++++------
tools/lvconvert.c | 6 +++---
tools/pvscan.c | 2 +-
23 files changed, 68 insertions(+), 37 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 8b4faff..fe3b5de 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.102 -
================================
+ Introduce format macros with embedded % such as FMTu64.
Version 1.02.101 - 3rd July 2015
================================
diff --git a/daemons/clvmd/clvmd-openais.c b/daemons/clvmd/clvmd-openais.c
index 29a323a..bd76214 100644
--- a/daemons/clvmd/clvmd-openais.c
+++ b/daemons/clvmd/clvmd-openais.c
@@ -243,7 +243,7 @@ static void openais_cpg_confchg_callback(cpg_handle_t handle,
struct node_info *ninfo;
DEBUGLOG("confchg callback. %" PRIsize_t " joined, "
- "%" PRIsize_t " left, %" PRIsize_t " members\n",
+ FMTsize_t " left, %" PRIsize_t " members\n",
joined_list_entries, left_list_entries, member_list_entries);
for (i=0; i<joined_list_entries; i++) {
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index f38628c..fc759fb 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -2237,7 +2237,7 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt,
if (limit_applied)
log_very_verbose("Using limited metadata area size on %s "
"with value %" PRIu64 " (limited by %s of "
- "%" PRIu64 ").", pv_dev_name(pv),
+ FMTu64 ").", pv_dev_name(pv),
mda_size, limit_name, limit);
if (mda_size) {
diff --git a/lib/metadata/cache_manip.c b/lib/metadata/cache_manip.c
index 41de440..5a93031 100644
--- a/lib/metadata/cache_manip.c
+++ b/lib/metadata/cache_manip.c
@@ -322,7 +322,7 @@ int lv_cache_remove(struct logical_volume *cache_lv)
dirty_blocks = status->cache->dirty_blocks;
dm_pool_destroy(status->mem);
if (dirty_blocks) {
- log_print_unless_silent("%" PRIu64 " blocks must still be flushed.",
+ log_print_unless_silent(FMTu64 " blocks must still be flushed.",
dirty_blocks);
sleep(1);
}
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 49d4a09..df784c1 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -79,7 +79,7 @@ static char *_format_pvsegs(struct dm_pool *mem, const struct lv_segment *seg,
if (range_format) {
if (dm_snprintf(extent_str, sizeof(extent_str),
- "%" PRIu32, extent + seg->area_len - 1) < 0) {
+ FMTu32, extent + seg->area_len - 1) < 0) {
log_error("Extent number dm_snprintf failed");
return NULL;
}
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1891491..a447f08 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4356,7 +4356,7 @@ static int _fsadm_cmd(struct cmd_context *cmd,
argv[i++] = lv_path;
if (fcmd == FSADM_CMD_RESIZE) {
- if (dm_snprintf(size_buf, sizeof(size_buf), "%" PRIu64 "K",
+ if (dm_snprintf(size_buf, sizeof(size_buf), FMTu64 "K",
(uint64_t) lp->extents * (vg->extent_size / 2)) < 0) {
log_error("Couldn't generate new LV size string");
return 0;
@@ -6161,7 +6161,7 @@ int remove_layers_for_segments(struct cmd_context *cmd,
log_error("Layer boundary mismatch: "
"%s:%" PRIu32 "-%" PRIu32 " on "
"%s:%" PRIu32 " / "
- "%" PRIu32 "-%" PRIu32 " / ",
+ FMTu32 "-" FMTu32 " / ",
lv->name, seg->le, seg->area_len,
layer_lv->name, seg_le(seg, s),
lseg->le, lseg->area_len);
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 4857ad0..f0d8f00 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1171,7 +1171,7 @@ static int _remove_mirror_images(struct logical_volume *lv,
if (removed)
*removed = old_area_count - new_area_count;
- log_very_verbose("%" PRIu32 " image(s) removed from %s",
+ log_very_verbose(FMTu32 " image(s) removed from %s",
old_area_count - new_area_count, lv->name);
return 1;
diff --git a/lib/metadata/replicator_manip.c b/lib/metadata/replicator_manip.c
index fc4bf5f..ed34cca 100644
--- a/lib/metadata/replicator_manip.c
+++ b/lib/metadata/replicator_manip.c
@@ -298,7 +298,7 @@ int check_replicator_segment(const struct lv_segment *rseg)
}
if (rsite->fall_behind_data) {
log_error("Defined fall_behind_data="
- "%" PRIu64 " for sync replicator %s/%s.",
+ FMTu64 " for sync replicator %s/%s.",
rsite->fall_behind_data, lv->name, rsite->name);
r = 0;
}
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 6ae0795..dd4e514 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -720,7 +720,7 @@ int check_new_thin_pool(const struct logical_volume *pool_lv)
/* Require pool to have same transaction_id as new */
if (first_seg(pool_lv)->transaction_id != transaction_id) {
log_error("Cannot use thin pool %s with transaction id "
- "%" PRIu64 " for thin volumes. "
+ FMTu64 " for thin volumes. "
"Expected transaction id %" PRIu64 ".",
display_lvname(pool_lv), transaction_id,
first_seg(pool_lv)->transaction_id);
diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c
index e57e9bb..2156165 100644
--- a/lib/mirror/mirrored.c
+++ b/lib/mirror/mirrored.c
@@ -195,7 +195,7 @@ static int _mirrored_target_percent(void **target_state,
pos += used;
}
- if (sscanf(pos, "%" PRIu64 "/%" PRIu64 "%n", &numerator, &denominator,
+ if (sscanf(pos, FMTu64 "/" FMTu64 "%n", &numerator, &denominator,
&used) != 2) {
log_error("Failure parsing mirror status fraction: %s", params);
return 0;
diff --git a/lib/misc/lib.h b/lib/misc/lib.h
index 63e58d0..63f60a2 100644
--- a/lib/misc/lib.h
+++ b/lib/misc/lib.h
@@ -25,11 +25,6 @@
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
-/* Define some portable printing types */
-#define PRIsize_t "zu"
-#define PRIptrdiff_t "td"
-#define PRIpid_t PRId32
-
#if defined(__GNUC__)
#define DM_EXPORTED_SYMBOL(func, ver) \
__asm__(".symver " #func "_v" #ver ", " #func "@@DM_" #ver )
diff --git a/lib/misc/util.h b/lib/misc/util.h
index a453469..113ca69 100644
--- a/lib/misc/util.h
+++ b/lib/misc/util.h
@@ -15,6 +15,8 @@
#ifndef _LVM_UTIL_H
#define _LVM_UTIL_H
+#include <inttypes.h>
+
#define min(a, b) ({ typeof(a) _a = (a); \
typeof(b) _b = (b); \
(void) (&_a == &_b); \
@@ -33,4 +35,39 @@
#define KERNEL_VERSION(major, minor, release) (((major) << 16) + ((minor) << 8) + (release))
+/* Define some portable printing types */
+#define PRIsize_t "zu"
+#define PRIptrdiff_t "td"
+#define PRIpid_t PRId32
+
+/* For convenience */
+#define FMTsize_t "%" PRIsize_t
+#define FMTptrdiff_t "%" PRIptrdiff_t
+#define FMTpid_t "%" PRIpid_t
+
+#define FMTd8 "%" PRId8
+#define FMTd16 "%" PRId16
+#define FMTd32 "%" PRId32
+#define FMTd64 "%" PRId64
+
+#define FMTi8 "%" PRIi8
+#define FMTi16 "%" PRIi16
+#define FMTi32 "%" PRIi32
+#define FMTi64 "%" PRIi64
+
+#define FMTo8 "%" PRIo8
+#define FMTo16 "%" PRIo16
+#define FMTo32 "%" PRIo32
+#define FMTo64 "%" PRIo64
+
+#define FMTu8 "%" PRIu8
+#define FMTu16 "%" PRIu16
+#define FMTu32 "%" PRIu32
+#define FMTu64 "%" PRIu64
+
+#define FMTx8 "%" PRIx8
+#define FMTx16 "%" PRIx16
+#define FMTx32 "%" PRIx32
+#define FMTx64 "%" PRIx64
+
#endif
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 39e3a06..e9dfbd4 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -302,7 +302,7 @@ static int _raid_target_percent(void **target_state,
else
break;
}
- if (!pos || (sscanf(pos, "%" PRIu64 "/%" PRIu64 "%n",
+ if (!pos || (sscanf(pos, FMTu64 "/" FMTu64 "%n",
&numerator, &denominator, &i) != 2)) {
log_error("Failed to parse %s status fraction: %s",
(seg) ? seg->segtype->name : "segment", params);
diff --git a/lib/replicator/replicator.c b/lib/replicator/replicator.c
index ae87d7f..7a8c3a8 100644
--- a/lib/replicator/replicator.c
+++ b/lib/replicator/replicator.c
@@ -672,7 +672,7 @@ static int _replicator_dev_add_target_line(struct dev_manager *dm,
if (!(slog_dlid = build_dm_uuid(mem, rdev->slog, NULL)))
return_0;
} else if (rdev->slog_name &&
- sscanf(rdev->slog_name, "%" PRIu32, &slog_size) == 1) {
+ sscanf(rdev->slog_name, FMTu32, &slog_size) == 1) {
slog_flags = DM_CORELOG | DM_FORCESYNC;
if (slog_size == 0) {
log_error("Failed to use empty corelog size "
diff --git a/lib/uuid/uuid.h b/lib/uuid/uuid.h
index d39ad88..d87de73 100644
--- a/lib/uuid/uuid.h
+++ b/lib/uuid/uuid.h
@@ -18,7 +18,6 @@
#define ID_LEN 32
-#include <inttypes.h>
#include <sys/types.h>
struct dm_pool;
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index 067c912..c417def 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -14,6 +14,7 @@
#include "daemon-io.h"
#include "dm-logging.h"
+#include "util.h"
#include <errno.h>
#include <stdio.h>
@@ -39,7 +40,7 @@ int buffer_append_vf(struct buffer *buf, va_list ap)
goto fail;
}
keylen = strchr(next, '=') - next;
- if (strstr(next, "%d") || strstr(next, "%" PRId64)) {
+ if (strstr(next, "%d") || strstr(next, FMTd64)) {
value = va_arg(ap, int64_t);
if (dm_asprintf(&append, "%.*s= %" PRId64 "\n", keylen, next, value) < 0)
goto fail;
@@ -237,7 +238,7 @@ struct dm_config_node *config_make_nodes_v(struct dm_config_tree *cft,
key[fmt - next] = '\0';
fmt += 2;
- if (!strcmp(fmt, "%d") || !strcmp(fmt, "%" PRId64)) {
+ if (!strcmp(fmt, "%d") || !strcmp(fmt, FMTd64)) {
int64_t value = va_arg(ap, int64_t);
if (!(cn = make_int_node(cft, key, value, parent, pre_sib)))
return 0;
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 6f56c60..b56643f 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1219,7 +1219,7 @@ static int _set_read_ahead(const char *dev_name, uint32_t major, uint32_t minor,
}
/* Sysfs is kB based, round up to kB */
- if ((len = dm_snprintf(buf, sizeof(buf), "%" PRIu32,
+ if ((len = dm_snprintf(buf, sizeof(buf), FMTu32,
(read_ahead + 1) / 2)) < 0) {
log_error("Failed to build size in kB.");
return 0;
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index f163677..b2082c8 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -290,7 +290,7 @@ static int _write_value(struct config_output *out, const struct dm_config_value
if (v->format_flags & DM_CONFIG_VALUE_FMT_INT_OCTAL)
line_append("0%" PRIo64, v->v.i);
else
- line_append("%" PRId64, v->v.i);
+ line_append(FMTd64, v->v.i);
break;
case DM_CFG_EMPTY_ARRAY:
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 5baac6d..36befff 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1458,7 +1458,7 @@ static int _thin_pool_status_transaction_id(struct dm_tree_node *dnode, uint64_t
goto out;
}
- if (!params || (sscanf(params, "%" PRIu64, transaction_id) != 1)) {
+ if (!params || (sscanf(params, FMTu64, transaction_id) != 1)) {
log_error("Failed to parse transaction_id from %s.", params);
goto out;
}
@@ -3075,7 +3075,7 @@ int dm_get_status_snapshot(struct dm_pool *mem, const char *params,
return 0;
}
- r = sscanf(params, "%" PRIu64 "/%" PRIu64 " %" PRIu64,
+ r = sscanf(params, FMTu64 "/" FMTu64 " " FMTu64,
&s->used_sectors, &s->total_sectors,
&s->metadata_sectors);
@@ -3992,7 +3992,7 @@ int dm_get_status_thin_pool(struct dm_pool *mem, const char *params,
}
/* FIXME: add support for held metadata root */
- if (sscanf(params, "%" PRIu64 " %" PRIu64 "/%" PRIu64 " %" PRIu64 "/%" PRIu64 "%n",
+ if (sscanf(params, FMTu64 " " FMTu64 "/" FMTu64 " " FMTu64 "/" FMTu64 "%n",
&s->transaction_id,
&s->used_metadata_blocks,
&s->total_metadata_blocks,
@@ -4044,7 +4044,7 @@ int dm_get_status_thin(struct dm_pool *mem, const char *params,
if (strchr(params, '-')) {
s->mapped_sectors = 0;
s->highest_mapped_sector = 0;
- } else if (sscanf(params, "%" PRIu64 " %" PRIu64,
+ } else if (sscanf(params, FMTu64 " " FMTu64,
&s->mapped_sectors,
&s->highest_mapped_sector) != 2) {
dm_pool_free(mem, s);
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 7afbb8d..455123f 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -639,7 +639,7 @@ int dm_report_field_uint64(struct dm_report *rh,
return 0;
}
- if (dm_snprintf(repstr, 21, "%" PRIu64 , value) < 0) {
+ if (dm_snprintf(repstr, 21, FMTu64 , value) < 0) {
log_error("dm_report_field_uint64: uint64 too big: %" PRIu64, value);
return 0;
}
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index f200e94..067a677 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -20,7 +20,7 @@
#define _FILE_OFFSET_BITS 64
#include "configure.h"
-
+#include "util.h"
#include "dm-logging.h"
#include <stdio.h>
@@ -29,9 +29,7 @@
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
-#include <unistd.h>
#include <sys/wait.h>
-#include <unistd.h>
#include <sys/param.h>
#include <locale.h>
#include <langinfo.h>
@@ -1186,7 +1184,7 @@ static int _udevcomplete_all(CMD_ARGS)
if (semctl(sid, 0, IPC_RMID, 0) < 0) {
log_error("Could not cleanup notification semaphore "
"with semid %d and cookie value "
- "%" PRIu32 " (0x%" PRIx32 ")", sid,
+ FMTu32 " (0x" FMTx32 ")", sid,
sdata.sem_perm.__key, sdata.sem_perm.__key);
continue;
}
@@ -1196,7 +1194,7 @@ static int _udevcomplete_all(CMD_ARGS)
}
log_print("%d semaphores with keys prefixed by "
- "%" PRIu16 " (0x%" PRIx16 ") destroyed. %d skipped.",
+ FMTu16 " (0x" FMTx16 ") destroyed. %d skipped.",
counter, DM_COOKIE_MAGIC, DM_COOKIE_MAGIC, skipped);
return 1;
@@ -1713,7 +1711,7 @@ static int _status(CMD_ARGS)
while (*c && *c != ' ')
*c++ = '0';
}
- printf("%" PRIu64 " %" PRIu64 " %s %s",
+ printf(FMTu64 " " FMTu64 " %s %s",
start, length, target_type, params);
}
printf("\n");
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 00bab36..f967ae4 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2406,12 +2406,12 @@ static int _lvconvert_pool_repair(struct cmd_context *cmd,
*/
if ((fgets(meta_path, sizeof(meta_path), f) > 0) &&
(trans_id_str = strstr(meta_path, "transaction=\"")) &&
- (sscanf(trans_id_str + 13, "%" PRIu64, &trans_id) == 1) &&
+ (sscanf(trans_id_str + 13, FMTu64, &trans_id) == 1) &&
(trans_id != first_seg(pool_lv)->transaction_id) &&
((trans_id - 1) != first_seg(pool_lv)->transaction_id))
- log_error("Transaction id %" PRIu64 " from pool \"%s/%s\" "
+ log_error("Transaction id " FMTu64 " from pool \"%s/%s\" "
"does not match repaired transaction id "
- "%" PRIu64 " from %s.",
+ FMTu64 " from %s.",
first_seg(pool_lv)->transaction_id,
pool_lv->vg->name, pool_lv->name, trans_id,
pms_path);
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 844aabd..3adb91c 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -166,7 +166,7 @@ static int _clear_dev_from_lvmetad_cache(dev_t devno, int32_t major, int32_t min
{
char buf[24];
- (void) dm_snprintf(buf, sizeof(buf), "%" PRIi32 ":%" PRIi32, major, minor);
+ (void) dm_snprintf(buf, sizeof(buf), FMTi32 ":" FMTi32, major, minor);
if (!lvmetad_pv_gone(devno, buf, handler))
return_0;
8 years, 9 months
master - lockd: Clean up spec
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5fb71bd5306201...
Commit: 5fb71bd53062011dd962d77b233552ffad128238
Parent: dd385eb5ac963c74b617b912c99ef97e4a73486f
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Fri Jul 3 09:46:49 2015 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Sat Jul 4 14:36:57 2015 +0200
lockd: Clean up spec
---
nix/default.nix | 2 +-
spec/packages.inc | 4 ----
2 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index c7462a0..abfbcd9 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -367,7 +367,7 @@ let
centos66 = centos65;
centos70 = [ "dlm-devel" "dlm" "corosynclib-devel" "perl-Digest-MD5" "systemd-devel"
"socat" # used by test suite lvmpolld
- "sanlock" # used by test suite lvmlockd
+ # "sanlock" # used by lvmlockd. Required version present in 7.2 only
"procps-ng" ];
fedora17_18 = [ "dlm-devel" "corosynclib-devel" "libblkid" "libblkid-devel"
diff --git a/spec/packages.inc b/spec/packages.inc
index 8d2195a..ed02822 100644
--- a/spec/packages.inc
+++ b/spec/packages.inc
@@ -192,7 +192,6 @@ fi
%if %{have_service lvmlockd}
%{_unitdir}/lvm2-lvmlockd.service
%{_unitdir}/lvm2-lvmlocking.service
- #%{_unitdir}/lvm2-lvmlockd.socket
%endif
%else
%{_sysconfdir}/rc.d/init.d/lvm2-monitor
@@ -203,9 +202,6 @@ fi
%if %{have_service lvmpolld}
%{_sysconfdir}/rc.d/init.d/lvm2-lvmpolld
%endif
- #%if %{have_service lvmlockd}
- # %{_sysconfdir}/rc.d/init.d/lvm2-lvmlockd
- #%endif
%endif
##############################################################################
8 years, 9 months
master - Build lockd only for Fedora >= 22 and RHEL >= 7
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dd385eb5ac963c...
Commit: dd385eb5ac963c74b617b912c99ef97e4a73486f
Parent: b4e8de3a3156e2385e08bf12fb483eb3cad519e2
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Fri Jun 26 19:03:56 2015 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Sat Jul 4 14:36:57 2015 +0200
Build lockd only for Fedora >= 22 and RHEL >= 7
---
spec/source.inc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/spec/source.inc b/spec/source.inc
index 00d5282..0a0d9e5 100644
--- a/spec/source.inc
+++ b/spec/source.inc
@@ -27,7 +27,9 @@
%service lvmpolld 1
+%if %{fedora} >= 22 || %{rhel} >= 7
%service lvmlockd 1
+%endif
##############################################################
8 years, 9 months
v2_02_124 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6c1668e2218721...
Commit: 6c1668e2218721473193e8bef93bdf775cec0e89
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-07-03 15:55 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-07-03 15:55 +0000
annotated tag: v2_02_124 has been created
at 6c1668e2218721473193e8bef93bdf775cec0e89 (tag)
tagging 36ce97c6250a513c73e388261ccb376cd351e11f (commit)
replaces v2_02_123
Release 2.02.124.
This release includes experimental lvmlockd code which is still under
active development. If you enable and use this feature, upgrading to
future releases might require manual intervention if we introduce
incompatibilities.
115 files changed, 17287 insertions(+), 553 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlWWsGcACgkQIoGRwVZ+LBdPQACeKbwBnsWs+pTIA44G+NT+SRPG
vsEAnRnqNhe6IldFJA4Q6nae3rXY6uiH
=DI93
-----END PGP SIGNATURE-----
Alasdair G Kergon (3):
post-release
locking: Add missing error handling.
pre-release
David Teigland (2):
Add lvmlockd
lockd: fix stub functions for LV locking
Peter Rajnoha (8):
config: report/time_format appeared in v2.02.123
report: fix regression while selecting string fields using synonyms
tests: add test for 454782f (select with synonyms for string field types)
report: adjust shared flags based on expected type for reserved values
cleanup: commit fe70b03 turned lv_time to STR, put it back to TIM
report: add infrastructure to recognize fuzzy reserved names and returning dynamic reserved values
report: call appropriate handler to evaluate fuzzy reserved names and dynamic reserved values
report: select: add handler to recognize fuzzy time specification
Zdenek Kabelac (7):
libdm: add helper function to print _node_name
libdm: enhance tracing messages
display: missed to count with 0
thin: check for overprovisioning
libdm: support for posting messages in suspend
thin: move pool messaging from resume to suspend
tests: update for new thin pool messaging
8 years, 9 months