mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Rename _override_settings into override_config_tree_from_string and move.
Move _override_settings from tools/lvmcmdline.c into lib/config/config.c and export so we can re-use in liblvm.
This commit is contained in:
parent
776ac1562e
commit
9085c301e0
@ -186,6 +186,17 @@ struct config_tree *create_config_tree_from_string(struct cmd_context *cmd __att
|
|||||||
return cft;
|
return cft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int override_config_tree_from_string(struct cmd_context *cmd,
|
||||||
|
const char *config_settings)
|
||||||
|
{
|
||||||
|
if (!(cmd->cft_override = create_config_tree_from_string(cmd,config_settings))) {
|
||||||
|
log_error("Failed to set overridden configuration entries.");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int read_config_fd(struct config_tree *cft, struct device *dev,
|
int read_config_fd(struct config_tree *cft, struct device *dev,
|
||||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||||
checksum_fn_t checksum_fn, uint32_t checksum)
|
checksum_fn_t checksum_fn, uint32_t checksum)
|
||||||
|
@ -56,6 +56,8 @@ struct config_tree_list {
|
|||||||
struct config_tree *create_config_tree(const char *filename, int keep_open);
|
struct config_tree *create_config_tree(const char *filename, int keep_open);
|
||||||
struct config_tree *create_config_tree_from_string(struct cmd_context *cmd,
|
struct config_tree *create_config_tree_from_string(struct cmd_context *cmd,
|
||||||
const char *config_settings);
|
const char *config_settings);
|
||||||
|
int override_config_tree_from_string(struct cmd_context *cmd,
|
||||||
|
const char *config_settings);
|
||||||
void destroy_config_tree(struct config_tree *cft);
|
void destroy_config_tree(struct config_tree *cft);
|
||||||
|
|
||||||
typedef uint32_t (*checksum_fn_t) (uint32_t initial, const void *buf, uint32_t size);
|
typedef uint32_t (*checksum_fn_t) (uint32_t initial, const void *buf, uint32_t size);
|
||||||
|
@ -887,16 +887,6 @@ int help(struct cmd_context *cmd __attribute((unused)), int argc, char **argv)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _override_settings(struct cmd_context *cmd, const char *config_settings)
|
|
||||||
{
|
|
||||||
if (!(cmd->cft_override = create_config_tree_from_string(cmd, config_settings))) {
|
|
||||||
log_error("Failed to set overridden configuration entries.");
|
|
||||||
return EINVALID_CMD_LINE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _apply_settings(struct cmd_context *cmd)
|
static void _apply_settings(struct cmd_context *cmd)
|
||||||
{
|
{
|
||||||
init_debug(cmd->current_settings.debug);
|
init_debug(cmd->current_settings.debug);
|
||||||
@ -986,9 +976,11 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
set_cmd_name(cmd->command->name);
|
set_cmd_name(cmd->command->name);
|
||||||
|
|
||||||
if (arg_count(cmd, config_ARG))
|
if (arg_count(cmd, config_ARG))
|
||||||
if ((ret = _override_settings(cmd,
|
if ((ret = override_config_tree_from_string(cmd,
|
||||||
arg_str_value(cmd, config_ARG, ""))))
|
arg_str_value(cmd, config_ARG, "")))) {
|
||||||
|
ret = EINVALID_CMD_LINE;
|
||||||
goto_out;
|
goto_out;
|
||||||
|
}
|
||||||
|
|
||||||
if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) {
|
if (arg_count(cmd, config_ARG) || !cmd->config_valid || config_files_changed(cmd)) {
|
||||||
/* Reinitialise various settings inc. logging, filters */
|
/* Reinitialise various settings inc. logging, filters */
|
||||||
|
Loading…
Reference in New Issue
Block a user