Skip to contentSkip to conversation

smb: move SMB2 Status code to common header file

PATCH New [email protected] 1 participant 3 messages Jun 20, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author reviewer
#0 lore raw

cover smb: move SMB2 Status code to common header file

From: ChenXiaoSong <[email protected]>

There are only slight differences between the client and server of SMB2 Status code definitions, in order to maintain the code more easily, move all definitions to common header file.

ChenXiaoSong (2):
smb/client: fix typo to STATUS_MCA_OCCURRED
smb: move SMB2 Status code to common header file

 fs/smb/client/smb2file.c               |    2 +-
 fs/smb/client/smb2inode.c              |    2 +-
 fs/smb/client/smb2maperror.c           |    4 +-
 fs/smb/client/smb2misc.c               |    2 +-
 fs/smb/client/smb2ops.c                |    2 +-
 fs/smb/client/smb2pdu.c                |    2 +-
 fs/smb/client/smb2transport.c          |    2 +-
 fs/smb/{client => common}/smb2status.h |  163 ++-
 fs/smb/server/oplock.c                 |    2 +-
 fs/smb/server/server.c                 |    2 +-
 fs/smb/server/smb2misc.c               |    2 +-
 fs/smb/server/smb2pdu.c                |    2 +-
 fs/smb/server/smb_common.c             |    2 +-
 fs/smb/server/smbstatus.h              | 1822 ------------------------
 fs/smb/server/transport_rdma.c         |    2 +-
 15 files changed, 122 insertions(+), 1891 deletions(-)
 rename fs/smb/{client => common}/smb2status.h (96%)
 delete mode 100644 fs/smb/server/smbstatus.h
Signature · 1 line
2.34.1
author reviewer
#1 lore raw

PATCH 1/2 smb/client: fix typo to STATUS_MCA_OCCURRED

From: ChenXiaoSong <[email protected]>

Preparation for moving the SMB2 Status code definitions to a common header file.

---
 fs/smb/client/smb2maperror.c | 2 +-
 fs/smb/client/smb2status.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/smb/client/smb2maperror.c +1 -1
index ac1895358908..3ac17d43bb7d 100644
@@ -1096,7 +1096,7 @@ static const struct status_to_posix_error smb2_error_map_table[] = {
 	"STATUS_MOUNT_POINT_NOT_RESOLVED"},
 	{STATUS_INVALID_DEVICE_OBJECT_PARAMETER, -EIO,
 	"STATUS_INVALID_DEVICE_OBJECT_PARAMETER"},
-	{STATUS_MCA_OCCURED, -EIO, "STATUS_MCA_OCCURED"},
+	{STATUS_MCA_OCCURRED, -EIO, "STATUS_MCA_OCCURRED"},
 	{STATUS_DRIVER_BLOCKED_CRITICAL, -EIO,
 	"STATUS_DRIVER_BLOCKED_CRITICAL"},
 	{STATUS_DRIVER_BLOCKED, -EIO, "STATUS_DRIVER_BLOCKED"},
