1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-08-02 04:22:02 +03:00

Add a new type and function to lvm2app to enumerate pvsegs.

Signed-off-by: Dave Wysochanski <wysochanski@pobox.com>
Reviewed-by: Petr Rockai <prockai@redhat.com>
This commit is contained in:
Petr Rockai
2010-11-17 20:10:42 +00:00
parent 5de70620ef
commit b2b27cd7f4
2 changed files with 58 additions and 0 deletions

View File

@ -54,6 +54,33 @@ struct lvm_property_value lvm_pv_get_property(const pv_t pv, const char *name)
return get_property(pv, NULL, NULL, NULL, name);
}
struct dm_list *lvm_pv_list_pvsegs(pv_t pv)
{
struct dm_list *list;
pvseg_list_t *pvseg;
struct pv_segment *pvl;
if (dm_list_empty(&pv->segments))
return NULL;
if (!(list = dm_pool_zalloc(pv->vg->vgmem, sizeof(*list)))) {
log_errno(ENOMEM, "Memory allocation fail for dm_list.");
return NULL;
}
dm_list_init(list);
dm_list_iterate_items(pvl, &pv->segments) {
if (!(pvseg = dm_pool_zalloc(pv->vg->vgmem, sizeof(*pvseg)))) {
log_errno(ENOMEM,
"Memory allocation fail for lvm_pvseg_list.");
return NULL;
}
pvseg->pvseg = pvl;
dm_list_add(list, &pvseg->list);
}
return list;
}
int lvm_pv_resize(const pv_t pv, uint64_t new_size)
{
/* FIXME: add pv resize code here */