1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

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>
This commit is contained in:
Dave Wysochanski 2009-07-26 13:06:59 +00:00
parent 8b3755a679
commit 83f25cd121
5 changed files with 67 additions and 3 deletions

View File

@ -1,12 +1,20 @@
lvm_create
lvm_destroy
lvm_reload_config
lvm_pv_get_uuid
lvm_vg_get_uuid
lvm_lv_get_uuid
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_lv_get_name
lvm_lv_get_size
lvm_vg_create
lvm_vg_extend
lvm_vg_set_extent_size

View File

@ -242,6 +242,21 @@ char *lvm_pv_get_name(const pv_t *pv);
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
*

View File

@ -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)));

View File

@ -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);
}

View File

@ -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)));