diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/pvscan.c | 2 | ||||
-rw-r--r-- | tools/toollib.c | 34 | ||||
-rw-r--r-- | tools/vgimportclone.c | 15 |
3 files changed, 7 insertions, 44 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c index 1c58e4a5b..96935a43b 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -703,7 +703,7 @@ static int _pvscan_aa_quick(struct cmd_context *cmd, struct pvscan_aa_params *pp * devices used by the VG we read. */ dm_list_iterate_items(pvl, &vg->pvs) { - if (dev_in_device_list(pvl->pv->dev, &devs)) + if (device_list_find_dev(&devs, pvl->pv->dev)) continue; log_error_pvscan(cmd, "activation for VG %s found different devices.", vgname); ret = ECMD_FAILED; diff --git a/tools/toollib.c b/tools/toollib.c index 5305e811b..ae6f311ba 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -4133,32 +4133,6 @@ static int _get_arg_devices(struct cmd_context *cmd, return ret_max; } -static int _device_list_remove(struct dm_list *devices, struct device *dev) -{ - struct device_id_list *dil; - - dm_list_iterate_items(dil, devices) { - if (dil->dev == dev) { - dm_list_del(&dil->list); - return 1; - } - } - - return 0; -} - -static struct device_id_list *_device_list_find_dev(struct dm_list *devices, struct device *dev) -{ - struct device_id_list *dil; - - dm_list_iterate_items(dil, devices) { - if (dil->dev == dev) - return dil; - } - - return NULL; -} - /* Process devices that are not PVs. */ static int _process_other_devices(struct cmd_context *cmd, @@ -4263,8 +4237,8 @@ static int _process_duplicate_pvs(struct cmd_context *cmd, dm_list_iterate_items(devl, &unused_duplicate_devs) { /* Duplicates are displayed if -a is used or the dev is named as an arg. */ - if ((dil = _device_list_find_dev(arg_devices, devl->dev))) - _device_list_remove(arg_devices, devl->dev); + if ((dil = device_id_list_find_dev(arg_devices, devl->dev))) + device_id_list_remove(arg_devices, devl->dev); if (!process_other_devices && !dil) continue; @@ -4384,8 +4358,8 @@ static int _process_pvs_in_vg(struct cmd_context *cmd, /* Remove each arg_devices entry as it is processed. */ if (arg_devices && !dm_list_empty(arg_devices)) { - if ((dil = _device_list_find_dev(arg_devices, pv->dev))) - _device_list_remove(arg_devices, dil->dev); + if ((dil = device_id_list_find_dev(arg_devices, pv->dev))) + device_id_list_remove(arg_devices, dil->dev); } if (!process_pv && dil) diff --git a/tools/vgimportclone.c b/tools/vgimportclone.c index 9e426c942..60ef20762 100644 --- a/tools/vgimportclone.c +++ b/tools/vgimportclone.c @@ -25,17 +25,6 @@ struct vgimportclone_params { unsigned import_vg:1; }; -static struct device_list *_get_device_list(struct dm_list *list, struct device *dev) -{ - struct device_list *devl; - - dm_list_iterate_items(devl, list) { - if (devl->dev == dev) - return devl; - } - return NULL; -} - static int _update_vg(struct cmd_context *cmd, struct volume_group *vg, struct vgimportclone_params *vp) { @@ -82,7 +71,7 @@ static int _update_vg(struct cmd_context *cmd, struct volume_group *vg, */ dm_list_iterate_items(pvl, &vg->pvs) { - if ((devl = _get_device_list(&vp->new_devs, pvl->pv->dev))) { + if ((devl = device_list_find_dev(&vp->new_devs, pvl->pv->dev))) { dm_list_del(&devl->list); dm_list_add(&tmp_devs, &devl->list); } else { @@ -192,7 +181,7 @@ static int _get_other_devs(struct cmd_context *cmd, struct dm_list *new_devs, st return_0; while ((dev = dev_iter_get(cmd, iter))) { - if (_get_device_list(new_devs, dev)) + if (device_list_find_dev(new_devs, dev)) continue; if (!(devl = zalloc(sizeof(*devl)))) { r = 0; |