[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251222223006.1075635-28-dhowells@redhat.com>
Date: Mon, 22 Dec 2025 22:29:52 +0000
From: David Howells <dhowells@...hat.com>
To: Steve French <sfrench@...ba.org>
Cc: David Howells <dhowells@...hat.com>,
Paulo Alcantara <pc@...guebit.org>,
Enzo Matsumiya <ematsumiya@...e.de>,
linux-cifs@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 27/37] cifs: SMB1 split: Move BCC access functions
Move the BCC access functions to smb1proto.h as they're only applicable to
SMB1.
Signed-off-by: David Howells <dhowells@...hat.com>
cc: Steve French <sfrench@...ba.org>
cc: Paulo Alcantara <pc@...guebit.org>
cc: Enzo Matsumiya <ematsumiya@...e.de>
cc: linux-cifs@...r.kernel.org
cc: linux-fsdevel@...r.kernel.org
cc: linux-kernel@...r.kernel.org
---
fs/smb/client/cifspdu.h | 34 ----------------------------------
fs/smb/client/smb1proto.h | 36 +++++++++++++++++++++++++++++++++++-
2 files changed, 35 insertions(+), 35 deletions(-)
diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h
index de061247ecd7..78512af18d96 100644
--- a/fs/smb/client/cifspdu.h
+++ b/fs/smb/client/cifspdu.h
@@ -9,38 +9,4 @@
#ifndef _CIFSPDU_H
#define _CIFSPDU_H
-#include <linux/unaligned.h>
-#include "../common/smb1pdu.h"
-
-#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
-#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
-
-/* given a pointer to an smb_hdr, retrieve a void pointer to the ByteCount */
-static inline void *
-BCC(struct smb_hdr *smb)
-{
- return (void *)smb + sizeof(*smb) + 2 * smb->WordCount;
-}
-
-/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
-#define pByteArea(smb_var) (BCC(smb_var) + 2)
-
-/* get the unconverted ByteCount for a SMB packet and return it */
-static inline __u16
-get_bcc(struct smb_hdr *hdr)
-{
- __le16 *bc_ptr = (__le16 *)BCC(hdr);
-
- return get_unaligned_le16(bc_ptr);
-}
-
-/* set the ByteCount for a SMB packet in little-endian */
-static inline void
-put_bcc(__u16 count, struct smb_hdr *hdr)
-{
- __le16 *bc_ptr = (__le16 *)BCC(hdr);
-
- put_unaligned_le16(count, bc_ptr);
-}
-
#endif /* _CIFSPDU_H */
diff --git a/fs/smb/client/smb1proto.h b/fs/smb/client/smb1proto.h
index 916030b1d635..eaf317a53b76 100644
--- a/fs/smb/client/smb1proto.h
+++ b/fs/smb/client/smb1proto.h
@@ -8,10 +8,12 @@
#ifndef _SMB1PROTO_H
#define _SMB1PROTO_H
-#include "cifspdu.h"
+#include "../common/smb2pdu.h"
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
+#include <linux/unaligned.h>
+
struct cifs_unix_set_info_args {
__u64 ctime;
__u64 atime;
@@ -242,4 +244,36 @@ int checkSMB(char *buf, unsigned int pdu_len, unsigned int total_read,
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
+
+#define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
+#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
+
+/* given a pointer to an smb_hdr, retrieve a void pointer to the ByteCount */
+static inline void *
+BCC(struct smb_hdr *smb)
+{
+ return (void *)smb + sizeof(*smb) + 2 * smb->WordCount;
+}
+
+/* given a pointer to an smb_hdr retrieve the pointer to the byte area */
+#define pByteArea(smb_var) (BCC(smb_var) + 2)
+
+/* get the unconverted ByteCount for a SMB packet and return it */
+static inline __u16
+get_bcc(struct smb_hdr *hdr)
+{
+ __le16 *bc_ptr = (__le16 *)BCC(hdr);
+
+ return get_unaligned_le16(bc_ptr);
+}
+
+/* set the ByteCount for a SMB packet in little-endian */
+static inline void
+put_bcc(__u16 count, struct smb_hdr *hdr)
+{
+ __le16 *bc_ptr = (__le16 *)BCC(hdr);
+
+ put_unaligned_le16(count, bc_ptr);
+}
+
#endif /* _SMB1PROTO_H */
Powered by blists - more mailing lists