summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2010-04-29 01:38:12 +0000
committerAlasdair Kergon <agk@redhat.com>2010-04-29 01:38:12 +0000
commit54d7741a3e3b211547aa76cdfcb1426560effc92 (patch)
tree9fd098c80880dcdf237c1a335b499eff38247607 /tools
parent6c6ce2ba0e16f5d0a9056720fbc83935b6ecfd4e (diff)
downloadlvm2-54d7741a3e3b211547aa76cdfcb1426560effc92.tar.gz
lvm2-54d7741a3e3b211547aa76cdfcb1426560effc92.tar.xz
lvm2-54d7741a3e3b211547aa76cdfcb1426560effc92.zip
Remove no-longer-used arg_ptr_value.
Fix -M and --type to use strings not pointers that change on config refresh.
Diffstat (limited to 'tools')
-rw-r--r--tools/lvcreate.c4
-rw-r--r--tools/lvmcmdline.c30
-rw-r--r--tools/lvresize.c3
-rw-r--r--tools/tools.h2
4 files changed, 12 insertions, 27 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 89687187..9da606e1 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -330,9 +330,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
/*
* Check selected options are compatible and determine segtype
*/
- lp->segtype = (const struct segment_type *)
- arg_ptr_value(cmd, type_ARG,
- get_segtype_from_string(cmd, "striped"));
+ lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, "striped"));
if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp) ||
arg_count(cmd, virtualsize_ARG))
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index d9ea0c73..48635567 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -51,7 +51,7 @@ extern char *optarg;
* Table of valid switches
*/
static struct arg _the_args[ARG_COUNT + 1] = {
-#define arg(a, b, c, d, e) {b, "", "--" c, d, e, 0, NULL, 0, 0, INT64_C(0), UINT64_C(0), SIGN_NONE, PERCENT_NONE, NULL},
+#define arg(a, b, c, d, e) {b, "", "--" c, d, e, 0, NULL, 0, 0, INT64_C(0), UINT64_C(0), SIGN_NONE, PERCENT_NONE},
#include "args.h"
#undef arg
};
@@ -100,10 +100,12 @@ uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def)
return arg_count(cmd, a) ? _the_args[a].ui64_value : def;
}
+/* No longer used.
const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def)
{
return arg_count(cmd, a) ? _the_args[a].ptr : def;
}
+*/
sign_t arg_sign_value(struct cmd_context *cmd, int a, const sign_t def)
{
@@ -182,21 +184,7 @@ int yes_no_excl_arg(struct cmd_context *cmd __attribute((unused)),
int metadatatype_arg(struct cmd_context *cmd, struct arg *a)
{
- struct format_type *fmt;
- char *format;
-
- format = a->value;
-
- dm_list_iterate_items(fmt, &cmd->formats) {
- if (!strcasecmp(fmt->name, format) ||
- !strcasecmp(fmt->name + 3, format) ||
- (fmt->alias && !strcasecmp(fmt->alias, format))) {
- a->ptr = fmt;
- return 1;
- }
- }
-
- return 0;
+ return get_format_by_name(cmd, a->value) ? 1 : 0;
}
static int _get_int_arg(struct arg *a, char **ptr)
@@ -458,10 +446,7 @@ int alloc_arg(struct cmd_context *cmd __attribute((unused)), struct arg *a)
int segtype_arg(struct cmd_context *cmd, struct arg *a)
{
- if (!(a->ptr = (void *) get_segtype_from_string(cmd, a->value)))
- return 0;
-
- return 1;
+ return get_segtype_from_string(cmd, a->value) ? 1 : 0;
}
/*
@@ -912,8 +897,9 @@ static void _apply_settings(struct cmd_context *cmd)
set_activation(cmd->current_settings.activation);
- cmd->fmt = arg_ptr_value(cmd, metadatatype_ARG,
- cmd->current_settings.fmt);
+ cmd->fmt = get_format_by_name(cmd, arg_str_value(cmd, metadatatype_ARG,
+ cmd->current_settings.fmt_name));
+
cmd->handles_missing_pvs = 0;
}
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 030227e4..1fa5aa82 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -420,7 +420,8 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
}
/* FIXME Support LVs with mixed segment types */
- if (lp->segtype != arg_ptr_value(cmd, type_ARG, lp->segtype)) {
+ if (lp->segtype != get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG,
+ lp->segtype->name))) {
log_error("VolumeType does not match (%s)", lp->segtype->name);
return EINVALID_CMD_LINE;
}
diff --git a/tools/tools.h b/tools/tools.h
index 75575e7b..f379b03d 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -114,7 +114,7 @@ struct arg {
uint64_t ui64_value;
sign_t sign;
percent_t percent;
- void *ptr;
+/* void *ptr; // Currently not used. */
};
#define CACHE_VGMETADATA 0x00000001