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

dev_manager: refactor

Use struct initilizer to setup lvid.
This commit is contained in:
Zdenek Kabelac 2024-03-21 21:03:29 +01:00
parent 9718fd2496
commit abc1b44d8d

View File

@ -2674,13 +2674,14 @@ static int _add_cvol_subdev_to_dtree(struct dev_manager *dm, struct dm_tree *dtr
struct lv_segment *lvseg = first_seg(lv);
struct dm_info info;
char *name ,*dlid;
union lvid lvid = { { { "" } } };
memcpy(&lvid.id[0], &lv->vg->id, sizeof(struct id));
/* When ID is provided in form of metadata_id or data_id, otherwise use CVOL ID */
memcpy(&lvid.id[1],
(meta_or_data && lvseg->metadata_id) ? lvseg->metadata_id :
(lvseg->data_id) ? lvseg->data_id : &pool_lv->lvid.id[1], sizeof(struct id));
union lvid lvid = {
{
lv->vg->id,
/* When ID is provided in form of metadata_id or data_id, otherwise use CVOL ID */
(meta_or_data && lvseg->metadata_id) ? *lvseg->metadata_id :
(lvseg->data_id) ? *lvseg->data_id : pool_lv->lvid.id[1]
}
};
if (!(dlid = dm_build_dm_uuid(mem, UUID_PREFIX, (const char *)&lvid.s, layer)))
return_0;