summaryrefslogtreecommitdiffstats
path: root/liblvm
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2009-07-26 13:06:59 +0000
committerDave Wysochanski <dwysocha@redhat.com>2009-07-26 13:06:59 +0000
commit83f25cd121558488495e249c23a67dbaa383dab8 (patch)
treeee59767bfe3b32e9fcd03cc6fda2c0211d86174a /liblvm
parent8b3755a679fe4eded154c2b6326b290bd0e963ed (diff)
downloadlvm2-83f25cd121558488495e249c23a67dbaa383dab8.tar.gz
lvm2-83f25cd121558488495e249c23a67dbaa383dab8.tar.xz
lvm2-83f25cd121558488495e249c23a67dbaa383dab8.zip
Add most all liblvm 'get' functions needed for anaconda.
Add the most straightforward 'get' functions required for anaconda. These are the ones that return simple uint64_t values. The other more complex ones involve the lv_attr bits. These will come in a separate patch series since each lv_attr bit will be returned in a separate API instred of returning the string and requiring the user to parse it. Author: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'liblvm')
-rw-r--r--liblvm/.exported_symbols12
-rw-r--r--liblvm/lvm.h15
-rw-r--r--liblvm/lvm_lv.c6
-rw-r--r--liblvm/lvm_pv.c4
-rw-r--r--liblvm/lvm_vg.c31
5 files changed, 66 insertions, 2 deletions
diff --git a/liblvm/.exported_symbols b/liblvm/.exported_symbols
index 3d42cc76..bf184322 100644
--- a/liblvm/.exported_symbols
+++ b/liblvm/.exported_symbols
@@ -1,12 +1,20 @@
lvm_create
lvm_destroy
lvm_reload_config
+lvm_pv_get_name
lvm_pv_get_uuid
+lvm_pv_get_mda_count
+lvm_vg_get_name
lvm_vg_get_uuid
+lvm_vg_get_size
+lvm_vg_get_free
+lvm_vg_get_extent_size
+lvm_vg_get_extent_count
+lvm_vg_get_free_count
+lvm_vg_get_pv_count
lvm_lv_get_uuid
-lvm_pv_get_name
-lvm_vg_get_name
lvm_lv_get_name
+lvm_lv_get_size
lvm_vg_create
lvm_vg_extend
lvm_vg_set_extent_size
diff --git a/liblvm/lvm.h b/liblvm/lvm.h
index f2080f71..a39f1980 100644
--- a/liblvm/lvm.h
+++ b/liblvm/lvm.h
@@ -243,6 +243,21 @@ char *lvm_vg_get_name(const vg_t *vg);
char *lvm_lv_get_name(const lv_t *lv);
/**
+ * Get various pv, vg, or lv properties.
+ * For full description of each property, consult the man pages for pvs,
+ * vgs, and lvs.
+ * FIXME: What value to return for invalid handle or other errors?
+ */
+uint64_t lvm_pv_get_mda_count(const pv_t *pv);
+uint64_t lvm_vg_get_size(const vg_t *vg);
+uint64_t lvm_vg_get_free(const vg_t *vg);
+uint64_t lvm_vg_get_extent_size(const vg_t *vg);
+uint64_t lvm_vg_get_extent_count(const vg_t *vg);
+uint64_t lvm_vg_get_free_count(const vg_t *vg);
+uint64_t lvm_vg_get_pv_count(const vg_t *vg);
+uint64_t lvm_lv_get_size(const lv_t *lv);
+
+/**
* Close a VG opened with lvm_vg_create
*
* This API releases a VG handle and any resources associated with the handle.
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index e914d6c2..7a7bfb30 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -20,6 +20,12 @@
#include "segtype.h"
#include <string.h>
+/* FIXME: have lib/report/report.c _disp function call lv_size()? */
+uint64_t lvm_lv_get_size(const lv_t *lv)
+{
+ return lv_size(lv);
+}
+
char *lvm_lv_get_uuid(const lv_t *lv)
{
char uuid[64] __attribute((aligned(8)));
diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c
index 0618a84d..ea3cee34 100644
--- a/liblvm/lvm_pv.c
+++ b/liblvm/lvm_pv.c
@@ -38,3 +38,7 @@ char *lvm_pv_get_name(const pv_t *pv)
return name;
}
+uint64_t lvm_pv_get_mda_count(const pv_t *pv)
+{
+ return (uint64_t) pv_mda_count(pv);
+}
diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c
index 0668aee5..16686a19 100644
--- a/liblvm/lvm_vg.c
+++ b/liblvm/lvm_vg.c
@@ -190,6 +190,37 @@ struct dm_list *lvm_vg_list_lvs(vg_t *vg)
return list;
}
+/* FIXME: invalid handle? return INTMAX? */
+uint64_t lvm_vg_get_size(const vg_t *vg)
+{
+ return vg_size(vg);
+}
+
+uint64_t lvm_vg_get_free(const vg_t *vg)
+{
+ return vg_free(vg);
+}
+
+uint64_t lvm_vg_get_extent_size(const vg_t *vg)
+{
+ return vg_extent_size(vg);
+}
+
+uint64_t lvm_vg_get_extent_count(const vg_t *vg)
+{
+ return vg_extent_count(vg);
+}
+
+uint64_t lvm_vg_get_free_count(const vg_t *vg)
+{
+ return vg_free_count(vg);
+}
+
+uint64_t lvm_vg_get_pv_count(const vg_t *vg)
+{
+ return vg_pv_count(vg);
+}
+
char *lvm_vg_get_uuid(const vg_t *vg)
{
char uuid[64] __attribute((aligned(8)));