fs/smb/client/smb2status.h +1 -1
index 9c6d79b0bd49..15364c4328ec 100644
@@ -901,7 +901,7 @@ struct ntstatus {
 #define STATUS_DEVICE_ENUMERATION_ERROR cpu_to_le32(0xC0000366)
 #define STATUS_MOUNT_POINT_NOT_RESOLVED cpu_to_le32(0xC0000368)
 #define STATUS_INVALID_DEVICE_OBJECT_PARAMETER cpu_to_le32(0xC0000369)
-#define STATUS_MCA_OCCURED cpu_to_le32(0xC000036A)
+#define STATUS_MCA_OCCURRED cpu_to_le32(0xC000036A)
 #define STATUS_DRIVER_BLOCKED_CRITICAL cpu_to_le32(0xC000036B)
 #define STATUS_DRIVER_BLOCKED cpu_to_le32(0xC000036C)
 #define STATUS_DRIVER_DATABASE_ERROR cpu_to_le32(0xC000036D)
Signature · 1 line
2.34.1
author reviewer
#2 lore raw

PATCH 2/2 smb: move SMB2 Status code to common header file

In reply to [email protected]

From: ChenXiaoSong <[email protected]>

There are only 4 different definitions between the client and server:

- STATUS_SERVER_UNAVAILABLE: from client/smb2status.h
- STATUS_FILE_NOT_AVAILABLE: from client/smb2status.h
- STATUS_NO_PREAUTH_INTEGRITY_HASH_OVERLAP: from server/smbstatus.h
- STATUS_INVALID_LOCK_RANGE: from server/smbstatus.h

Rename server/smbstatus.h to common/smb2status.h, and merge the 2 different definitions of client to common header file.

---
 fs/smb/client/smb2file.c               |    2 +-
 fs/smb/client/smb2inode.c              |    2 +-
 fs/smb/client/smb2maperror.c           |    2 +-
 fs/smb/client/smb2misc.c               |    2 +-
 fs/smb/client/smb2ops.c                |    2 +-
 fs/smb/client/smb2pdu.c                |    2 +-
 fs/smb/client/smb2transport.c          |    2 +-
 fs/smb/{client => common}/smb2status.h |  161 ++-
 fs/smb/server/oplock.c                 |    2 +-
 fs/smb/server/server.c                 |    2 +-
 fs/smb/server/smb2misc.c               |    2 +-
 fs/smb/server/smb2pdu.c                |    2 +-
 fs/smb/server/smb_common.c             |    2 +-
 fs/smb/server/smbstatus.h              | 1822 ------------------------
 fs/smb/server/transport_rdma.c         |    2 +-
 15 files changed, 120 insertions(+), 1889 deletions(-)
 rename fs/smb/{client => common}/smb2status.h (96%)
 delete mode 100644 fs/smb/server/smbstatus.h
fs/smb/client/smb2file.c +1 -1
index c23478ab1cf8..e6319f248816 100644
@@ -21,7 +21,7 @@
 #include "cifs_unicode.h"
 #include "fscache.h"
 #include "smb2proto.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 
 static struct smb2_symlink_err_rsp *symlink_data(const struct kvec *iov)
 {
fs/smb/client/smb2inode.c +1 -1
index 5c02a12251c8..a9803fd107a1 100644
@@ -24,7 +24,7 @@
 #include "smb2pdu.h"
 #include "smb2proto.h"
 #include "cached_dir.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 
 static struct reparse_data_buffer *reparse_buf_ptr(struct kvec *iov)
 {
fs/smb/client/smb2maperror.c +1 -1
index 3ac17d43bb7d..96641356e4ad 100644
@@ -12,7 +12,7 @@
 #include "cifs_debug.h"
 #include "smb2pdu.h"
 #include "smb2proto.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 #include "smb2glob.h"
 #include "trace.h"
 
fs/smb/client/smb2misc.c +1 -1
index 677ef6f99a5b..f3c4b70b77b9 100644
@@ -13,7 +13,7 @@
 #include "smb2proto.h"
 #include "cifs_debug.h"
 #include "cifs_unicode.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 #include "smb2glob.h"
 #include "nterr.h"
 #include "cached_dir.h"
fs/smb/client/smb2ops.c +1 -1
index c8e536540895..254c8ee7f914 100644
@@ -21,7 +21,7 @@
 #include "cifsproto.h"
 #include "cifs_debug.h"
 #include "cifs_unicode.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 #include "smb2glob.h"
 #include "cifs_ioctl.h"
 #include "smbdirect.h"
fs/smb/client/smb2pdu.c +1 -1
index 38a06e8a0f90..0b073632fc63 100644
@@ -32,7 +32,7 @@
 #include "cifs_unicode.h"
 #include "cifs_debug.h"
 #include "ntlmssp.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 #include "smb2glob.h"
 #include "cifspdu.h"
 #include "cifs_spnego.h"
fs/smb/client/smb2transport.c +1 -1
index 1476c445cadc..e4636fca821d 100644
@@ -23,7 +23,7 @@
 #include "cifsproto.h"
 #include "smb2proto.h"
 #include "cifs_debug.h"
-#include "smb2status.h"
+#include "../common/smb2status.h"
 #include "smb2glob.h"
 
 static int
fs/smb/common/smb2status.h renamed from fs/smb/client/smb2status.h +107 -54

349 lines not on this page · raw message

fs/smb/server/oplock.c +1 -1
index a8f52c4ebbda..8f2e6a951d58 100644
@@ -10,7 +10,7 @@
 #include "oplock.h"
 
 #include "smb_common.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "connection.h"
 #include "mgmt/user_session.h"
 #include "mgmt/share_config.h"
fs/smb/server/server.c +1 -1
index c67fbc8d6683..5a4046c6bb04 100644
@@ -15,7 +15,7 @@
 
 #include "server.h"
 #include "smb_common.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "connection.h"
 #include "transport_ipc.h"
 #include "mgmt/user_session.h"
fs/smb/server/smb2misc.c +1 -1
index 727cb49926ee..ae501024665e 100644
@@ -7,7 +7,7 @@
 #include "glob.h"
 #include "nterr.h"
 #include "smb_common.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "mgmt/user_session.h"
 #include "connection.h"
 
fs/smb/server/smb2pdu.c +1 -1
index e7e07891781b..e790dfc6b409 100644
@@ -30,7 +30,7 @@
 
 #include "server.h"
 #include "smb_common.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "ksmbd_work.h"
 #include "mgmt/user_config.h"
 #include "mgmt/share_config.h"
fs/smb/server/smb_common.c +1 -1
index 474dadf6b7b8..591d75c10a7c 100644
@@ -9,7 +9,7 @@
 #include "smb_common.h"
 #include "server.h"
 #include "misc.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "connection.h"
 #include "ksmbd_work.h"
 #include "mgmt/user_session.h"
fs/smb/server/smbstatus.h deleted +0 -1822

1,822 lines not on this page · raw message

fs/smb/server/transport_rdma.c +1 -1
index 8faa25c6e129..ab95a7227586 100644
@@ -21,7 +21,7 @@
 #include "glob.h"
 #include "connection.h"
 #include "smb_common.h"
-#include "smbstatus.h"
+#include "../common/smb2status.h"
 #include "transport_rdma.h"
 
 #define SMB_DIRECT_PORT_IWARP		5445
Signature · 1 line
2.34.1