[lvm-devel] [PATCH 16/20] Add pv_name_dup() and pv_fmt_dup() helper functions.
Dave Wysochanski
dwysocha at redhat.com
Wed Sep 22 21:06:28 UTC 2010
Signed-off-by: Dave Wysochanski <dwysocha at redhat.com>
---
lib/metadata/pv.c | 12 ++++++++++++
lib/metadata/pv.h | 2 ++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/pv.c b/lib/metadata/pv.c
index 8b4dbf5..e4c73d3 100644
--- a/lib/metadata/pv.c
+++ b/lib/metadata/pv.c
@@ -21,6 +21,18 @@
*/
#define pv_field(handle, field) ((handle)->field)
+char *pv_fmt_dup(const struct physical_volume *pv)
+{
+ if (!pv->fmt)
+ return NULL;
+ return dm_pool_strdup(pv->vg->vgmem, pv->fmt->name);
+}
+
+char *pv_name_dup(const struct physical_volume *pv)
+{
+ return dm_pool_strdup(pv->vg->vgmem, dev_name(pv->dev));
+}
+
/*
* Gets/Sets for external LVM library
*/
diff --git a/lib/metadata/pv.h b/lib/metadata/pv.h
index 295f811..0be1e23 100644
--- a/lib/metadata/pv.h
+++ b/lib/metadata/pv.h
@@ -52,6 +52,8 @@ struct physical_volume {
struct dm_list tags;
};
+char *pv_fmt_dup(const struct physical_volume *pv);
+char *pv_name_dup(const struct physical_volume *pv);
struct device *pv_dev(const struct physical_volume *pv);
const char *pv_vg_name(const struct physical_volume *pv);
char *pv_attr_dup(struct dm_pool *mem, const struct physical_volume *pv);
--
1.7.2.2
More information about the lvm-devel
mailing list