mirror of
git://sourceware.org/git/lvm2.git
synced 2024-10-27 18:55:19 +03:00
metadata: add find_historical_glv fn
The find_historical_glv is helper function that looks up historical LV in struct volume_group's historical_lvs list and returns it if found.
This commit is contained in:
parent
a0842d1f25
commit
c45af2df4e
@ -1026,6 +1026,11 @@ struct lv_list *find_lv_in_vg(const struct volume_group *vg,
|
||||
/* FIXME Merge these functions with ones above */
|
||||
struct logical_volume *find_lv(const struct volume_group *vg,
|
||||
const char *lv_name);
|
||||
|
||||
struct generic_logical_volume *find_historical_glv(const struct volume_group *vg,
|
||||
const char *historical_lv_name,
|
||||
struct glv_list **glvl_found);
|
||||
|
||||
struct physical_volume *find_pv_by_name(struct cmd_context *cmd,
|
||||
const char *pv_name,
|
||||
int allow_orphan, int allow_unformatted);
|
||||
|
@ -2120,6 +2120,32 @@ struct logical_volume *find_lv(const struct volume_group *vg,
|
||||
return lvl ? lvl->lv : NULL;
|
||||
}
|
||||
|
||||
struct generic_logical_volume *find_historical_glv(const struct volume_group *vg,
|
||||
const char *historical_lv_name,
|
||||
struct glv_list **glvl_found)
|
||||
{
|
||||
struct glv_list *glvl;
|
||||
const char *ptr;
|
||||
|
||||
/* Use last component */
|
||||
if ((ptr = strrchr(historical_lv_name, '/')))
|
||||
ptr++;
|
||||
else
|
||||
ptr = historical_lv_name;
|
||||
|
||||
dm_list_iterate_items(glvl, &vg->historical_lvs) {
|
||||
if (!strcmp(glvl->glv->historical->name, ptr)) {
|
||||
if (glvl_found)
|
||||
*glvl_found = glvl;
|
||||
return glvl->glv;
|
||||
}
|
||||
}
|
||||
|
||||
if (glvl_found)
|
||||
*glvl_found = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct physical_volume *find_pv(struct volume_group *vg, struct device *dev)
|
||||
{
|
||||
struct pv_list *pvl;
|
||||
|
Loading…
Reference in New Issue
Block a user