summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-01-26 13:46:57 -0600
committerDavid Teigland <teigland@redhat.com>2016-01-26 13:48:56 -0600
commit6f5a9634973700f3c4e007ec2234a1487201c21a (patch)
tree3d7b9a6229f921ad4acb3a8b042119cb59d1485a
parentd7b72d84a291cec309212b8136ec7cb739ad6163 (diff)
downloadlvm2-6f5a9634973700f3c4e007ec2234a1487201c21a.tar.gz
toollib: renaming some variables
-rw-r--r--lib/metadata/metadata-exported.h3
-rw-r--r--tools/toollib.c51
2 files changed, 29 insertions, 25 deletions
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 977e731b8..b2314edb8 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -584,8 +584,9 @@ struct pvcreate_each_params {
*/
struct dm_list prompts; /* pvcreate_prompt */
struct dm_list arg_devices; /* pvcreate_device, one for each pv_name */
+ struct dm_list arg_process; /* pvcreate_device, used for processing */
struct dm_list arg_confirm; /* pvcreate_device, used for processing */
- struct dm_list arg_create; /* pvcreate_device, used for processing */
+ struct dm_list arg_create; /* pvcreate_device, used for pvcreate */
struct dm_list arg_fail; /* pvcreate_device, failed to create */
struct dm_list pvs; /* pv_list, created and usable for vgcreate/vgextend */
const char *orphan_vg_name;
diff --git a/tools/toollib.c b/tools/toollib.c
index bf2d8a51f..f88527f2f 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3436,6 +3436,7 @@ void pvcreate_each_params_set_defaults(struct pvcreate_each_params *pp)
dm_list_init(&pp->prompts);
dm_list_init(&pp->arg_devices);
+ dm_list_init(&pp->arg_process);
dm_list_init(&pp->arg_confirm);
dm_list_init(&pp->arg_create);
dm_list_init(&pp->arg_fail);
@@ -3640,9 +3641,9 @@ static struct pvcreate_device *_pvcreate_list_find_dev(struct dm_list *devices,
* arg_devices to arg_fail.
*
* If this function decides that an arg_devices entry could be used (possibly
- * requiring a prompt), then it moves the entry from arg_devices to arg_create.
+ * requiring a prompt), then it moves the entry from arg_devices to arg_process.
*
- * Any arg_devices entries that are not moved to arg_fail or arg_create were
+ * Any arg_devices entries that are not moved to arg_fail or arg_process were
* not found. The caller will decide if the command can continue if any
* arg_devices entries were not found, or if any were moved to arg_fail.
*
@@ -3746,7 +3747,7 @@ static int _pvcreate_check1_single(struct cmd_context *cmd,
*/
if (pd->is_orphan_pv || pd->is_not_pv) {
pd->dev = pv->dev;
- dm_list_move(&pp->arg_create, &pd->list);
+ dm_list_move(&pp->arg_process, &pd->list);
return 1;
}
@@ -3767,7 +3768,7 @@ static int _pvcreate_check1_single(struct cmd_context *cmd,
dm_list_add(&pp->prompts, &prompt->list);
pd->dev = pv->dev;
- dm_list_move(&pp->arg_create, &pd->list);
+ dm_list_move(&pp->arg_process, &pd->list);
return 1;
}
@@ -3777,7 +3778,7 @@ static int _pvcreate_check1_single(struct cmd_context *cmd,
* lock was not held (during prompting), then they can't be used any more and
* are moved to arg_fail. If they are not found by this loop, that also
* disqualifies them from being used. Each arg_confirm entry that's found and
- * is ok, is moved to arg_create. Those not found will remain in arg_confirm.
+ * is ok, is moved to arg_process. Those not found will remain in arg_confirm.
*
* This check does not need to look in foreign/shared/clustered VGs. If a
* device from arg_confirm was used in a foreign/shared/clustered VG during the
@@ -3857,7 +3858,7 @@ static int _pvcreate_check2_single(struct cmd_context *cmd,
}
/* Device is unchanged from check1. */
- dm_list_move(&pp->arg_create, &pd->list);
+ dm_list_move(&pp->arg_process, &pd->list);
return 1;
fail:
@@ -3968,8 +3969,8 @@ int pvcreate_each_device(struct cmd_context *cmd,
* (arg_devices).
*
* If an arg_devices entry is found during process_each_pv, it's moved
- * to arg_create if it can be used, or arg_fail if it cannot be used.
- * If it's added to arg_create but needs a prompt or force option, then
+ * to arg_process if it can be used, or arg_fail if it cannot be used.
+ * If it's added to arg_process but needs a prompt or force option, then
* a corresponding prompt entry is added to pp->prompts.
*/
process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle, _pvcreate_check1_single);
@@ -4001,7 +4002,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
/*
* The command cannot continue if there are no devices to create.
*/
- if (dm_list_empty(&pp->arg_create)) {
+ if (dm_list_empty(&pp->arg_process)) {
log_error("No devices found.");
goto_bad;
}
@@ -4014,12 +4015,12 @@ int pvcreate_each_device(struct cmd_context *cmd,
switch (prompt->answer) {
case PROMPT_ANSWER_YES:
- /* The PV can be used, leave it on arg_create. */
+ /* The PV can be used, leave it on arg_process. */
dm_list_del(&prompt->list);
break;
case PROMPT_ANSWER_NO:
- /* The PV cannot be used, remove it from arg_create. */
- if ((pd = _pvcreate_list_find_dev(&pp->arg_create, prompt->dev)))
+ /* The PV cannot be used, remove it from arg_process. */
+ if ((pd = _pvcreate_list_find_dev(&pp->arg_process, prompt->dev)))
dm_list_move(&pp->arg_fail, &pd->list);
dm_list_del(&prompt->list);
break;
@@ -4034,7 +4035,7 @@ int pvcreate_each_device(struct cmd_context *cmd,
* locked and go directly to the create steps.
*/
if (dm_list_empty(&pp->prompts))
- goto do_creates;
+ goto do_command;
/*
* Prompts require asking the user, so release the orphans lock, ask
@@ -4052,12 +4053,12 @@ int pvcreate_each_device(struct cmd_context *cmd,
switch (prompt->answer) {
case PROMPT_ANSWER_YES:
- /* The PV can be used, leave it on arg_create. */
+ /* The PV can be used, leave it on arg_process. */
dm_list_del(&prompt->list);
break;
case PROMPT_ANSWER_NO:
- /* The PV cannot be used, remove it from arg_create. */
- if ((pd = _pvcreate_list_find_dev(&pp->arg_create, prompt->dev)))
+ /* The PV cannot be used, remove it from arg_process. */
+ if ((pd = _pvcreate_list_find_dev(&pp->arg_process, prompt->dev)))
dm_list_move(&pp->arg_fail, &pd->list);
dm_list_del(&prompt->list);
break;
@@ -4090,18 +4091,18 @@ int pvcreate_each_device(struct cmd_context *cmd,
/*
* The device args began on the arg_devices list, then the first check
- * loop moved those entries to arg_create as they were found. Devices
+ * loop moved those entries to arg_process as they were found. Devices
* not found during the first loop are not being used, and remain on
* arg_devices.
*
- * Now, the arg_create entries are moved to arg_confirm, and the second
- * check loop moves them back to arg_create as they are found and are
+ * Now, the arg_process entries are moved to arg_confirm, and the second
+ * check loop moves them back to arg_process as they are found and are
* unchanged. Like the first loop, the second loop moves an entry to
* arg_fail if it cannot be used. After the second loop, any devices
* remaining on arg_confirm were not found and are not used.
*/
- dm_list_splice(&pp->arg_confirm, &pp->arg_create);
+ dm_list_splice(&pp->arg_confirm, &pp->arg_process);
process_each_pv(cmd, 0, NULL, NULL, 1, 0, handle, _pvcreate_check2_single);
@@ -4116,12 +4117,14 @@ int pvcreate_each_device(struct cmd_context *cmd,
if (!dm_list_empty(&pp->arg_fail) && must_use_all)
goto_bad;
- if (dm_list_empty(&pp->arg_create)) {
+ if (dm_list_empty(&pp->arg_process)) {
log_error("No devices found.");
goto_bad;
}
-do_creates:
+do_command:
+
+ dm_list_splice(&pp->arg_create, &pp->arg_process);
/*
* Wipe signatures on devices being created.
@@ -4270,10 +4273,10 @@ do_creates:
}
dm_list_iterate_items(pvl, &pp->pvs)
- log_debug("pvcreate succeeded for %s", pv_dev_name(pvl->pv));
+ log_debug("pv command succeeded for %s", pv_dev_name(pvl->pv));
dm_list_iterate_items(pd, &pp->arg_fail)
- log_debug("pvcreate failed for %s", pd->name);
+ log_debug("pv command failed for %s", pd->name);
if (!dm_list_empty(&pp->arg_fail))
goto_bad;