diff options
author | Mike Snitzer <snitzer@redhat.com> | 2011-08-02 12:32:04 +0100 |
---|---|---|
committer | Andreas Blaesius <skate4life@gmx.de> | 2016-06-05 21:26:30 +0200 |
commit | 1d8b470d243d2d304fd6db12c2f2e9781639a446 (patch) | |
tree | d064285d369243d8d1ec5f4ebf51385f87a66a25 /include/linux/device-mapper.h | |
parent | 6614b9aa6436d24ebdff232bf2e890d0437ea87b (diff) | |
download | kernel_samsung_espresso10-1d8b470d243d2d304fd6db12c2f2e9781639a446.zip kernel_samsung_espresso10-1d8b470d243d2d304fd6db12c2f2e9781639a446.tar.gz kernel_samsung_espresso10-1d8b470d243d2d304fd6db12c2f2e9781639a446.tar.bz2 |
dm table: share target argument parsing functions
Move multipath target argument parsing code into dm-table so other
targets can share it.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
(cherry picked from commit 498f0103ea13123e007660def9072a0b7dd1c599:
required by commit 772ae5f54d69c38a5e3c4352c5fdbdaff141af21)
Change-Id: Icc1f37e74a065e39d19ac11c95e3da8dbe0f51c7
Diffstat (limited to 'include/linux/device-mapper.h')
-rw-r--r-- | include/linux/device-mapper.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 4427e04..3fa1f3d 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h @@ -208,6 +208,49 @@ struct dm_target_callbacks { int dm_register_target(struct target_type *t); void dm_unregister_target(struct target_type *t); +/* + * Target argument parsing. + */ +struct dm_arg_set { + unsigned argc; + char **argv; +}; + +/* + * The minimum and maximum value of a numeric argument, together with + * the error message to use if the number is found to be outside that range. + */ +struct dm_arg { + unsigned min; + unsigned max; + char *error; +}; + +/* + * Validate the next argument, either returning it as *value or, if invalid, + * returning -EINVAL and setting *error. + */ +int dm_read_arg(struct dm_arg *arg, struct dm_arg_set *arg_set, + unsigned *value, char **error); + +/* + * Process the next argument as the start of a group containing between + * arg->min and arg->max further arguments. Either return the size as + * *num_args or, if invalid, return -EINVAL and set *error. + */ +int dm_read_arg_group(struct dm_arg *arg, struct dm_arg_set *arg_set, + unsigned *num_args, char **error); + +/* + * Return the current argument and shift to the next. + */ +const char *dm_shift_arg(struct dm_arg_set *as); + +/* + * Move through num_args arguments. + */ +void dm_consume_args(struct dm_arg_set *as, unsigned num_args); + /*----------------------------------------------------------------- * Functions for creating and manipulating mapped devices. * Drop the reference with dm_put when you finish with the object. |