master - liblvm: internal API change
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e96ea4a899a0d0a5adb5e3d8fa09e04fd7a4173 Commit: 2e96ea4a899a0d0a5adb5e3d8fa09e04fd7a4173 Parent: cf5242a670010a7c0137090a330b78b3bf43a55b Author: Zdenek Kabelac <[email protected]> AuthorDate: Tue Nov 13 10:49:32 2012 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Nov 19 14:37:30 2012 +0100
liblvm: internal API change
Return LV/NULL instead of 1/0 which saves lookup for created LV.
--- lib/metadata/lv_manip.c | 6 +++--- lib/metadata/metadata-exported.h | 4 ++-- liblvm/lvm_lv.c | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-)
lib/metadata/lv_manip.c +3 -3
@@ -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; }
lib/metadata/metadata-exported.h +2 -2
@@ -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
liblvm/lvm_lv.c +3 -5
@@ -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; }/*