summaryrefslogtreecommitdiffstats
path: root/tools/pvcreate.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2008-07-23 19:29:58 +0000
committerDave Wysochanski <dwysocha@redhat.com>2008-07-23 19:29:58 +0000
commit61bc35aa12973028d6044f1ca23a690276611abc (patch)
treea044fa49166683775c6a5aab2771a531ac68ead7 /tools/pvcreate.c
parent7d400bc7875db246c5e5b0ee3d117c9c3de5b735 (diff)
downloadlvm2-61bc35aa12973028d6044f1ca23a690276611abc.tar.gz
lvm2-61bc35aa12973028d6044f1ca23a690276611abc.tar.xz
lvm2-61bc35aa12973028d6044f1ca23a690276611abc.zip
Refactor pvcreate - move labelsector parameter parsing & validation.
Diffstat (limited to 'tools/pvcreate.c')
-rw-r--r--tools/pvcreate.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/pvcreate.c b/tools/pvcreate.c
index 8329a2c8..817a1a72 100644
--- a/tools/pvcreate.c
+++ b/tools/pvcreate.c
@@ -21,6 +21,7 @@ struct pvcreate_params {
uint64_t size;
int pvmetadatacopies;
uint64_t pvmetadatasize;
+ int64_t labelsector;
};
const char _really_init[] =
@@ -237,8 +238,7 @@ static int pvcreate_single(struct cmd_context *cmd, const char *pv_name,
log_very_verbose("Writing physical volume data to disk \"%s\"",
pv_name);
if (!(pv_write(cmd, (struct physical_volume *)pv, &mdas,
- arg_int64_value(cmd, labelsector_ARG,
- DEFAULT_LABELSECTOR)))) {
+ pp->labelsector))) {
log_error("Failed to write physical volume \"%s\"", pv_name);
goto error;
}
@@ -290,6 +290,9 @@ static int pvcreate_validate_params(struct cmd_context *cmd,
log_error("labelsector must be less than %lu",
LABEL_SCAN_SECTORS);
return 0;
+ } else {
+ pp->labelsector = arg_int64_value(cmd, labelsector_ARG,
+ DEFAULT_LABELSECTOR);
}
if (!(cmd->fmt->features & FMT_MDAS) &&