mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
liblvm: internal API change
Return LV/NULL instead of 1/0 which saves lookup for created LV.
This commit is contained in:
parent
cf5242a670
commit
2e96ea4a89
@ -4714,7 +4714,7 @@ revert_new_lv:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lv_create_single(struct volume_group *vg,
|
struct logical_volume *lv_create_single(struct volume_group *vg,
|
||||||
struct lvcreate_params *lp)
|
struct lvcreate_params *lp)
|
||||||
{
|
{
|
||||||
struct logical_volume *lv;
|
struct logical_volume *lv;
|
||||||
@ -4743,5 +4743,5 @@ int lv_create_single(struct volume_group *vg,
|
|||||||
out:
|
out:
|
||||||
log_print_unless_silent("Logical volume \"%s\" created", lv->name);
|
log_print_unless_silent("Logical volume \"%s\" created", lv->name);
|
||||||
|
|
||||||
return 1;
|
return lv;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,7 @@ struct lvcreate_params {
|
|||||||
struct dm_list tags; /* all */
|
struct dm_list tags; /* all */
|
||||||
};
|
};
|
||||||
|
|
||||||
int lv_create_single(struct volume_group *vg,
|
struct logical_volume *lv_create_single(struct volume_group *vg,
|
||||||
struct lvcreate_params *lp);
|
struct lvcreate_params *lp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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 };
|
struct lvcreate_params lp = { 0 };
|
||||||
uint64_t extents;
|
uint64_t extents;
|
||||||
struct lv_list *lvl;
|
struct logival_volume *lv;
|
||||||
|
|
||||||
if (vg_read_error(vg))
|
if (vg_read_error(vg))
|
||||||
return NULL;
|
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);
|
_lv_set_default_params(&lp, vg, name, extents);
|
||||||
if (!_lv_set_default_linear_params(vg->cmd, &lp))
|
if (!_lv_set_default_linear_params(vg->cmd, &lp))
|
||||||
return_NULL;
|
return_NULL;
|
||||||
if (!lv_create_single(vg, &lp))
|
if (!(lv = lv_create_single(vg, &lp)))
|
||||||
return_NULL;
|
return_NULL;
|
||||||
if (!(lvl = find_lv_in_vg(vg, name)))
|
return (lv_t) lv;
|
||||||
return NULL;
|
|
||||||
return (lv_t) lvl->lv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user