diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-26 20:58:11 +0000 |
---|---|---|
committer | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-26 20:58:11 +0000 |
commit | 2642ef553a389c5f3f38dc4dbf12ec5618075dcf (patch) | |
tree | 32b7010fce6d75cabba8c5376b6b679a4554142c /liblvm/lvm_lv.c | |
parent | 63b186b6f74b251b0e1854015cf88789e0a319c1 (diff) | |
download | lvm2-2642ef553a389c5f3f38dc4dbf12ec5618075dcf.tar.gz lvm2-2642ef553a389c5f3f38dc4dbf12ec5618075dcf.tar.xz lvm2-2642ef553a389c5f3f38dc4dbf12ec5618075dcf.zip |
Add lvm_lv_is_active and lvm_lv_is_suspended.
Return whether an LV is active in the kernel (live table) or suspended
(table suspend).
Author: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'liblvm/lvm_lv.c')
-rw-r--r-- | liblvm/lvm_lv.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c index 78057afe..a2436ed4 100644 --- a/liblvm/lvm_lv.c +++ b/liblvm/lvm_lv.c @@ -19,6 +19,7 @@ #include "defaults.h" #include "segtype.h" #include "locking.h" +#include "activate.h" #include <string.h> @@ -49,6 +50,24 @@ char *lvm_lv_get_name(const lv_t *lv) return name; } +uint64_t lvm_lv_is_active(const lv_t *lv) +{ + struct lvinfo info; + if (lv_info(lv->vg->cmd, lv, &info, 1, 0) && + info.exists && info.live_table) + return 1; + return 0; +} + +uint64_t lvm_lv_is_suspended(const lv_t *lv) +{ + struct lvinfo info; + if (lv_info(lv->vg->cmd, lv, &info, 1, 0) && + info.exists && info.suspended) + return 1; + return 0; +} + /* Set defaults for non-segment specific LV parameters */ static void _lv_set_default_params(struct lvcreate_params *lp, vg_t *vg, const char *lvname, |