Skip to contentSkip to conversation

master - toolib: early validation of chunk size

PATCH Zdenek Kabelac 1 participant 1 message Oct 6, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a0693da97f6873b08d33f8c44baacde77e28e33a
Commit:        a0693da97f6873b08d33f8c44baacde77e28e33a
Parent:        59ced3c28186e6d45e2e8374b04e32256f636a82
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sat Oct 4 22:36:41 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Oct 6 15:23:07 2014 +0200

toolib: early validation of chunk size

Since we now have validate_pool_chunk_size() we could validate entered values directly prior openning vg.

---
 tools/toollib.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
tools/toollib.c +4 -0
index 69c1c39..ddd669a 100644
@@ -1257,6 +1257,10 @@ int get_pool_params(struct cmd_context *cmd,
 
 		*passed_args |= PASS_ARG_CHUNK_SIZE;
 		*chunk_size = arg_uint_value(cmd, chunksize_ARG, 0);
+
+		if (!validate_pool_chunk_size(cmd, segtype, *chunk_size))
+			return_0;
+
 		log_very_verbose("Setting pool chunk size: %s",
 				 display_size(cmd, *chunk_size));
 	}