]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
smb/client: move smb2maperror declarations to smb2proto.h
authorZhangGuoDong <zhangguodong@kylinos.cn>
Fri, 3 Apr 2026 15:38:52 +0000 (15:38 +0000)
committerSteve French <stfrench@microsoft.com>
Mon, 6 Apr 2026 00:58:40 +0000 (19:58 -0500)
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>
fs/smb/client/smb2maperror.c
fs/smb/client/smb2maperror_test.c
fs/smb/client/smb2proto.h

index 2b8782c4f684b5cf24c6522feb19ae1b5b009967..9ed21f7b618c5736c0ce3dbef1f44374e67fdbe9 100644 (file)
@@ -112,9 +112,6 @@ int __init smb2_init_maperror(void)
 #define EXPORT_SYMBOL_FOR_SMB_TEST(sym) \
        EXPORT_SYMBOL_FOR_MODULES(sym, "smb2maperror_test")
 
-/* Previous prototype for eliminating the build warning. */
-const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
-
 const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status)
 {
        return smb2_get_err_map(smb2_status);
index 8c4f168c8e9956d54242ce2acb748f6da83297e2..0f8a44a5ed3cfc5dacdab770df135abdf653ffd5 100644 (file)
@@ -9,11 +9,9 @@
  */
 
 #include <kunit/test.h>
+#include "cifsglob.h"
 #include "smb2glob.h"
-
-const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
-extern const struct status_to_posix_error *smb2_error_map_table_test;
-extern unsigned int smb2_error_map_num;
+#include "smb2proto.h"
 
 static void
 test_cmp_map(struct kunit *test, const struct status_to_posix_error *expect)
index 230bb1e9f4e19f1c05ff1f8404d66d25933647c7..5f74475ba9d1970cf0741accc194f30713305fdb 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/key-type.h>
 #include "cached_dir.h"
 
-struct statfs;
 struct smb_rqst;
 
 /*
@@ -24,6 +23,12 @@ struct smb_rqst;
  */
 int map_smb2_to_linux_error(char *buf, bool log_err);
 int smb2_init_maperror(void);
+#if IS_ENABLED(CONFIG_SMB_KUNIT_TESTS)
+const struct status_to_posix_error *smb2_get_err_map_test(__u32 smb2_status);
+extern const struct status_to_posix_error *smb2_error_map_table_test;
+extern unsigned int smb2_error_map_num;
+#endif
+
 int smb2_check_message(char *buf, unsigned int pdu_len, unsigned int len,
                       struct TCP_Server_Info *server);
 unsigned int smb2_calc_size(void *buf);