From: Heming Zhao <heming.zhao@suse.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 07/10] dlm_controld: make few APIs public
Date: Sun, 19 Sep 2021 14:43:19 +0800 [thread overview]
Message-ID: <20210919064322.1670-8-heming.zhao@suse.com> (raw)
In-Reply-To: <20210919064322.1670-1-heming.zhao@suse.com>
This commit makes possible for helper process accessing config info
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
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
next prev parent reply other threads:[~2021-09-19 6:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-19 6:43 [Cluster-devel] [RFC PATCH dlm 00/10] dlm_controld config settings can be Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 01/10] dlm_tool man: add command "joinleave", add "USAGE" section Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 02/10] dlm_tool: add run_(check|cancel) all feature Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 03/10] dlm_tool man: add dynamic setting and examples Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 04/10] dlm_controld: put MAX_LINE in header file Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 05/10] dlm_controld: add dynamic setting items in "struct dlm_option" Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 06/10] dlm_controld: change dlm_options[] to shared memory type Heming Zhao
2021-09-19 6:43 ` Heming Zhao [this message]
2021-09-19 6:43 ` [Cluster-devel] [PATCH 08/10] dlm_controld: support "dlm_tool dump_config" to show dynamic setting Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 09/10] dlm_controld: add new API set_opt_online() Heming Zhao
2021-09-19 6:43 ` [Cluster-devel] [PATCH 10/10] dlm_controld: enable "dlm_tool run|run_start" dynamic setting feature Heming Zhao
2021-09-20 17:57 ` [Cluster-devel] [RFC PATCH dlm 00/10] dlm_controld config settings can be David Teigland
2021-09-21 6:38 ` heming.zhao
2021-09-21 13:54 ` David Teigland
2021-09-22 9:32 ` heming.zhao
2021-09-22 13:46 ` David Teigland
2021-09-22 14:35 ` heming.zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210919064322.1670-8-heming.zhao@suse.com \
--to=heming.zhao@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).