1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

liblvm: internal API change

Return LV/NULL instead of 1/0 which saves lookup for created LV.
This commit is contained in:
Zdenek Kabelac 2012-11-13 10:49:32 +01:00
parent cf5242a670
commit 2e96ea4a89
3 changed files with 8 additions and 10 deletions

View File

@ -4714,8 +4714,8 @@ revert_new_lv:
return NULL;
}
int lv_create_single(struct volume_group *vg,
struct lvcreate_params *lp)
struct logical_volume *lv_create_single(struct volume_group *vg,
struct lvcreate_params *lp)
{
struct logical_volume *lv;
@ -4743,5 +4743,5 @@ int lv_create_single(struct volume_group *vg,
out:
log_print_unless_silent("Logical volume \"%s\" created", lv->name);
return 1;
return lv;
}

View File

@ -626,8 +626,8 @@ struct lvcreate_params {
struct dm_list tags; /* all */
};
int lv_create_single(struct volume_group *vg,
struct lvcreate_params *lp);
struct logical_volume *lv_create_single(struct volume_group *vg,
struct lvcreate_params *lp);
/*
* Functions for layer manipulation

View File

@ -146,7 +146,7 @@ lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
{
struct lvcreate_params lp = { 0 };
uint64_t extents;
struct lv_list *lvl;
struct logival_volume *lv;
if (vg_read_error(vg))
return NULL;
@ -162,11 +162,9 @@ lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
_lv_set_default_params(&lp, vg, name, extents);
if (!_lv_set_default_linear_params(vg->cmd, &lp))
return_NULL;
if (!lv_create_single(vg, &lp))
if (!(lv = lv_create_single(vg, &lp)))
return_NULL;
if (!(lvl = find_lv_in_vg(vg, name)))
return NULL;
return (lv_t) lvl->lv;
return (lv_t) lv;
}
/*