mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
@ 2026-07-14 12:21 Andy Shevchenko
  2026-07-14 12:35 ` ChenXiaoSong
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-07-14 12:21 UTC (permalink / raw)
  To: Steve French, ChenXiaoSong, Youling Tang, linux-cifs,
	samba-technical, linux-kernel
  Cc: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM, Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 fs/smb/client/smb1maperror.c      | 24 ++++++++++++------------
 fs/smb/client/smb1maperror_test.c |  1 +
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/fs/smb/client/smb1maperror.c b/fs/smb/client/smb1maperror.c
index 74530088d17d..ab3d09613c91 100644
--- a/fs/smb/client/smb1maperror.c
+++ b/fs/smb/client/smb1maperror.c
@@ -10,6 +10,9 @@
  */
 
 #include <linux/bsearch.h>
+
+#include <kunit/visibility.h>
+
 #include "cifsproto.h"
 #include "smb1proto.h"
 #include "smberr.h"
@@ -239,48 +242,45 @@ int __init smb1_init_maperror(void)
 }
 
 #if IS_ENABLED(CONFIG_SMB1_KUNIT_TESTS)
-#define EXPORT_SYMBOL_FOR_SMB_TEST(sym) \
-	EXPORT_SYMBOL_FOR_MODULES(sym, "smb1maperror_test")
-
 const struct ntstatus_to_dos_err *
 search_ntstatus_to_dos_map_test(__u32 ntstatus)
 {
 	return search_ntstatus_to_dos_map(ntstatus);
 }
-EXPORT_SYMBOL_FOR_SMB_TEST(search_ntstatus_to_dos_map_test);
+EXPORT_SYMBOL_IF_KUNIT(search_ntstatus_to_dos_map_test);
 
 const struct ntstatus_to_dos_err *
 ntstatus_to_dos_map_test = ntstatus_to_dos_map;
-EXPORT_SYMBOL_FOR_SMB_TEST(ntstatus_to_dos_map_test);
+EXPORT_SYMBOL_IF_KUNIT(ntstatus_to_dos_map_test);
 
 unsigned int ntstatus_to_dos_num = ARRAY_SIZE(ntstatus_to_dos_map);
-EXPORT_SYMBOL_FOR_SMB_TEST(ntstatus_to_dos_num);
+EXPORT_SYMBOL_IF_KUNIT(ntstatus_to_dos_num);
 
 const struct smb_to_posix_error *
 search_mapping_table_ERRDOS_test(__u16 smb_err)
 {
 	return search_mapping_table_ERRDOS(smb_err);
 }
-EXPORT_SYMBOL_FOR_SMB_TEST(search_mapping_table_ERRDOS_test);
+EXPORT_SYMBOL_IF_KUNIT(search_mapping_table_ERRDOS_test);
 
 const struct smb_to_posix_error *
 mapping_table_ERRDOS_test = mapping_table_ERRDOS;
-EXPORT_SYMBOL_FOR_SMB_TEST(mapping_table_ERRDOS_test);
+EXPORT_SYMBOL_IF_KUNIT(mapping_table_ERRDOS_test);
 
 unsigned int mapping_table_ERRDOS_num = ARRAY_SIZE(mapping_table_ERRDOS);
-EXPORT_SYMBOL_FOR_SMB_TEST(mapping_table_ERRDOS_num);
+EXPORT_SYMBOL_IF_KUNIT(mapping_table_ERRDOS_num);
 
 const struct smb_to_posix_error *
 search_mapping_table_ERRSRV_test(__u16 smb_err)
 {
 	return search_mapping_table_ERRSRV(smb_err);
 }
-EXPORT_SYMBOL_FOR_SMB_TEST(search_mapping_table_ERRSRV_test);
+EXPORT_SYMBOL_IF_KUNIT(search_mapping_table_ERRSRV_test);
 
 const struct smb_to_posix_error *
 mapping_table_ERRSRV_test = mapping_table_ERRSRV;
-EXPORT_SYMBOL_FOR_SMB_TEST(mapping_table_ERRSRV_test);
+EXPORT_SYMBOL_IF_KUNIT(mapping_table_ERRSRV_test);
 
 unsigned int mapping_table_ERRSRV_num = ARRAY_SIZE(mapping_table_ERRSRV);
-EXPORT_SYMBOL_FOR_SMB_TEST(mapping_table_ERRSRV_num);
+EXPORT_SYMBOL_IF_KUNIT(mapping_table_ERRSRV_num);
 #endif
diff --git a/fs/smb/client/smb1maperror_test.c b/fs/smb/client/smb1maperror_test.c
index 2caaf11228ef..903c46f71291 100644
--- a/fs/smb/client/smb1maperror_test.c
+++ b/fs/smb/client/smb1maperror_test.c
@@ -75,3 +75,4 @@ kunit_test_suite(maperror_suite);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("KUnit tests of SMB1 maperror");
+MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
  2026-07-14 12:21 [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols Andy Shevchenko
@ 2026-07-14 12:35 ` ChenXiaoSong
  2026-07-14 13:27   ` Andy Shevchenko
  2026-07-14 22:02   ` Steve French
  0 siblings, 2 replies; 4+ messages in thread
