From nobody Mon Feb 9 06:25:28 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BFBA347BCC for ; Mon, 22 Dec 2025 22:31:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766442706; cv=none; b=UZUzrbzh0X/94K6xRnon3TP7yk6Fvl+F/gF8XeiNbkqBm5EHeU9u3QMle9uOqLpqcaETqge5BnGBdgbPQmuTtS09BfNaK6Mhzrn4Eg6hEzB7CY1EBxtgaSPvvEPHSHgaBMXFuhYHUlgeIGySZRAWubRta4ApoqUBqr3TUlCNI7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766442706; c=relaxed/simple; bh=v6XUfqsxGfDcxih3YUwBt2ds2mBBaoPyIte4MhEPus0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hsGZs4Uvm/mopS6dqnSIWIuTf3MDEy2sfhOaT8fAM3K0t9PYCfLWEanGaKYI3WZpKxc9K+nnKxBkSB4L5iir3qsAZFDbpTuaMB8JMPX/L7n9EFqjdg+LE6hTkyrbVqk5wAdBPUZCdAUCjL8IvTbhJMS3/GXpNNbLvOI38KjwVsw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Bk7QozgZ; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bk7QozgZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766442701; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JYYMSse3oodIxM/AA0UcpSiq0y1d7sFfiQEXTbMGnVg=; b=Bk7QozgZIIbzmCX9MYPXuTUWfcLf+8Xf29ATutoWmDX11/8PgVyDA9Pr6hrevppYjKPLTi k/8LY5kakKV1uxbqde2Xwyq8uBkoRv/HclPsezSFNP5N2ybMNZ8j6tCJp+SAC9DtdGrDmL sRjrpvs3mKAAz97oylBD5mY+g6YDxB0= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-47-oZMo1kr3OEeF6vUlvDF1_A-1; Mon, 22 Dec 2025 17:31:38 -0500 X-MC-Unique: oZMo1kr3OEeF6vUlvDF1_A-1 X-Mimecast-MFC-AGG-ID: oZMo1kr3OEeF6vUlvDF1_A_1766442696 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id AE93D1956088; Mon, 22 Dec 2025 22:31:36 +0000 (UTC) Received: from warthog.procyon.org.uk.com (unknown [10.42.28.4]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E137319560AB; Mon, 22 Dec 2025 22:31:34 +0000 (UTC) From: David Howells To: Steve French Cc: David Howells , Paulo Alcantara , Enzo Matsumiya , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 27/37] cifs: SMB1 split: Move BCC access functions Date: Mon, 22 Dec 2025 22:29:52 +0000 Message-ID: <20251222223006.1075635-28-dhowells@redhat.com> In-Reply-To: <20251222223006.1075635-1-dhowells@redhat.com> References: <20251222223006.1075635-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Move the BCC access functions to smb1proto.h as they're only applicable to SMB1. Signed-off-by: David Howells cc: Steve French cc: Paulo Alcantara cc: Enzo Matsumiya cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-kernel@vger.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 =20 -#include -#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 =3D (__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 =3D (__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 =20 -#include "cifspdu.h" +#include "../common/smb2pdu.h" =20 #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY =20 +#include + 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, =20 =20 #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 =3D (__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 =3D (__le16 *)BCC(hdr); + + put_unaligned_le16(count, bc_ptr); +} + #endif /* _SMB1PROTO_H */