From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heming Zhao Date: Sun, 19 Sep 2021 14:43:19 +0800 Subject: [Cluster-devel] [PATCH 07/10] dlm_controld: make few APIs public In-Reply-To: <20210919064322.1670-1-heming.zhao@suse.com> References: <20210919064322.1670-1-heming.zhao@suse.com> Message-ID: <20210919064322.1670-8-heming.zhao@suse.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This commit makes possible for helper process accessing config info Signed-off-by: Heming Zhao --- dlm_controld/action.c | 5 +++++ dlm_controld/dlm_daemon.h | 3 +++ dlm_controld/logging.c | 18 +++++++++++++----- dlm_controld/main.c | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/dlm_controld/action.c b/dlm_controld/action.c index 0eff27997e1c..baddaf81cb4f 100644 --- a/dlm_controld/action.c +++ b/dlm_controld/action.c @@ -766,6 +766,11 @@ static int set_configfs_cluster(const char *name, char *str, int num) return 0; } +int set_configfs_opt(const char *name, char *str, int num) +{ + return set_configfs_cluster(name, str, num); +} + #define NET_RMEM_DEFAULT 4194304 #define NET_RMEM_MAX 4194304 diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h index e20e98e78707..904bb0b50df9 100644 --- a/dlm_controld/dlm_daemon.h +++ b/dlm_controld/dlm_daemon.h @@ -392,6 +392,7 @@ int setup_configfs_members(void); int check_uncontrolled_lockspaces(void); int setup_misc_devices(void); int path_exists(const char *path); +int set_configfs_opt(const char *name, char *str, int num); /* config.c */ void set_opt_file(int update); @@ -480,6 +481,7 @@ struct lockspace *find_ls_id(uint32_t id); const char *dlm_mode_str(int mode); void cluster_dead(int ci); struct dlm_option *get_dlm_option(char *name); +int get_ind_name(char *s); struct run *find_run(char *uuid_str); void clear_run(struct run *run); void send_helper_run_request(struct run_request *req); @@ -531,6 +533,7 @@ void init_logging(void); void close_logging(void); void copy_log_dump(char *buf, int *len); void copy_log_dump_plock(char *buf, int *len); +void set_logfile_priority(void); /* crc.c */ uint32_t cpgname_to_crc(const char *data, int len); diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c index d48b8aebc237..2c57138ce766 100644 --- a/dlm_controld/logging.c +++ b/dlm_controld/logging.c @@ -14,6 +14,18 @@ static int logfile_priority; static char logfile[PATH_MAX]; static FILE *logfile_fp; +/* logfile_priority is the only one of these options that + can be controlled from command line, environment variable + and dynamic setting. + */ +void set_logfile_priority(void) +{ + if (opt(debug_logfile_ind)) + logfile_priority = LOG_DEBUG; + else + logfile_priority = DEFAULT_LOGFILE_PRIORITY; +} + void init_logging(void) { mode_t old_umask; @@ -24,11 +36,7 @@ void init_logging(void) logfile_priority = DEFAULT_LOGFILE_PRIORITY; strcpy(logfile, DEFAULT_LOGFILE); - /* logfile_priority is the only one of these options that - can be controlled from command line or environment variable */ - - if (opt(debug_logfile_ind)) - logfile_priority = LOG_DEBUG; + set_logfile_priority(); if (logfile[0]) { old_umask = umask(0077); diff --git a/dlm_controld/main.c b/dlm_controld/main.c index 2a4f33b1b455..91187f2d2402 100644 --- a/dlm_controld/main.c +++ b/dlm_controld/main.c @@ -1902,7 +1902,7 @@ static void set_opt_defaults(void) "Print program version information, then exit"); } -static int get_ind_name(char *s) +int get_ind_name(char *s) { char name[PATH_MAX]; char *p = s; -- 2.32.0