From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm-tool 07/14] dlm_controld: add gcc format printf attribute to log_level
Date: Thu, 2 Mar 2023 12:14:34 -0500 [thread overview]
Message-ID: <20230302171441.1509914-7-aahringo@redhat.com> (raw)
In-Reply-To: <20230302171441.1509914-1-aahringo@redhat.com>
This patch will add __attribute__ (( format( printf, 3, 4 ) ) to
log_level() functionality which has a format string as parameter. With
this change we enable compiler warnings if format string and applied
parameters do not match. We had some couple of warnings which this patch
fixes as well.
---
dlm_controld/daemon_cpg.c | 2 +-
dlm_controld/dlm_daemon.h | 1 +
dlm_controld/plock.c | 3 ++-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index e6a03a28..2e0634d4 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -2080,7 +2080,7 @@ int receive_run_reply(struct dlm_header *hd, int len)
return 0;
if (len != sizeof(struct run_reply)) {
- log_debug("receive_run_reply %s bad len %s expect %d",
+ log_debug("receive_run_reply %s bad len %d expect %zu",
rep->uuid, len, sizeof(struct run_reply));
run->info.reply_count++;
run->info.need_replies--;
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index c74f684a..2c53e22b 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -220,6 +220,7 @@ EXTERN struct list_head run_ops;
#define LOG_PLOCK 0x00010000
#define LOG_NONE 0x00001111
+__attribute__ (( format( printf, 3, 4 ) ))
void log_level(char *name_in, uint32_t level_in, const char *fmt, ...);
#define log_error(fmt, args...) log_level(NULL, LOG_ERR, fmt, ##args)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 8b052a94..2f0392c3 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -1925,7 +1925,8 @@ void receive_plocks_data(struct lockspace *ls, struct dlm_header *hd, int len)
/* no locks should be included for owned resources */
if (owner && count) {
- log_elock(ls, "recv_plocks_data %d:%u n %llu o %d bad count %u",
+ log_elock(ls, "recv_plocks_data %d:%u n %llu o %d bad count %" PRIu32,
+ hd->nodeid, hd->msgdata,
(unsigned long long)num, owner, count);
goto fail_free;
}
--
2.31.1
next prev parent reply other threads:[~2023-03-02 17:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 17:14 [Cluster-devel] [PATCH dlm-tool 01/14] dlm_tool: add fail functionality if dump failed Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 02/14] dlm_controld: always create logdir Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 03/14] dlm_controld: add plock logfile Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 04/14] dlm_controld: move processing of saved messages to plock level Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 05/14] dlm_controld: remove ls parameter Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 06/14] dlm_controld: constify timeval of dt_usec() Alexander Aring
2023-03-02 17:14 ` Alexander Aring [this message]
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 08/14] dlm_controld: enable nanosec logging Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 09/14] dlm_controld: use write_result() Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 10/14] dlm_controld: be sure we stop lockspaces before shutdown Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 11/14] dlm_controld: constify name_in in log_level() Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 12/14] dlm_controld: plock log waiters state Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 13/14] dlm_controld: plock log lock state Alexander Aring
2023-03-03 13:38 ` Andreas Gruenbacher
2023-03-03 14:35 ` Alexander Aring
2023-03-03 15:52 ` Andreas Gruenbacher
2023-03-03 16:02 ` Andreas Gruenbacher
2023-03-03 22:20 ` Alexander Aring
2023-03-03 22:28 ` Alexander Aring
2023-03-03 22:43 ` Alexander Aring
2023-03-03 22:31 ` Alexander Aring
2023-03-02 17:14 ` [Cluster-devel] [PATCH dlm-tool 14/14] python: add posix lockdb plot tool Alexander Aring
2023-03-03 14:40 ` Alexander Aring
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=20230302171441.1509914-7-aahringo@redhat.com \
--to=aahringo@redhat.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).