1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

vdo: minor API cleanup

Since the parse_vdo_pool_status() become vdo_manip API part,
and there will be no 'dm' matching status parser,
the API can be simplified and closely match thin API here.
This commit is contained in:
Zdenek Kabelac 2019-01-21 00:48:05 +01:00
parent fc02343eff
commit e689bfb5d5
3 changed files with 9 additions and 20 deletions

View File

@ -1359,8 +1359,6 @@ int lv_vdo_pool_status(const struct logical_volume *lv, int flush,
{ {
int r = 0; int r = 0;
struct dev_manager *dm; struct dev_manager *dm;
struct lv_status_vdo *status;
char *params;
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0)) if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0; return 0;
@ -1371,14 +1369,10 @@ int lv_vdo_pool_status(const struct logical_volume *lv, int flush,
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, !lv_is_pvmove(lv)))) if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, !lv_is_pvmove(lv))))
return_0; return_0;
if (!dev_manager_vdo_pool_status(dm, lv, flush, &params, &status)) if (!dev_manager_vdo_pool_status(dm, lv, vdo_status, flush))
goto_out; goto_out;
if (!parse_vdo_pool_status(status->mem, lv, params, status)) /* User has to call dm_pool_destroy(vdo_status->mem) */
goto_out;
/* User is responsible to dm_pool_destroy memory pool! */
*vdo_status = status;
r = 1; r = 1;
out: out:
if (!r) if (!r)

View File

@ -1792,9 +1792,8 @@ out:
int dev_manager_vdo_pool_status(struct dev_manager *dm, int dev_manager_vdo_pool_status(struct dev_manager *dm,
const struct logical_volume *lv, const struct logical_volume *lv,
int flush, struct lv_status_vdo **vdo_status,
char **vdo_params, int flush)
struct lv_status_vdo **vdo_status)
{ {
struct lv_status_vdo *status; struct lv_status_vdo *status;
const char *dlid; const char *dlid;
@ -1805,7 +1804,6 @@ int dev_manager_vdo_pool_status(struct dev_manager *dm,
char *params = NULL; char *params = NULL;
int r = 0; int r = 0;
*vdo_params = NULL;
*vdo_status = NULL; *vdo_status = NULL;
if (!(status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_vdo)))) { if (!(status = dm_pool_zalloc(dm->mem, sizeof(struct lv_status_vdo)))) {
@ -1834,13 +1832,11 @@ int dev_manager_vdo_pool_status(struct dev_manager *dm,
goto out; goto out;
} }
if (!(*vdo_params = dm_pool_strdup(dm->mem, params))) { if (!parse_vdo_pool_status(dm->mem, lv, params, status))
log_error("Cannot duplicate VDO status params."); goto_out;
goto out;
}
status->mem = dm->mem; status->mem = dm->mem;
*vdo_status = status; *vdo_status = status;
r = 1; r = 1;
out: out:

View File

@ -84,9 +84,8 @@ int dev_manager_thin_device_id(struct dev_manager *dm,
uint32_t *device_id); uint32_t *device_id);
int dev_manager_vdo_pool_status(struct dev_manager *dm, int dev_manager_vdo_pool_status(struct dev_manager *dm,
const struct logical_volume *lv, const struct logical_volume *lv,
int flush, struct lv_status_vdo **vdo_status,
char **vdo_params, int flush);
struct lv_status_vdo **vdo_status);
int dev_manager_suspend(struct dev_manager *dm, const struct logical_volume *lv, int dev_manager_suspend(struct dev_manager *dm, const struct logical_volume *lv,
struct lv_activate_opts *laopts, int lockfs, int flush_required); struct lv_activate_opts *laopts, int lockfs, int flush_required);
int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv, int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv,