smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols in SMB2
Subsystems (2)
PATCH 1/1 smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols in SMB2
Replace EXPORT_SYMBOL_FOR_MODULES() with EXPORT_SYMBOL_IF_KUNIT() to mark the symbols as visible only if CONFIG_KUNIT is enabled.
Kunit test should import the namespace EXPORTED_FOR_KUNIT_TESTING to use these marked symbols. This is the standard way for all KUnit tests.
--- fs/smb/client/smb2maperror.c | 12 ++++++------ fs/smb/client/smb2maperror_test.c | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)
fs/smb/client/smb2maperror.c +6 -6
@@ -8,6 +8,9 @@* */ #include <linux/errno.h> + +#include <kunit/visibility.h> +#include "cifsproto.h" #include "cifs_debug.h" #include "smb2proto.h"
@@ -109,18 +112,15 @@ int __init smb2_init_maperror(void) }#if IS_ENABLED (CONFIG_SMB_KUNIT_TESTS ) -#define EXPORT_SYMBOL_FOR_SMB_TEST (sym) \ - EXPORT_SYMBOL_FOR_MODULES(sym, "smb2maperror_test") -const struct status_to_posix_error *smb2_get_err_map_test (__u32 smb2_status) {return smb2_get_err_map (smb2_status); } -EXPORT_SYMBOL_FOR_SMB_TEST (smb2_get_err_map_test); +EXPORT_SYMBOL_IF_KUNIT (smb2_get_err_map_test);const struct status_to_posix_error *smb2_error_map_table_test = smb2_error_map_table; -EXPORT_SYMBOL_FOR_SMB_TEST (smb2_error_map_table_test); +EXPORT_SYMBOL_IF_KUNIT (smb2_error_map_table_test);unsigned int smb2_error_map_num =ARRAY_SIZE (smb2_error_map_table); -EXPORT_SYMBOL_FOR_SMB_TEST (smb2_error_map_num); +EXPORT_SYMBOL_IF_KUNIT (smb2_error_map_num);#endif
fs/smb/client/smb2maperror_test.c +1 -0
@@ -47,3 +47,4 @@ kunit_test_suite(maperror_suite);MODULE_LICENSE ("GPL" );MODULE_DESCRIPTION ("KUnit tests of SMB2 maperror" ); +MODULE_IMPORT_NS ("EXPORTED_FOR_KUNIT_TESTING" );
Signature · 1 line
2.50.1
Quoted 12 lines · Andy Shevchenko
Replace
EXPORT_SYMBOL_FOR_MODULES()withEXPORT_SYMBOL_IF_KUNIT()to mark the symbols as visible only ifCONFIG_KUNITis enabled.Kunit test should import the namespace
EXPORTED_FOR_KUNIT_TESTINGto use these marked symbols. This is the standard way for all KUnit tests.Signed-off-by Andy Shevchenko<[email protected]>--- fs/smb/client/smb2maperror.c | 12 ++++++------ fs/smb/client/smb2maperror_test.c | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)
Signature · 3 lines
ChenXiaoSong <[email protected]> Chinese Homepage: https://chenxiaosong.com English Homepage: https://chenxiaosong.com/en
Steve French
Appliedmerged into cifs-2.6.git for-next
Quoted 23 lines · ChenXiaoSong via samba-technical
Reviewed-by ChenXiaoSong <[email protected]>Quoted 7 lines · Andy Shevchenko
Replace
EXPORT_SYMBOL_FOR_MODULES()withEXPORT_SYMBOL_IF_KUNIT()to mark the symbols as visible only ifCONFIG_KUNITis enabled.Kunit test should import the namespace
EXPORTED_FOR_KUNIT_TESTINGto use these marked symbols. This is the standard way for all KUnit tests.Quoted 5 lines
Signed-off-by Andy Shevchenko<[email protected]>--- fs/smb/client/smb2maperror.c | 12 ++++++------ fs/smb/client/smb2maperror_test.c | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)--
ChenXiaoSong <[email protected]>
Chinese Homepage: https://chenxiaosong.com
English Homepage: https://chenxiaosong.com/en
Signature · 3 lines
Thanks, Steve