smb: common: add header guards to fs/smb/common/smb2status.h
Subsystems (2)
PATCH 1/1 smb: common: add header guards to fs/smb/common/smb2status.h
This will allow it to be included multiple times without problems, that's needed for the smbdirect move to common code.
--- fs/smb/common/smb2status.h | 5 +++++ 1 file changed, 5 insertions(+)
fs/smb/common/smb2status.h +5 -0
@@ -9,6 +9,9 @@* */ +#ifndef FS_SMB_COMMON_SMB2STATUS_H +#define FS_SMB_COMMON_SMB2STATUS_H +/* * 0 1 2 3 4 5 6 7 8 9 0 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F * SEV C N <-------Facility--------> <------Error Status Code------>
@@ -1782,3 +1785,5 @@ struct ntstatus {#define STATUS_IPSEC_CLEAR_TEXT_DROP cpu_to_le32(0xC0360007) // -EIO/* See MS-SMB2 3.3.5.4 */ #define STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP cpu_to_le32(0xC05D0000) // -EIO + +#endif /* FS_SMB_COMMON_SMB2STATUS_H */
Signature · 1 line
2.43.0
Hi Steve,
this is on top of your for-next branch as it depends on this patch from David:
cifs: Label SMB2 statuses with errors
While there I found that this patch:
cifs: Autogenerate SMB2 error mapping table
Generates this error:client/smb2maperror.c:55:60: SPARSE: error: restricted __le32 degrades to integer David can you check?
Thanks!
metze
Am 03.02.26 um 16:20 schrieb Stefan Metzmacher:
Quoted 34 lines
This will allow it to be included multiple times without problems, that's needed for the smbdirect move to common code.
Cc Steve French <[email protected]>Cc Tom Talpey <[email protected]>Cc Long Li <[email protected]>Cc Namjae Jeon <[email protected]>Signed-off-by Stefan Metzmacher <[email protected]>--- fs/smb/common/smb2status.h | 5 +++++ 1 file changed, 5 insertions(+)fs/smb/common/smb2status.h +5
-0@@ -9,6 +9,9 @@* */ +#ifndef FS_SMB_COMMON_SMB2STATUS_H +#define FS_SMB_COMMON_SMB2STATUS_H +/* * 0 1 2 3 4 5 6 7 8 9 0 A B C D E F 0 1 2 3 4 5 6 7 8 9 A B C D E F * SEV C N <-------Facility--------> <------Error Status Code------> @@ -1782,3 +1785,5 @@ struct ntstatus {#define STATUS_IPSEC_CLEAR_TEXT_DROP cpu_to_le32(0xC0360007) // -EIO/* See MS-SMB2 3.3.5.4 */ #define STATUS_SMB_NO_PREAUTH_INTEGRITY_HASH_OVERLAP cpu_to_le32(0xC05D0000) // -EIO + +#endif /* FS_SMB_COMMON_SMB2STATUS_H */
Am 03.02.26 um 16:34 schrieb Stefan Metzmacher:
Quoted 5 lines
Hi Steve,
this is on top of your for-next branch as it depends on this patch from David:
Quoted 8 lines
cifs: Label SMB2 statuses with errors
While there I found that this patch:
cifs: Autogenerate SMB2 error mapping tableGenerates this error:
client/smb2maperror.c:55:60: SPARSE: error: restricted__le32degrades to integer David can you check?
This also breaks cifs.ko against a running kernel.
$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h
results in:
make[3]: *** No rule to make target '/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/fs/smb/common/smb2status.h', needed by 'smb2_mapping_table.c'. Stop. make[3]: *** Waiting for unfinished jobs....
CC [M] smb2ops.o
make[2]: *** [/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/Makefile:2061: .] Error 2
make[1]: *** [/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/Makefile:249: __sub-make] Error 2
make[1]: Leaving directory '/root/cifs-backport/fs-smb/client'
make: *** [Makefile:249: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+'
metze
Am 04.02.26 um 17:09 schrieb Stefan Metzmacher:
Quoted 14 lines
Am 03.02.26 um 16:34 schrieb Stefan Metzmacher:
Quoted 13 lines
Hi Steve,
this is on top of your for-next branch as it depends on this patch from David:
cifs: Label SMB2 statuses with errors
While there I found that this patch:
cifs: Autogenerate SMB2 error mapping tableGenerates this error:
client/smb2maperror.c:55:60: SPARSE: error: restricted__le32degrades to integer David can you check?
This seems to be fixes by
smb/client: use bsearch() to find target in smb2_error_map_table
as I'm no longer see it when compiling all of for-next.
Quoted 6 lines
This also breaks cifs.ko against a running kernel.
$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h
results in:
Quoted 8 lines
make[3]: *** No rule to make target '
/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/fs/smb/common/smb2status.h', needed by 'smb2_mapping_table.c'. Stop. make[3]: *** Waiting for unfinished jobs....
CC [M] smb2ops.o
make[2]: *** [/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/Makefile:2061: .] Error 2
make[1]: *** [/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+/Makefile:249: __sub-make] Error 2
make[1]: Leaving directory '/root/cifs-backport/fs-smb/client'
make: *** [Makefile:249: __sub-make] Error 2
make: Leaving directory '/usr/src/linux-headers-6.19.0-rc8-z-metze-perf.01+'
This fixes it for me:
fs/smb/client/Makefile +1 -1
@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)
metze
David Howells
Reviewed-byfs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)
That looks reasonable. Do you have a patch for it, if so, you can add:
David
Am 05.02.26 um 22:31 schrieb David Howells:
Quoted 17 lines
fs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)That looks reasonable. Do you have a patch for it, if so, you can add:
Quoted 1 line
Reviewed-by David Howells <[email protected]>
I'd propose that Steve just squashes this into your commit
cifs: Autogenerate SMB2 error mapping table
Thanks!
metze
Steve French
Reviewed-by David Howellsupdated the patch with your suggestion in cifs-2.6.git for-next (see attached). Let me know if any objections or if you spot any problems.
Quoted 27 lines · Stefan Metzmacher
Am 05.02.26 um 22:31 schrieb David Howells:
Quoted 17 lines
fs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)That looks reasonable. Do you have a patch for it, if so, you can add:
Quoted 1 line
Reviewed-by David Howells <[email protected]>I'd propose that Steve just squashes this into your commit
cifs: Autogenerate SMB2 error mapping tableThanks!
metze
Signature · 3 lines
Thanks, Steve
From ade60a2fceae59392db456be3a7a7784fa4ab20c Mon Sep 17 00:00:00 2001
From: David Howells <[email protected]>
Date: Tue, 23 Dec 2025 00:05:34 +0000
Subject: [PATCH] cifs: Autogenerate SMB2 error mapping table
Autogenerate the SMB2 status to error code mapping table, from the smb2status.h common header, sorting it by NT status code so that it can be searched by binary chopping. This also reduces the number of places this list is duplicated in the source.
--- fs/smb/client/Makefile | 14 + fs/smb/client/gen_smb2_mapping | 86 ++ fs/smb/client/smb2maperror.c | 2402 +------------------------------- fs/smb/common/smb2status.h | 6 + 4 files changed, 112 insertions(+), 2396 deletions(-) create mode 100644 fs/smb/client/gen_smb2_mapping
fs/smb/client/Makefile +14 -0
@@ -43,3 +43,17 @@ cifs-$(CONFIG_CIFS_ALLOW_INSECURE_LEGACY) += \ smb1transport.o cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o + +# +# Build the SMB2 error mapping table from smb2status.h +# +$(obj)/smb2_mapping_table.c: $(src)/fs/smb/common/smb2status.h \ + $(src)/gen_smb2_mapping + $(call cmd,gen_smb2_mapping) + +$(obj)/smb2maperror.o: $(obj)/smb2_mapping_table.c + +quiet_cmd_gen_smb2_mapping = GEN $@ + cmd_gen_smb2_mapping = perl $(src)/gen_smb2_mapping $< $@ + +clean-files += smb2_mapping_table.c
fs/smb/client/gen_smb2_mapping new file +86 -0
86 lines not on this page · raw message
fs/smb/client/smb2maperror.c +6 -2396
2,413 lines not on this page · raw message
fs/smb/common/smb2status.h +6 -0
@@ -27,6 +27,12 @@ struct ntstatus {__le32 Code; }; +/* +* The comment at the end of each definition indicates `posix_error` +* field of `struct status_to_posix_error`, it is used to generate the +* `smb2_error_map_table` array. +*/ +#define STATUS_SUCCESS cpu_to_le32(0x00000000) // 0#define STATUS_WAIT_0 cpu_to_le32(0x00000000) // 0#define STATUS_WAIT_1 cpu_to_le32(0x00000001) // -EIO
Signature · 1 line
2.51.0
Am 07.02.26 um 04:41 schrieb Steve French:
Quoted 4 lines
updated the patch with your suggestion in cifs-2.6.git for-next (see attached). Let me know if any objections or if you spot any problems.
Quoted 24 lines
Quoted 23 lines · Stefan Metzmacher
Am 05.02.26 um 22:31 schrieb David Howells:
Quoted 17 lines
fs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)That looks reasonable. Do you have a patch for it, if so, you can add:
Quoted 1 line
Reviewed-by David Howells <[email protected]>I'd propose that Steve just squashes this into your commit
cifs: Autogenerate SMB2 error mapping table
The attached patch has this
+$(obj)/smb2_mapping_table.c: $(src)/fs/smb/common/smb2status.h \
+ $(src)/gen_smb2_mapping
+ $(call cmd,gen_smb2_mapping)
Which is even worse, it has to be
$(src)/../common/smb2status.h
metze
Looks like your suggested change works. My change had a typo which you spotted.
Quoted 42 lines · Stefan Metzmacher
Am 07.02.26 um 04:41 schrieb Steve French:
Quoted 4 lines
updated the patch with your suggestion in cifs-2.6.git for-next (see attached). Let me know if any objections or if you spot any problems.
Quoted 24 lines
Quoted 23 lines · Stefan Metzmacher
Am 05.02.26 um 22:31 schrieb David Howells:
Quoted 17 lines
fs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)That looks reasonable. Do you have a patch for it, if so, you can add:
Quoted 1 line
Reviewed-by David Howells <[email protected]>I'd propose that Steve just squashes this into your commit
cifs: Autogenerate SMB2 error mapping tableThe attached patch has this
+$(obj)/smb2_mapping_table.c: $(src)/fs/smb/common/smb2status.h \
fs/smb/client/Makefile +2
-0+ $(src)/gen_smb2_mapping + $(call cmd,gen_smb2_mapping)Which is even worse, it has to be
$(src)/../common/smb2status.h
metze
Signature · 3 lines
Thanks, Steve
Quoted 37 lines · Stefan Metzmacher
Am 07.02.26 um 04:41 schrieb Steve French:
Quoted 4 lines
updated the patch with your suggestion in cifs-2.6.git for-next (see attached). Let me know if any objections or if you spot any problems.
Quoted 24 lines
Quoted 23 lines · Stefan Metzmacher
Am 05.02.26 um 22:31 schrieb David Howells:
Quoted 17 lines
fs/smb/client/Makefile cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o · line 52
Quoted 12 lines · Stefan Metzmacher
fs/smb/client/Makefile +1
-1@@ -47,7 +47,7 @@ cifs-$(CONFIG_CIFS_COMPRESSION) += compress.o compress/lz77.o # # Build the SMB2 error mapping table from smb2status.h # -$(obj)/smb2_mapping_table.c: $(srctree)/fs/smb/common/smb2status.h \ +$(obj)/smb2_mapping_table.c: $(src)/../common/smb2status.h \ $(src)/gen_smb2_mapping $(call cmd,gen_smb2_mapping)That looks reasonable. Do you have a patch for it, if so, you can add:
Quoted 1 line
Reviewed-by David Howells <[email protected]>I'd propose that Steve just squashes this into your commit
cifs: Autogenerate SMB2 error mapping tableThe attached patch has this
+$(obj)/smb2_mapping_table.c: $(src)/fs/smb/common/smb2status.h \
fs/smb/client/Makefile +2
-0+ $(src)/gen_smb2_mapping + $(call cmd,gen_smb2_mapping)
Quoted 5 lines
Which is even worse, it has to be
$(src)/../common/smb2status.h
metze
thx - I fixed up the patch and updated cifs-2.6.git for-next
Signature · 3 lines
Thanks, Steve