From: ChenXiaoSong @ 2026-07-14 12:35 UTC (permalink / raw)
  To: Andy Shevchenko, Steve French, Youling Tang, linux-cifs,
	samba-technical, linux-kernel
  Cc: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM

Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>

Andy, could you also submit a patch to update 
fs/smb/client/smb2maperror.c as well?

在 2026/7/14 20:21, Andy Shevchenko 写道:
> 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.
> 
> Signed-off-by: Andy Shevchenko<andriy.shevchenko@linux.intel.com>
> ---
>   fs/smb/client/smb1maperror.c      | 24 ++++++++++++------------
>   fs/smb/client/smb1maperror_test.c |  1 +
>   2 files changed, 13 insertions(+), 12 deletions(-)

-- 
ChenXiaoSong <chenxiaosong@chenxiaosong.com>
Chinese Homepage: https://chenxiaosong.com
English Homepage: https://chenxiaosong.com/en


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
  2026-07-14 12:35 ` ChenXiaoSong
@ 2026-07-14 13:27   ` Andy Shevchenko
  2026-07-14 22:02   ` Steve French
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-07-14 13:27 UTC (permalink / raw)
  To: ChenXiaoSong
  Cc: Steve French, Youling Tang, linux-cifs, samba-technical,
	linux-kernel, Steve French, Paulo Alcantara, Ronnie Sahlberg,
	Shyam Prasad N, Tom Talpey, Bharath SM

On Tue, Jul 14, 2026 at 08:35:16PM +0800, ChenXiaoSong wrote:
> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>

Thanks!

> Andy, could you also submit a patch to update fs/smb/client/smb2maperror.c
> as well?

Sure.

> 在 2026/7/14 20:21, Andy Shevchenko 写道:
> > 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.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols
  2026-07-14 12:35 ` ChenXiaoSong
  2026-07-14 13:27   ` Andy Shevchenko
@ 2026-07-14 22:02   ` Steve French
  1 sibling, 0 replies; 4+ messages in thread
From: Steve French @ 2026-07-14 22:02 UTC (permalink / raw)
  To: ChenXiaoSong
  Cc: Andy Shevchenko, Steve French, Youling Tang, linux-cifs,
	samba-technical, linux-kernel, Tom Talpey, Shyam Prasad N,
	Paulo Alcantara, Steve French, Bharath SM

merged into cifs-2.6.git for-next

On Tue, Jul 14, 2026 at 7:36 AM ChenXiaoSong via samba-technical
<samba-technical@lists.samba.org> wrote:
>
> Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
>
> Andy, could you also submit a patch to update
> fs/smb/client/smb2maperror.c as well?
>
> 在 2026/7/14 20:21, Andy Shevchenko 写道:
> > 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.
> >
> > Signed-off-by: Andy Shevchenko<andriy.shevchenko@linux.intel.com>
> > ---
> >   fs/smb/client/smb1maperror.c      | 24 ++++++++++++------------
> >   fs/smb/client/smb1maperror_test.c |  1 +
> >   2 files changed, 13 insertions(+), 12 deletions(-)
>
> --
> ChenXiaoSong <chenxiaosong@chenxiaosong.com>
> Chinese Homepage: https://chenxiaosong.com
> English Homepage: https://chenxiaosong.com/en
>
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-14 22:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 12:21 [PATCH v1 1/1] smb/client: Use EXPORT_SYMBOL_IF_KUNIT() to export symbols Andy Shevchenko
2026-07-14 12:35 ` ChenXiaoSong
2026-07-14 13:27   ` Andy Shevchenko
2026-07-14 22:02   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®