diff options
author | Alasdair Kergon <agk@redhat.com> | 2002-04-11 14:10:32 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2002-04-11 14:10:32 +0000 |
commit | 7e3d403b88049abc81e4e6e01c2d9a1f57c38398 (patch) | |
tree | 22e852f88a88bf191b7f7703b81d110833b5b9f3 /lib/locking/no_locking.c | |
parent | 63def4e7165b5230f80df32282cb88e0dfb4830c (diff) | |
download | lvm2-7e3d403b88049abc81e4e6e01c2d9a1f57c38398.tar.gz lvm2-7e3d403b88049abc81e4e6e01c2d9a1f57c38398.tar.xz lvm2-7e3d403b88049abc81e4e6e01c2d9a1f57c38398.zip |
Implement a no_locking module that *does* attempt activation.
Diffstat (limited to 'lib/locking/no_locking.c')
-rw-r--r-- | lib/locking/no_locking.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c new file mode 100644 index 00000000..b4af7966 --- /dev/null +++ b/lib/locking/no_locking.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + * + */ + +#include "log.h" +#include "locking.h" +#include "locking_types.h" +#include "lvm-string.h" +#include "activate.h" + +#include <signal.h> + +/* + * No locking + */ + +static void _no_fin_locking(void) +{ + return; +} + +static int _no_lock_resource(struct cmd_context *cmd, const char *resource, + int flags) +{ + switch (flags & LCK_SCOPE_MASK) { + case LCK_VG: + break; + case LCK_LV: + switch (flags & LCK_TYPE_MASK) { + case LCK_UNLOCK: + return lv_resume_if_active(cmd, resource); + case LCK_READ: + return lv_activate(cmd, resource); + case LCK_WRITE: + return lv_suspend_if_active(cmd, resource); + case LCK_EXCL: + return lv_deactivate(cmd, resource); + default: + break; + } + break; + default: + log_error("Unrecognised lock scope: %d", + flags & LCK_SCOPE_MASK); + return 0; + } + + return 1; +} + +int init_no_locking(struct locking_type *locking, struct config_file *cf) +{ + locking->lock_resource = _no_lock_resource; + locking->fin_locking = _no_fin_locking; + + return 1; +} |