Re: [PATCH v3 07/22] smb: move some duplicate definitions to common/smb2pdu.h

Namjae Jeon
2025-10-20T04:52:26Z

On Tue, Oct 14, 2025 at 4:21 PM <chenxiaosong.chenxiaosong@linux.dev> wrote:
>
> From: ZhangGuoDong <zhangguodong@kylinos.cn>
>
> In order to maintain the code more easily, move duplicate definitions to
> new common header file.
>
> Co-developed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
> Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
> Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
> ---
> fs/smb/client/smb2pdu.h | 24 +++---------------------
> fs/smb/common/smb2pdu.h | 24 ++++++++++++++++++++++++
> fs/smb/server/smb2pdu.c | 8 ++++----
> fs/smb/server/smb2pdu.h | 17 -----------------
> 4 files changed, 31 insertions(+), 42 deletions(-)
>
> diff --git a/fs/smb/client/smb2pdu.h b/fs/smb/client/smb2pdu.h
> index 101024f8f725..c013560bcfa1 100644
> --- a/fs/smb/client/smb2pdu.h
> +++ b/fs/smb/client/smb2pdu.h
> @@ -135,11 +135,9 @@ struct share_redirect_error_context_rsp {
>
>
> /* See MS-SMB2 2.2.13.2.11 */
> -/* Flags */
> -#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
> struct durable_context_v2 {
> __le32 Timeout;
> - __le32 Flags;
> + __le32 Flags; /* see SMB2_DHANDLE_FLAG_PERSISTENT */
> __u64 Reserved;
> __u8 CreateGuid[16];
> } __packed;
> @@ -157,13 +155,13 @@ struct durable_reconnect_context_v2 {
> __u64 VolatileFileId;
> } Fid;
> __u8 CreateGuid[16];
> - __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
> + __le32 Flags; /* see SMB2_DHANDLE_FLAG_PERSISTENT */
> } __packed;
>
> /* See MS-SMB2 2.2.14.2.12 */
> struct durable_reconnect_context_v2_rsp {
> __le32 Timeout;
> - __le32 Flags; /* see above DHANDLE_FLAG_PERSISTENT */
> + __le32 Flags; /* see SMB2_DHANDLE_FLAG_PERSISTENT */
> } __packed;
>
> struct create_durable_handle_reconnect_v2 {
> @@ -263,22 +261,6 @@ struct network_resiliency_req {
> } __packed;
> /* There is no buffer for the response ie no struct network_resiliency_rsp */
>
> -#define RSS_CAPABLE cpu_to_le32(0x00000001)
> -#define RDMA_CAPABLE cpu_to_le32(0x00000002)
> -
> -#define INTERNETWORK cpu_to_le16(0x0002)
> -#define INTERNETWORKV6 cpu_to_le16(0x0017)
> -
> -struct network_interface_info_ioctl_rsp {
> - __le32 Next; /* next interface. zero if this is last one */
> - __le32 IfIndex;
> - __le32 Capability; /* RSS or RDMA Capable */
> - __le32 Reserved;
> - __le64 LinkSpeed;
> - __le16 Family;
> - __u8 Buffer[126];
> -} __packed;
> -
> struct iface_info_ipv4 {
> __be16 Port;
> __be32 IPv4Address;
> diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
> index f79a5165a7cc..25e8ece283c4 100644
> --- a/fs/smb/common/smb2pdu.h
> +++ b/fs/smb/common/smb2pdu.h
> @@ -1290,6 +1290,10 @@ struct create_mxac_req {
> __le64 Timestamp;
> } __packed;
>
> +/* See MS-SMB2 2.2.13.2.11 and MS-SMB2 2.2.13.2.12 and MS-SMB2 2.2.14.2.12 */
> +/* Flags */
> +#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
I prefer moving it when the durable handle structures are moved to
/common later.
Thanks.