aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2011-08-02 07:32:04 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-08-02 07:32:04 -0400
commit498f0103ea13123e007660def9072a0b7dd1c599 (patch)
tree3940ca8e50f13c3ed3a79c1939bacbc841ecb179 /include/linux
parenta6e50b409d3f9e0833e69c3c9cca822e8fa4adbb (diff)
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>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/device-mapper.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 4427e0454051..3fa1f3d90ce0 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -208,6 +208,49 @@ struct dm_target_callbacks {
208int dm_register_target(struct target_type *t); 208int dm_register_target(struct target_type *t);
209void dm_unregister_target(struct target_type *t); 209void dm_unregister_target(struct target_type *t);
210 210
211/*
212 * Target argument parsing.
213 */
214struct dm_arg_set {
215 unsigned argc;
216 char **argv;
217};
218
219/*
220 * The minimum and maximum value of a numeric argument, together with
221 * the error message to use if the number is found to be outside that range.
222 */
223struct dm_arg {
224 unsigned min;
225 unsigned max;
226 char *error;
227};
228
229/*
230 * Validate the next argument, either returning it as *value or, if invalid,
231 * returning -EINVAL and setting *error.
232 */
233int dm_read_arg(struct dm_arg *arg, struct dm_arg_set *arg_set,
234 unsigned *value, char **error);
235
236/*
237 * Process the next argument as the start of a group containing between
238 * arg->min and arg->max further arguments. Either return the size as
239 * *num_args or, if invalid, return -EINVAL and set *error.
240 */
241int dm_read_arg_group(struct dm_arg *arg, struct dm_arg_set *arg_set,
242 unsigned *num_args, char **error);
243
244/*
245 * Return the current argument and shift to the next.
246 */
247const char *dm_shift_arg(struct dm_arg_set *as);
248
249/*
250 * Move through num_args arguments.
251 */
252void dm_consume_args(struct dm_arg_set *as, unsigned num_args);
253
211/*----------------------------------------------------------------- 254/*-----------------------------------------------------------------
212 * Functions for creating and manipulating mapped devices. 255 * Functions for creating and manipulating mapped devices.
213 * Drop the reference with dm_put when you finish with the object. 256 * Drop the reference with dm_put when you finish with the object.