From cbdab48237725af92852f123a98bc296dbc78a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 16 Jan 2017 10:19:16 +0200 Subject: [PATCH] Remove unused functions from config.h The header is divided into two parts, an external and an internal one. The actual splitting is done in a later commit and this commit only prepares the header for the split. --- include/maxscale/config.h | 36 ++++++++++++--------- server/core/config.c | 7 ---- server/core/maxscale/service.h | 2 -- server/modules/monitor/mysqlmon/mysql_mon.c | 2 +- 4 files changed, 22 insertions(+), 25 deletions(-) diff --git a/include/maxscale/config.h b/include/maxscale/config.h index 423ef27e2..8f9447d5e 100644 --- a/include/maxscale/config.h +++ b/include/maxscale/config.h @@ -49,16 +49,7 @@ enum MAX_PARAM_LEN = 256 }; -typedef enum -{ - UNDEFINED_TYPE = 0x00, - STRING_TYPE = 0x01, - COUNT_TYPE = 0x02, - PERCENT_TYPE = 0x04, - BOOL_TYPE = 0x08, - SQLVAR_TARGET_TYPE = 0x10 -} config_param_type_t; - +/** TODO: Remove this from the core and move it inside readwritesplit */ typedef enum { TYPE_UNDEFINED = 0, @@ -322,6 +313,26 @@ struct server* config_get_server(const CONFIG_PARAMETER *params, const char *key */ char* config_copy_string(const CONFIG_PARAMETER *params, const char *key); +/** + * @brief Convert string truth value + * + * Used for truth values with @c 1, @c yes or @c true for a boolean true value and @c 0, @c no + * or @c false for a boolean false value. + * + * @param str String to convert to a truth value + * + * @return 1 if @c value is true, 0 if value is false and -1 if the value is not + * a valid truth value + */ +int config_truth_value(const char *value); + +/** TODO: Add new capability that allows skipping of permission checks */ +bool is_internal_service(const char *router); + +/*************************************************************************************** + * TODO: Move the following functions to a header that's internal to the MaxScale core * + ***************************************************************************************/ + /** * @brief Generate default module parameters * @@ -329,8 +340,6 @@ char* config_copy_string(const CONFIG_PARAMETER *params, const char *key); * * @param ctx Configuration context where the parameters are added * @param params Module parameters - * - * TODO: Move this to a header internal to the MaxScale core */ void config_add_defaults(CONFIG_CONTEXT *ctx, const MXS_MODULE_PARAM *params); @@ -338,15 +347,12 @@ char* config_clean_string_list(const char* str); CONFIG_PARAMETER* config_clone_param(const CONFIG_PARAMETER* param); void config_enable_feedback_task(void); void config_disable_feedback_task(void); -unsigned long config_get_gateway_id(void); GATEWAY_CONF* config_get_global_options(); bool config_load(const char *); unsigned int config_nbpolls(); unsigned int config_pollsleep(); bool config_reload(); int config_threadcount(); -int config_truth_value(const char *); void config_parameter_free(CONFIG_PARAMETER* p1); -bool is_internal_service(const char *router); MXS_END_DECLS diff --git a/server/core/config.c b/server/core/config.c index 2f200556d..4fb9bf07a 100644 --- a/server/core/config.c +++ b/server/core/config.c @@ -1950,13 +1950,6 @@ check_config_objects(CONFIG_CONTEXT *context) return rval; } -/** - * Used for boolean settings where values may be 1, yes or true - * to enable a setting or -, no, false to disable a setting. - * - * @param str String to convert to a boolean - * @return Truth value - */ int config_truth_value(const char *str) { diff --git a/server/core/maxscale/service.h b/server/core/maxscale/service.h index 9b3a4f48c..5a6ef0db9 100644 --- a/server/core/maxscale/service.h +++ b/server/core/maxscale/service.h @@ -118,8 +118,6 @@ void service_update_weights(); void serviceAddRouterOption(SERVICE *service, char *option); void serviceClearRouterOptions(SERVICE *service); void service_update(SERVICE *service, char *router, char *user, char *auth); -bool service_set_param_value(SERVICE* service, CONFIG_PARAMETER* param, char* valstr, - count_spec_t count_spec, config_param_type_t type); /** * @brief Add parameters to a service diff --git a/server/modules/monitor/mysqlmon/mysql_mon.c b/server/modules/monitor/mysqlmon/mysql_mon.c index 603a4f6ff..d7e1b4b98 100644 --- a/server/modules/monitor/mysqlmon/mysql_mon.c +++ b/server/modules/monitor/mysqlmon/mysql_mon.c @@ -264,7 +264,7 @@ startMonitor(MONITOR *monitor, const CONFIG_PARAMETER* params) hashtable_item_free, info_free_func); handle->server_info = server_info; handle->shutdown = 0; - handle->id = config_get_gateway_id(); + handle->id = config_get_global_options()->id; handle->warn_failover = true; spinlock_init(&handle->lock); }