From 2f3d8659b1d339da72e48ddcfbe7fa2cfb28e957 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 9 Aug 2023 13:43:45 +0200 Subject: [PATCH] commands: add lv_is_writable --- lib/metadata/metadata-exported.h | 1 + tools/lv_props.h | 1 + tools/toollib.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 8e8af8127..eea728023 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -220,6 +220,7 @@ #define lv_is_locked(lv) (((lv)->status & LOCKED) ? 1 : 0) #define lv_is_partial(lv) (((lv)->status & PARTIAL_LV) ? 1 : 0) #define lv_is_virtual(lv) (((lv)->status & VIRTUAL) ? 1 : 0) +#define lv_is_writable(lv) (((lv)->status & LVM_WRITE) ? 1 : 0) #define lv_is_merging(lv) (((lv)->status & MERGING) ? 1 : 0) #define lv_is_merging_origin(lv) (lv_is_merging(lv) && (lv)->snapshot) #define lv_is_snapshot(lv) (((lv)->status & SNAPSHOT) ? 1 : 0) diff --git a/tools/lv_props.h b/tools/lv_props.h index cda7211d9..df5d2bb8b 100644 --- a/tools/lv_props.h +++ b/tools/lv_props.h @@ -25,6 +25,7 @@ lvp(is_error_when_full_LVP, "lv_is_error_when_full", NULL) lvp(is_pvmove_LVP, "lv_is_pvmove", NULL) lvp(is_removed_LVP, "lv_is_removed", NULL) lvp(is_vg_writable_LVP, "lv_is_vg_writable", NULL) +lvp(is_writable_LVP, "lv_is_writable", NULL) /* kinds of sub LV */ lvp(is_thinpool_data_LVP, "lv_is_thinpool_data", NULL) diff --git a/tools/toollib.c b/tools/toollib.c index afb056fbb..9a41fcf70 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -2714,6 +2714,8 @@ static int _lv_is_prop(struct cmd_context *cmd, struct logical_volume *lv, int l return lv_is_pvmove(lv); case is_removed_LVP: return lv_is_removed(lv); + case is_writable_LVP: + return lv_is_writable(lv); case is_vg_writable_LVP: return (lv->vg->status & LVM_WRITE) ? 1 : 0; case is_thinpool_data_LVP: