Skip to contentSkip to conversation

master - replace pvcreate_params with pvcreate_each_params

PATCH David Teigland 1 participant 1 message Feb 25, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a77ded3001ad584e75bb3b315a8c99c56951e530
Commit:        a77ded3001ad584e75bb3b315a8c99c56951e530
Parent:        4de6caf5b5a1b7eef80fc9ed56ac0cf8b7776ac4
Author:        David Teigland <[email protected]>
AuthorDate:    Thu Feb 18 15:38:23 2016 -0600
Committer:     David Teigland <[email protected]>
CommitterDate: Thu Feb 25 09:14:10 2016 -0600

replace pvcreate_params with pvcreate_each_params

"pvcreate_each_params" was a temporary name used to transition from the old "pvcreate_params".

Remove the old pvcreate_params struct and rename the new pvcreate_each_params struct to pvcreate_params. Rename various pvcreate_each_params terms to simply pvcreate_params.

---
 lib/metadata/metadata-exported.h |   14 +--------
 lib/metadata/metadata.c          |   57 ++++++++++++++++++++++---------------
 tools/pvcreate.c                 |   20 ++++++------
 tools/pvremove.c                 |    4 +-
 tools/toollib.c                  |   45 ++++--------------------------
 tools/toollib.h                  |    5 +--
 tools/vgcreate.c                 |    6 ++--
 tools/vgextend.c                 |   12 ++++----
 8 files changed, 64 insertions(+), 99 deletions(-)
lib/metadata/metadata-exported.h +1 -13
index c5dee05..03e8572 100644
@@ -540,18 +540,6 @@ struct pv_create_args {
 };
 
 struct pvcreate_params {
-	int zero;
-	force_t force;
-	unsigned yes;
-	const char *restorefile; /* 0 if no --restorefile option */
-	struct pv_create_args pva;
-};
-
-/*
- * FIXME: rename this pvcreate_params once the old pvcreate_params is unused.
- * This can probably be put in toollib.h.
- */
-struct pvcreate_each_params {
 	/*
 	 * From argc and argv.
 	 */
@@ -747,7 +735,7 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
 	      const char *new_name);
 int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,
 	      struct pvcreate_params *pp);
-int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_each_params *pp);
+int vg_extend_each_pv(struct volume_group *vg, struct pvcreate_params *pp);
 int vg_reduce(struct volume_group *vg, const char *pv_name);
 
 int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
lib/metadata/metadata.c +34 -23

75 lines not on this page · raw message

tools/pvcreate.c +10 -10
index 92356b3..85fed09 100644
@@ -22,8 +22,8 @@
  * Output arguments:
  * pp: structure allocated by caller, fields written / validated here
  */
-static int pvcreate_each_restore_params_from_args(struct cmd_context *cmd, int argc,
-					          struct pvcreate_each_params *pp)
+static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc,
+					     struct pvcreate_params *pp)
 {
 	pp->restorefile = arg_str_value(cmd, restorefile_ARG, NULL);
 
@@ -62,8 +62,8 @@ static int pvcreate_each_restore_params_from_args(struct cmd_context *cmd, int a
 	return 1;
 }
 
-static int pvcreate_each_restore_params_from_backup(struct cmd_context *cmd,
-					            struct pvcreate_each_params *pp)
+static int pvcreate_restore_params_from_backup(struct cmd_context *cmd,
+					       struct pvcreate_params *pp)
 {
 	struct volume_group *vg;
 	struct pv_list *existing_pvl;
@@ -99,7 +99,7 @@ static int pvcreate_each_restore_params_from_backup(struct cmd_context *cmd,
 int pvcreate(struct cmd_context *cmd, int argc, char **argv)
 {
 	struct processing_handle *handle;
-	struct pvcreate_each_params pp;
+	struct pvcreate_params pp;
 	int ret;
 
 	if (!argc) {
@@ -109,7 +109,7 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
 
 	/*
 	 * Device info needs to be available for reading the VG backup file in
-	 * pvcreate_each_restore_params_from_backup.
+	 * pvcreate_restore_params_from_backup.
 	 */
 	lvmcache_seed_infos_from_lvmetad(cmd);
 
@@ -123,15 +123,15 @@ int pvcreate(struct cmd_context *cmd, int argc, char **argv)
 	 * 5. argc/argv free args specifying devices
 	 */
 
-	pvcreate_each_params_set_defaults(&pp);
+	pvcreate_params_set_defaults(&pp);
 
-	if (!pvcreate_each_restore_params_from_args(cmd, argc, &pp))
+	if (!pvcreate_restore_params_from_args(cmd, argc, &pp))
 		return EINVALID_CMD_LINE;
 
-	if (!pvcreate_each_restore_params_from_backup(cmd, &pp))
+	if (!pvcreate_restore_params_from_backup(cmd, &pp))
 		return EINVALID_CMD_LINE;
 
-	if (!pvcreate_each_params_from_args(cmd, &pp))
+	if (!pvcreate_params_from_args(cmd, &pp))
 		return EINVALID_CMD_LINE;
 
 	pp.pv_count = argc;
tools/pvremove.c +2 -2
index 1628ecc..dd9a4e8 100644
@@ -18,7 +18,7 @@
 int pvremove(struct cmd_context *cmd, int argc, char **argv)
 {
 	struct processing_handle *handle;
-	struct pvcreate_each_params pp;
+	struct pvcreate_params pp;
 	int ret;
 
 	if (!argc) {
@@ -26,7 +26,7 @@ int pvremove(struct cmd_context *cmd, int argc, char **argv)
 		return EINVALID_CMD_LINE;
 	}
 
-	pvcreate_each_params_set_defaults(&pp);
+	pvcreate_params_set_defaults(&pp);
 
 	pp.is_remove = 1;
 	pp.force = arg_count(cmd, force_ARG);
tools/toollib.c +6 -39

81 lines not on this page · raw message

tools/toollib.h +2 -3
index c092c74..a67b3e6 100644
@@ -152,9 +152,8 @@ const char *extract_vgname(struct cmd_context *cmd, const char *lv_name);
 const char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name,
 			 unsigned *dev_dir_found);
 
-void pvcreate_each_params_set_defaults(struct pvcreate_each_params *pp);
-int pvcreate_each_params_from_args(struct cmd_context *cmd, struct pvcreate_each_params *pp);
-int pvcreate_each_device(struct cmd_context *cmd, struct processing_handle *handle, struct pvcreate_each_params *pp);
+int pvcreate_params_from_args(struct cmd_context *cmd, struct pvcreate_params *pp);
+int pvcreate_each_device(struct cmd_context *cmd, struct processing_handle *handle, struct pvcreate_params *pp);
 
 /*
  * Builds a list of pv's from the names in argv.  Used in
tools/vgcreate.c +3 -3
index 456e207..3811583 100644
@@ -18,7 +18,7 @@
 int vgcreate(struct cmd_context *cmd, int argc, char **argv)
 {
 	struct processing_handle *handle;
-	struct pvcreate_each_params pp;
+	struct pvcreate_params pp;
 	struct vgcreate_params vp_new;
 	struct vgcreate_params vp_def;
 	struct volume_group *vg;
@@ -38,9 +38,9 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
 	argc--;
 	argv++;
 
-	pvcreate_each_params_set_defaults(&pp);
+	pvcreate_params_set_defaults(&pp);
 
-	if (!pvcreate_each_params_from_args(cmd, &pp))
+	if (!pvcreate_params_from_args(cmd, &pp))
 		return EINVALID_CMD_LINE;
 
 	pp.pv_count = argc;
tools/vgextend.c +6 -6
index 2780755..9cfd3a7 100644
@@ -16,7 +16,7 @@
 #include "tools.h"
 
 struct vgextend_params {
-	struct pvcreate_each_params pp;
+	struct pvcreate_params pp;
 };
 
 static int _restore_pv(struct volume_group *vg, const char *pv_name)
@@ -47,7 +47,7 @@ static int _vgextend_restoremissing(struct cmd_context *cmd __attribute__((unuse
 				    struct processing_handle *handle)
 {
 	struct vgextend_params *vp = (struct vgextend_params *) handle->custom_handle;
-	struct pvcreate_each_params *pp = &vp->pp;
+	struct pvcreate_params *pp = &vp->pp;
 	int fixed = 0;
 	int i;
 
@@ -77,7 +77,7 @@ static int _vgextend_single(struct cmd_context *cmd, const char *vg_name,
 			    struct volume_group *vg, struct processing_handle *handle)
 {
 	struct vgextend_params *vp = (struct vgextend_params *) handle->custom_handle;
-	struct pvcreate_each_params *pp = &vp->pp;
+	struct pvcreate_params *pp = &vp->pp;
 	uint32_t mda_copies;
 	uint32_t mda_used;
 	int ret = ECMD_FAILED;
@@ -125,7 +125,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
 {
 	struct processing_handle *handle;
 	struct vgextend_params vp;
-	struct pvcreate_each_params *pp = &vp.pp;
+	struct pvcreate_params *pp = &vp.pp;
 	unsigned restoremissing = arg_is_set(cmd, restoremissing_ARG);
 	const char *vg_name;
 	int ret;
@@ -146,9 +146,9 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
 	argc--;
 	argv++;
 
-	pvcreate_each_params_set_defaults(pp);
+	pvcreate_params_set_defaults(pp);
 
-	if (!pvcreate_each_params_from_args(cmd, pp))
+	if (!pvcreate_params_from_args(cmd, pp))
 		return EINVALID_CMD_LINE;
 
 	pp->pv_count = argc;