From 061fa7b690af6ef1bcf989ae8fefcb62b71689c4 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Tue, 30 Apr 2024 13:43:32 +0200 Subject: [PATCH] cleanup: remove unused code --- lib/commands/toolcontext.c | 56 -------------------------------------- lib/commands/toolcontext.h | 1 - 2 files changed, 57 deletions(-) diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 484720b87..f2f451b3e 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -1616,62 +1616,6 @@ void destroy_config_context(struct cmd_context *cmd) free(cmd); } -/* - * A "config context" is a very light weight toolcontext that - * is only used for reading config settings from lvm.conf. - * - * FIXME: this needs to go back to parametrized create_toolcontext() - */ -struct cmd_context *create_config_context(void) -{ - struct cmd_context *cmd; - - if (!(cmd = zalloc(sizeof(*cmd)))) - goto_out; - - strncpy(cmd->system_dir, DEFAULT_SYS_DIR, sizeof(cmd->system_dir) - 1); - - if (!_get_env_vars(cmd)) - goto_out; - - if (!(cmd->libmem = dm_pool_create("library", 4 * 1024))) - goto_out; - - if (!(cmd->mem = dm_pool_create("command", 4 * 1024))) - goto out; - - if (!(cmd->pending_delete_mem = dm_pool_create("pending_delete", 1024))) - goto_out; - - dm_list_init(&cmd->config_files); - dm_list_init(&cmd->tags); - - if (!_init_lvm_conf(cmd)) - goto_out; - - if (!_init_hostname(cmd)) - goto_out; - - if (!_init_tags(cmd, cmd->cft)) - goto_out; - - /* Load lvmlocal.conf */ - if (*cmd->system_dir && !_load_config_file(cmd, "", 1)) - goto_out; - - if (!_init_tag_configs(cmd)) - goto_out; - - if (!(cmd->cft = _merge_config_files(cmd, cmd->cft))) - goto_out; - - return cmd; -out: - if (cmd) - destroy_config_context(cmd); - return NULL; -} - /* Entry point */ struct cmd_context *create_toolcontext(unsigned is_clvmd, const char *system_dir, diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 3c2b9eaab..fec0a52cf 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -313,7 +313,6 @@ int init_run_by_dmeventd(struct cmd_context *cmd); * is only used for reading config settings from lvm.conf, * which are at cmd->cft. */ -struct cmd_context *create_config_context(void); void destroy_config_context(struct cmd_context *cmd); struct format_type *get_format_by_name(struct cmd_context *cmd, const char *format);