master - Implement lock-override options without locking type
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6e6ef95ba65aea0367eb88fa2062e93fe66bbc6e Commit: 6e6ef95ba65aea0367eb88fa2062e93fe66bbc6e Parent: e966752b867c0fe379737b0bda1e850a19dabf00 Author: David Teigland <[email protected]> AuthorDate: Wed Jun 6 16:31:59 2018 -0500 Committer: Joe Thornber <[email protected]> CommitterDate: Thu Jun 7 16:17:04 2018 +0100
Implement lock-override options without locking type
The options: --nolocking, --readonly, --sysinit override, or make exceptions to, the normal file locking behavior. Implement these by just checking for the options in the file locking path instead of using special locking types.
--- lib/locking/file_locking.c | 2 +- lib/locking/locking.c | 58 +++++++++++++++++++++++++++++++++--------- lib/locking/locking.h | 2 +- lib/locking/locking_types.h | 18 +------------ tools/lvmcmdline.c | 52 +++++++++++++++++++------------------- 5 files changed, 75 insertions(+), 57 deletions(-)
lib/locking/file_locking.c +1 -1
@@ -92,7 +92,7 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, locking->lock_resource = _file_lock_resource; locking->reset_locking = _reset_file_locking; locking->fin_locking = _fin_file_locking; - locking->flags =0 ; + locking->flags =LCK_FLOCK ;/* Get lockfile directory from config file */ locking_dir =find_config_tree_str (cmd, global_locking_dir_CFG,NULL );
lib/locking/locking.c +45 -13
107 lines not on this page · raw message
lib/locking/locking.h +1 -1
@@ -21,7 +21,7 @@struct logical_volume ; -int init_locking (int type,struct cmd_context *cmd,int suppress_messages); +int init_locking (struct cmd_context *cmd,int suppress_messages,int only_read_locks);void fin_locking (void );void reset_locking (void );int vg_write_lock_held (void );
lib/locking/locking_types.h +2 -16
@@ -23,12 +23,10 @@ typedef int (*query_resource_fn) (const char *resource, const char *node, int *mtypedef void (*fin_lock_fn ) (void );typedef void (*reset_lock_fn ) (void ); -#define LCK_PRE_MEMLOCK 0x00000001/* Is memlock() needed before calls? */ -#define LCK_CLUSTERED 0x00000002 -#define LCK_SUPPORTS_REMOTE_QUERIES 0x00000004 +#define LCK_FLOCK 0x00000001struct locking_type { -uint32_t flags; +uint32_t flags;/* 0 means file locking is disabled */ lock_resource_fn lock_resource;query_resource_fn query_resource;
@@ -36,17 +34,5 @@ struct locking_type {fin_lock_fn fin_locking; }; -/* -* Locking types -*/ -void init_no_locking (struct locking_type *locking,struct cmd_context *cmd, -int suppress_messages); - -void init_dummy_locking (struct locking_type *locking,struct cmd_context *cmd, -int suppress_messages); - -int init_readonly_locking (struct locking_type *locking,struct cmd_context *cmd, -int suppress_messages); -int init_file_locking (struct locking_type *locking,struct cmd_context *cmd,int suppress_messages);
tools/lvmcmdline.c +26 -26
66 lines not on this page · raw message