Skip to content

Commit 59ea368

Browse files
ZhangGuoDongsmfrench
authored andcommitted
smb/client: move smb2maperror declarations to smb2proto.h
For `smb2_error_map_table_test` and `smb2_error_map_num`, if their types are changed in `smb2maperror.c` but the corresponding extern declarations in `smb2maperror_test.c` are not updated, the compiler will not report an error. Moving them to a common header file allows the compiler to catch type mismatches. Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 85274a3 commit 59ea368

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

fs/smb/client/smb2maperror.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ int __init smb2_init_maperror(void)
112112
#define EXPORT_SYMBOL_FOR_SMB_TEST(sym) \
113113
EXPORT_SYMBOL_FOR_MODULES(sym, "smb2maperror_test")
114114

115-
/* Previous prototype for eliminating the build warning. */
116-
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
117-
118115
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status)
119116
{
120117
return smb2_get_err_map(smb2_status);

fs/smb/client/smb2maperror_test.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
*/
1010

1111
#include <kunit/test.h>
12+
#include "cifsglob.h"
1213
#include "smb2glob.h"
13-
14-
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
15-
extern const struct status_to_posix_error *smb2_error_map_table_test;
16-
extern unsigned int smb2_error_map_num;
14+
#include "smb2proto.h"
1715

1816
static void
1917
test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)

fs/smb/client/smb2proto.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/key-type.h>
1515
#include "cached_dir.h"
1616

17-
struct statfs;
1817
struct smb_rqst;
1918

2019
/*
@@ -24,6 +23,12 @@ struct smb_rqst;
2423
*/
2524
int map_smb2_to_linux_error(char *buf, bool log_err);
2625
int smb2_init_maperror(void);
26+
#if IS_ENABLED(CONFIG_SMB_KUNIT_TESTS)
27+
const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
28+
extern const struct status_to_posix_error *smb2_error_map_table_test;
29+
extern unsigned int smb2_error_map_num;
30+
#endif
31+
2732
int smb2_check_message(char *buf, unsigned int pdu_len, unsigned int len,
2833
struct TCP_Server_Info *server);
2934
unsigned int smb2_calc_size(void *buf);

0 commit comments

Comments
 (0)