diff mbox series

[32/40] lustre: ptlrpc: fix clang build errors

Message ID 1681042400-15491-33-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: backport OpenSFS changes from March XX, 2023 | expand

Commit Message

James Simmons April 9, 2023, 12:13 p.m. UTC
From: Timothy Day <timday@amazon.com>

Fixed bugs which cause errors on Clang.

The majority of changes involve adding
defines for the 'ptlrpc_nrs_ctl' enum.
This avoids having to explicitly cast
enums from one type to another.

A 'strlcpy' in 'sptlrpc_process_config'
was copying the wrong number of bytes.

WC-bug-id: https://jira.whamcloud.com/browse/LU-16518
Lustre-commit: 50f28f81b5aa8f8ad ("LU-16518 ptlrpc: fix clang build errors")
Signed-off-by: Timothy Day <timday@amazon.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49859
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_nrs.h       | 11 ++++++++++-
 fs/lustre/include/lustre_nrs_delay.h | 14 ++++++--------
 fs/lustre/ptlrpc/nrs_delay.c         |  2 +-
 fs/lustre/ptlrpc/sec_config.c        |  2 +-
 4 files changed, 18 insertions(+), 11 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/include/lustre_nrs.h b/fs/lustre/include/lustre_nrs.h
index 7e0a840..0e0dd73 100644
--- a/fs/lustre/include/lustre_nrs.h
+++ b/fs/lustre/include/lustre_nrs.h
@@ -64,7 +64,16 @@  enum ptlrpc_nrs_ctl {
 	 * Policies can start using opcodes from this value and onwards for
 	 * their own purposes; the assigned value itself is arbitrary.
 	 */
-	PTLRPC_NRS_CTL_1ST_POL_SPEC = 0x20,
+	PTLRPC_NRS_CTL_POL_SPEC_01 = 0x20,
+	PTLRPC_NRS_CTL_POL_SPEC_02,
+	PTLRPC_NRS_CTL_POL_SPEC_03,
+	PTLRPC_NRS_CTL_POL_SPEC_04,
+	PTLRPC_NRS_CTL_POL_SPEC_05,
+	PTLRPC_NRS_CTL_POL_SPEC_06,
+	PTLRPC_NRS_CTL_POL_SPEC_07,
+	PTLRPC_NRS_CTL_POL_SPEC_08,
+	PTLRPC_NRS_CTL_POL_SPEC_09,
+	PTLRPC_NRS_CTL_POL_SPEC_10
 };
 
 /**
diff --git a/fs/lustre/include/lustre_nrs_delay.h b/fs/lustre/include/lustre_nrs_delay.h
index 52c3885..75bf56d 100644
--- a/fs/lustre/include/lustre_nrs_delay.h
+++ b/fs/lustre/include/lustre_nrs_delay.h
@@ -73,14 +73,12 @@  struct nrs_delay_req {
 	time64_t	req_start_time;
 };
 
-enum nrs_ctl_delay {
-	NRS_CTL_DELAY_RD_MIN = PTLRPC_NRS_CTL_1ST_POL_SPEC,
-	NRS_CTL_DELAY_WR_MIN,
-	NRS_CTL_DELAY_RD_MAX,
-	NRS_CTL_DELAY_WR_MAX,
-	NRS_CTL_DELAY_RD_PCT,
-	NRS_CTL_DELAY_WR_PCT,
-};
+#define NRS_CTL_DELAY_RD_MIN PTLRPC_NRS_CTL_POL_SPEC_01
+#define NRS_CTL_DELAY_WR_MIN PTLRPC_NRS_CTL_POL_SPEC_02
+#define NRS_CTL_DELAY_RD_MAX PTLRPC_NRS_CTL_POL_SPEC_03
+#define NRS_CTL_DELAY_WR_MAX PTLRPC_NRS_CTL_POL_SPEC_04
+#define NRS_CTL_DELAY_RD_PCT PTLRPC_NRS_CTL_POL_SPEC_05
+#define NRS_CTL_DELAY_WR_PCT PTLRPC_NRS_CTL_POL_SPEC_06
 
 /** @} delay */
 
diff --git a/fs/lustre/ptlrpc/nrs_delay.c b/fs/lustre/ptlrpc/nrs_delay.c
index 127f00c..b249749 100644
--- a/fs/lustre/ptlrpc/nrs_delay.c
+++ b/fs/lustre/ptlrpc/nrs_delay.c
@@ -322,7 +322,7 @@  static int nrs_delay_ctl(struct ptlrpc_nrs_policy *policy,
 
 	assert_spin_locked(&policy->pol_nrs->nrs_lock);
 
-	switch ((enum nrs_ctl_delay)opc) {
+	switch (opc) {
 	default:
 		return -EINVAL;
 
diff --git a/fs/lustre/ptlrpc/sec_config.c b/fs/lustre/ptlrpc/sec_config.c
index e0ddebd..1b56ef4 100644
--- a/fs/lustre/ptlrpc/sec_config.c
+++ b/fs/lustre/ptlrpc/sec_config.c
@@ -649,7 +649,7 @@  int sptlrpc_process_config(struct lustre_cfg *lcfg)
 	 *	is a actual filesystem.
 	 */
 	if (server_name2fsname(target, fsname, NULL))
-		strlcpy(fsname, target, sizeof(target));
+		strlcpy(fsname, target, sizeof(fsname));
 
 	rc = sptlrpc_parse_rule(param, &rule);
 	if (rc)