Re: [PATCH v5 12/14] smb: move FILE_SYSTEM_ATTRIBUTE_INFO to common/fscc.h

From: Namjae Jeon

Date: Wed Nov 12 2025 - 20:23:59 EST


On Sun, Nov 2, 2025 at 4:32 PM <chenxiaosong.chenxiaosong@xxxxxxxxx> wrote:
>
> From: ChenXiaoSong <chenxiaosong@xxxxxxxxxx>
>
> Rename "struct filesystem_attribute_info" to "FILE_SYSTEM_ATTRIBUTE_INFO",
> then move them to common header file.
>
> Calculate the minimum size of FileFsAttributeInformation using offsetof().
>
> On the server, replace original "sizeof(struct filesystem_attribute_info)"
> with "MIN_FS_ATTR_INFO_SIZE".
>
> Signed-off-by: ChenXiaoSong <chenxiaosong@xxxxxxxxxx>
> ---
> fs/smb/client/cifspdu.h | 10 ----------
> fs/smb/common/fscc.h | 14 ++++++++++++++
> fs/smb/server/smb2pdu.c | 6 +++---
> fs/smb/server/smb_common.h | 7 -------
> 4 files changed, 17 insertions(+), 20 deletions(-)
>
> diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h
> index a9a853b9011f..2c454e450dfa 100644
> --- a/fs/smb/client/cifspdu.h
> +++ b/fs/smb/client/cifspdu.h
> @@ -2063,16 +2063,6 @@ typedef struct {
> #define FILE_PORTABLE_DEVICE 0x00004000
> #define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
>
> -/* 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/fscc.h b/fs/smb/common/fscc.h
> index a0580a772a41..9d3ac9903357 100644
> --- a/fs/smb/common/fscc.h
> +++ b/fs/smb/common/fscc.h
> @@ -94,6 +94,20 @@ struct smb2_file_network_open_info {
> __le32 Reserved;
> } __packed; /* level 34 Query also similar returned in close rsp and open rsp */
>
> +/* See FS-FSCC 2.5.1 */
> +typedef struct {
> + __le32 Attributes;
> + __le32 MaxPathNameComponentLength;
> + __le32 FileSystemNameLen;
> + __le16 FileSystemName[52]; /* do not have to save this - get subset? */
Is there any reason why we can not use flex-array ?
Thanks.