]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cifs: SMB1 split: Move BCC access functions
authorDavid Howells <dhowells@redhat.com>
Wed, 17 Dec 2025 15:09:39 +0000 (15:09 +0000)
committerSteve French <stfrench@microsoft.com>
Sun, 8 Feb 2026 23:07:45 +0000 (17:07 -0600)
Move the BCC access functions to smb1proto.h as they're only applicable to
SMB1.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <sfrench@samba.org>
cc: Paulo Alcantara <pc@manguebit.org>
cc: Enzo Matsumiya <ematsumiya@suse.de>
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-kernel@vger.kernel.org
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifspdu.h
fs/smb/client/smb1proto.h

index de061247ecd723260a0cd7995e4d814cb6c2cf92..78512af18d964e89924260c4b766fc3723dda948 100644 (file)
@@ -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 */
index b11d13bfd2d184d8f45a94e613ac14c04a2f4a03..921c9357b4cafa737161840a8906aeacd34295fd 100644 (file)
@@ -8,7 +8,8 @@
 #ifndef _SMB1PROTO_H
 #define _SMB1PROTO_H
 
-#include "cifspdu.h"
+#include <linux/unaligned.h>
+#include "../common/smb2pdu.h"
 
 struct cifs_unix_set_info_args {
        __u64   ctime;
@@ -242,4 +243,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 */