[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd_xwKGST7PXu9ha5wdBF_M-qoe2g52Dp9Y3-0r+aYXa-w@mail.gmail.com>
Date: Mon, 20 Oct 2025 14:35:18 +0900
From: Namjae Jeon <linkinjeon@...nel.org>
To: chenxiaosong.chenxiaosong@...ux.dev
Cc: stfrench@...rosoft.com, metze@...ba.org, pali@...nel.org,
smfrench@...il.com, sfrench@...ba.org, senozhatsky@...omium.org,
tom@...pey.com, pc@...guebit.org, ronniesahlberg@...il.com,
sprasad@...rosoft.com, bharathsm@...rosoft.com, christophe.jaillet@...adoo.fr,
linux-cifs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 15/22] smb: move FILE_SYSTEM_ATTRIBUTE_INFO to common/cifspdu.h
On Tue, Oct 14, 2025 at 4:30 PM <chenxiaosong.chenxiaosong@...ux.dev> wrote:
>
> From: ChenXiaoSong <chenxiaosong@...inos.cn>
>
> Rename "struct filesystem_attribute_info" to "FILE_SYSTEM_ATTRIBUTE_INFO",
> then move duplicate definitions to common header file.
>
> Signed-off-by: ChenXiaoSong <chenxiaosong@...inos.cn>
Please check the warnings from checkpatch.pl.
WARNING: do not add new typedefs
#109: FILE: fs/smb/common/cifspdu.h:352:
+typedef struct {
WARNING: Prefer __packed over __attribute__((packed))
#114: FILE: fs/smb/common/cifspdu.h:357:
+} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
> ---
> fs/smb/client/cifspdu.h | 7 -------
> fs/smb/common/cifspdu.h | 8 ++++++++
> fs/smb/server/smb2pdu.c | 6 +++---
> fs/smb/server/smb_common.h | 7 -------
> 4 files changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h
> index 07eb821654e1..a6f7e168961e 100644
> --- a/fs/smb/client/cifspdu.h
> +++ b/fs/smb/client/cifspdu.h
> @@ -1937,13 +1937,6 @@ typedef struct {
> /* minimum includes first three fields, and empty FS Name */
> #define MIN_FS_ATTR_INFO_SIZE 12
>
> -typedef struct {
> - __le32 Attributes;
> - __le32 MaxPathNameComponentLength;
> - __le32 FileSystemNameLen;
> - char FileSystemName[52]; /* do not have to save this - get subset? */
> -} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
> -
> /******************************************************************************/
> /* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
> /******************************************************************************/
> diff --git a/fs/smb/common/cifspdu.h b/fs/smb/common/cifspdu.h
> index 1109c20f7bf8..560900617be7 100644
> --- a/fs/smb/common/cifspdu.h
> +++ b/fs/smb/common/cifspdu.h
> @@ -348,4 +348,12 @@ typedef struct server_negotiate_rsp {
> #define FILE_CASE_PRESERVED_NAMES 0x00000002
> #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
>
> +/* See FS-FSCC 2.5.1 */
> +typedef struct {
> + __le32 Attributes;
> + __le32 MaxPathNameComponentLength;
> + __le32 FileSystemNameLen;
> + __le16 FileSystemName[]; /* do not have to save this - get subset? */
> +} __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
> +
> #endif /* _COMMON_CIFSPDU_H */
> diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
> index a46d4ddade9e..a05b04799c0d 100644
> --- a/fs/smb/server/smb2pdu.c
> +++ b/fs/smb/server/smb2pdu.c
> @@ -5485,10 +5485,10 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
> }
> case FS_ATTRIBUTE_INFORMATION:
> {
> - struct filesystem_attribute_info *info;
> + FILE_SYSTEM_ATTRIBUTE_INFO *info;
> size_t sz;
>
> - info = (struct filesystem_attribute_info *)rsp->Buffer;
> + info = (FILE_SYSTEM_ATTRIBUTE_INFO *)rsp->Buffer;
> info->Attributes = cpu_to_le32(FILE_SUPPORTS_OBJECT_IDS |
> FILE_PERSISTENT_ACLS |
> FILE_UNICODE_ON_DISK |
> @@ -5507,7 +5507,7 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
> "NTFS", PATH_MAX, conn->local_nls, 0);
> len = len * 2;
> info->FileSystemNameLen = cpu_to_le32(len);
> - sz = sizeof(struct filesystem_attribute_info) + len;
> + sz = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) + len;
> rsp->OutputBufferLength = cpu_to_le32(sz);
> break;
> }
> diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
> index a5dd656c36f1..016ec93e6df4 100644
> --- a/fs/smb/server/smb_common.h
> +++ b/fs/smb/server/smb_common.h
> @@ -56,13 +56,6 @@
> FILE_EXECUTE | FILE_DELETE_CHILD | \
> FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES)
>
> -struct filesystem_attribute_info {
> - __le32 Attributes;
> - __le32 MaxPathNameComponentLength;
> - __le32 FileSystemNameLen;
> - __le16 FileSystemName[]; /* do not have to save this - get subset? */
> -} __packed;
> -
> struct filesystem_device_info {
> __le32 DeviceType;
> __le32 DeviceCharacteristics;
> --
> 2.43.0
>
Powered by blists - more mailing lists