mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Remove no-longer-used arg_ptr_value.
Fix -M and --type to use strings not pointers that change on config refresh.
This commit is contained in:
parent
6c6ce2ba0e
commit
54d7741a3e
@ -1,5 +1,8 @@
|
|||||||
Version 2.02.64 -
|
Version 2.02.64 -
|
||||||
=================================
|
=================================
|
||||||
|
Remove no-longer-used arg_ptr_value.
|
||||||
|
Fix -M and --type to use strings not pointers that change on config refresh.
|
||||||
|
Fix regression in down-convert of mirror images with partial PV specification.
|
||||||
Fix lvconvert error message when existing mirrored LV is not found.
|
Fix lvconvert error message when existing mirrored LV is not found.
|
||||||
Disallow the direct removal of a merging snapshot.
|
Disallow the direct removal of a merging snapshot.
|
||||||
Set appropriate udev flags for reserved LVs.
|
Set appropriate udev flags for reserved LVs.
|
||||||
|
@ -733,6 +733,19 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct format_type *get_format_by_name(struct cmd_context *cmd, const char *format)
|
||||||
|
{
|
||||||
|
struct format_type *fmt;
|
||||||
|
|
||||||
|
dm_list_iterate_items(fmt, &cmd->formats)
|
||||||
|
if (!strcasecmp(fmt->name, format) ||
|
||||||
|
!strcasecmp(fmt->name + 3, format) ||
|
||||||
|
(fmt->alias && !strcasecmp(fmt->alias, format)))
|
||||||
|
return fmt;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static int _init_formats(struct cmd_context *cmd)
|
static int _init_formats(struct cmd_context *cmd)
|
||||||
{
|
{
|
||||||
const char *format;
|
const char *format;
|
||||||
@ -806,8 +819,8 @@ static int _init_formats(struct cmd_context *cmd)
|
|||||||
dm_list_iterate_items(fmt, &cmd->formats) {
|
dm_list_iterate_items(fmt, &cmd->formats) {
|
||||||
if (!strcasecmp(fmt->name, format) ||
|
if (!strcasecmp(fmt->name, format) ||
|
||||||
(fmt->alias && !strcasecmp(fmt->alias, format))) {
|
(fmt->alias && !strcasecmp(fmt->alias, format))) {
|
||||||
cmd->default_settings.fmt = fmt;
|
cmd->default_settings.fmt_name = fmt->name;
|
||||||
cmd->fmt = cmd->default_settings.fmt;
|
cmd->fmt = fmt;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1190,7 +1203,7 @@ out:
|
|||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _destroy_formats(struct dm_list *formats)
|
static void _destroy_formats(struct cmd_context *cmd, struct dm_list *formats)
|
||||||
{
|
{
|
||||||
struct dm_list *fmtl, *tmp;
|
struct dm_list *fmtl, *tmp;
|
||||||
struct format_type *fmt;
|
struct format_type *fmt;
|
||||||
@ -1268,7 +1281,7 @@ int refresh_toolcontext(struct cmd_context *cmd)
|
|||||||
lvmcache_destroy(cmd, 0);
|
lvmcache_destroy(cmd, 0);
|
||||||
label_exit();
|
label_exit();
|
||||||
_destroy_segtypes(&cmd->segtypes);
|
_destroy_segtypes(&cmd->segtypes);
|
||||||
_destroy_formats(&cmd->formats);
|
_destroy_formats(cmd, &cmd->formats);
|
||||||
if (cmd->filter) {
|
if (cmd->filter) {
|
||||||
cmd->filter->destroy(cmd->filter);
|
cmd->filter->destroy(cmd->filter);
|
||||||
cmd->filter = NULL;
|
cmd->filter = NULL;
|
||||||
@ -1329,7 +1342,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
|
|||||||
lvmcache_destroy(cmd, 0);
|
lvmcache_destroy(cmd, 0);
|
||||||
label_exit();
|
label_exit();
|
||||||
_destroy_segtypes(&cmd->segtypes);
|
_destroy_segtypes(&cmd->segtypes);
|
||||||
_destroy_formats(&cmd->formats);
|
_destroy_formats(cmd, &cmd->formats);
|
||||||
if (cmd->filter)
|
if (cmd->filter)
|
||||||
cmd->filter->destroy(cmd->filter);
|
cmd->filter->destroy(cmd->filter);
|
||||||
if (cmd->mem)
|
if (cmd->mem)
|
||||||
|
@ -38,7 +38,7 @@ struct config_info {
|
|||||||
int udev_sync;
|
int udev_sync;
|
||||||
int cache_vgmetadata;
|
int cache_vgmetadata;
|
||||||
const char *msg_prefix;
|
const char *msg_prefix;
|
||||||
struct format_type *fmt;
|
const char *fmt_name;
|
||||||
uint64_t unit_factor;
|
uint64_t unit_factor;
|
||||||
int cmd_name; /* Show command name? */
|
int cmd_name; /* Show command name? */
|
||||||
mode_t umask;
|
mode_t umask;
|
||||||
@ -110,4 +110,6 @@ int refresh_filters(struct cmd_context *cmd);
|
|||||||
int config_files_changed(struct cmd_context *cmd);
|
int config_files_changed(struct cmd_context *cmd);
|
||||||
int init_lvmcache_orphans(struct cmd_context *cmd);
|
int init_lvmcache_orphans(struct cmd_context *cmd);
|
||||||
|
|
||||||
|
struct format_type *get_format_by_name(struct cmd_context *cmd, const char *format);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -330,9 +330,7 @@ static int _lvcreate_params(struct lvcreate_params *lp,
|
|||||||
/*
|
/*
|
||||||
* Check selected options are compatible and determine segtype
|
* Check selected options are compatible and determine segtype
|
||||||
*/
|
*/
|
||||||
lp->segtype = (const struct segment_type *)
|
lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, "striped"));
|
||||||
arg_ptr_value(cmd, type_ARG,
|
|
||||||
get_segtype_from_string(cmd, "striped"));
|
|
||||||
|
|
||||||
if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp) ||
|
if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp) ||
|
||||||
arg_count(cmd, virtualsize_ARG))
|
arg_count(cmd, virtualsize_ARG))
|
||||||
|
@ -51,7 +51,7 @@ extern char *optarg;
|
|||||||
* Table of valid switches
|
* Table of valid switches
|
||||||
*/
|
*/
|
||||||
static struct arg _the_args[ARG_COUNT + 1] = {
|
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"
|
#include "args.h"
|
||||||
#undef arg
|
#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;
|
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)
|
const void *arg_ptr_value(struct cmd_context *cmd, int a, const void *def)
|
||||||
{
|
{
|
||||||
return arg_count(cmd, a) ? _the_args[a].ptr : 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)
|
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)
|
int metadatatype_arg(struct cmd_context *cmd, struct arg *a)
|
||||||
{
|
{
|
||||||
struct format_type *fmt;
|
return get_format_by_name(cmd, a->value) ? 1 : 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _get_int_arg(struct arg *a, char **ptr)
|
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)
|
int segtype_arg(struct cmd_context *cmd, struct arg *a)
|
||||||
{
|
{
|
||||||
if (!(a->ptr = (void *) get_segtype_from_string(cmd, a->value)))
|
return get_segtype_from_string(cmd, a->value) ? 1 : 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -912,8 +897,9 @@ static void _apply_settings(struct cmd_context *cmd)
|
|||||||
|
|
||||||
set_activation(cmd->current_settings.activation);
|
set_activation(cmd->current_settings.activation);
|
||||||
|
|
||||||
cmd->fmt = arg_ptr_value(cmd, metadatatype_ARG,
|
cmd->fmt = get_format_by_name(cmd, arg_str_value(cmd, metadatatype_ARG,
|
||||||
cmd->current_settings.fmt);
|
cmd->current_settings.fmt_name));
|
||||||
|
|
||||||
cmd->handles_missing_pvs = 0;
|
cmd->handles_missing_pvs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,8 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Support LVs with mixed segment types */
|
/* 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);
|
log_error("VolumeType does not match (%s)", lp->segtype->name);
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ struct arg {
|
|||||||
uint64_t ui64_value;
|
uint64_t ui64_value;
|
||||||
sign_t sign;
|
sign_t sign;
|
||||||
percent_t percent;
|
percent_t percent;
|
||||||
void *ptr;
|
/* void *ptr; // Currently not used. */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CACHE_VGMETADATA 0x00000001
|
#define CACHE_VGMETADATA 0x00000001
|
||||||
|
Loading…
Reference in New Issue
Block a user