public inbox for linux-cifs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
@ 2026-02-16  8:20 zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h zhang.guodong
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong

From: ZhangGuoDong <zhangguodong@kylinos.cn>

v2->v3:
  - Patch #01: "__u32 VolumeSerialNumber" -> "__le32 VolumeSerialNumber"
  - Patch #02: rebased on cifs-2.6.git for-next
  - Add patch #03

v1: https://lore.kernel.org/all/20251209011020.3270989-1-chenxiaosong.chenxiaosong@linux.dev/
v2: https://lore.kernel.org/linux-cifs/20251211143228.172470-1-chenxiaosong.chenxiaosong@linux.dev/
The following patches from v1 and v2 have already been merged into mainline:
  - 94d5b8dbc5d9 smb: move some SMB1 definitions into common/smb1pdu.h
  - 2b6abb893e71 smb: move File Attributes definitions into common/fscc.h
  - c97503321ed3 smb: update struct duplicate_extents_to_file_ex
  - 2e0d224d8988 smb/server: add comment to FileSystemName of FileFsAttributeInformation
  - ab0347e67dac smb/client: remove DeviceType Flags and Device Characteristics definitions
  - 08c2a7d2bae9 smb: move file_notify_information to common/fscc.h
  - 6539e18517b6 smb: move SMB2 Notify Action Flags into common/smb2pdu.h
  - 9ec7629b430a smb: move notify completion filter flags into common/smb2pdu.h
  - bcdd6cfaf2ec smb: add documentation references for smb2 change notify definitions

This is a continuous effort to move duplicated definitions in both client
and server into common header files, which makes the code easier to maintain.

The previous work is here:
  - part 1: https://lore.kernel.org/linux-cifs/20251117112838.473051-1-chenxiaosong.chenxiaosong@linux.dev/

ZhangGuoDong (5):
  smb: move smb3_fs_vol_info into common/fscc.h
  smb: move some definitions from common/smb2pdu.h into common/fscc.h
  smb: move file_basic_info into common/fscc.h
  smb: introduce struct create_posix_ctxt_rsp
  smb: introduce struct file_posix_info

 fs/smb/client/inode.c      |  22 +--
 fs/smb/client/readdir.c    |  28 +--
 fs/smb/client/reparse.h    |   4 +-
 fs/smb/client/smb1pdu.h    |   9 -
 fs/smb/client/smb2pdu.c    |   9 +-
 fs/smb/client/smb2pdu.h    |  21 +-
 fs/smb/common/fscc.h       | 379 ++++++++++++++++++++++++++++++++++++-
 fs/smb/common/smb2pdu.h    | 360 ++---------------------------------
 fs/smb/server/oplock.c     |   8 +-
 fs/smb/server/smb2pdu.c    |  98 +++++-----
 fs/smb/server/smb2pdu.h    |  36 +---
 fs/smb/server/smb_common.h |   8 -
 12 files changed, 486 insertions(+), 496 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
@ 2026-02-16  8:20 ` zhang.guodong
  2026-02-16 16:05   ` kernel test robot
  2026-02-16  8:20 ` [PATCH v3 2/5] smb: move some definitions from common/smb2pdu.h " zhang.guodong
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong, Steve French

From: ZhangGuoDong <zhangguodong@kylinos.cn>

The structure definition on the server side is specified in MS-CIFS
2.2.8.2.3, but we should instead refer to MS-FSCC 2.5.9, just as the
client side does.

Modify the following places:

  - filesystem_vol_info -> smb3_fs_vol_info
  - SerialNumber -> VolumeSerialNumber
  - VolumeLabelSize -> VolumeLabelLength

Then move it into common header file.

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/common/fscc.h       | 11 +++++++++++
 fs/smb/common/smb2pdu.h    | 11 -----------
 fs/smb/server/smb2pdu.c    | 10 +++++-----
 fs/smb/server/smb_common.h |  8 --------
 4 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index 0123f34db1e8..d2e00eba1a98 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -138,6 +138,17 @@ typedef struct {
 	__le32 BytesPerSector;
 } __packed FILE_SYSTEM_SIZE_INFO;	/* size info, level 0x103 */
 
+/* volume info struct - see MS-FSCC 2.5.9 */
+#define MAX_VOL_LABEL_LEN	32
+struct smb3_fs_vol_info {
+	__le64	VolumeCreationTime;
+	__le32	VolumeSerialNumber;
+	__le32	VolumeLabelLength; /* includes trailing null */
+	__u8	SupportsObjects; /* True if eg like NTFS, supports objects */
+	__u8	Reserved;
+	__u8	VolumeLabel[]; /* variable len */
+} __packed;
+
 /* See MS-FSCC 2.5.10 */
 typedef struct {
 	__le32 DeviceType;
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index e482c86ceb00..69dd7c792804 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1942,17 +1942,6 @@ struct smb2_fs_control_info {
 	__le32 Padding;
 } __packed;
 
-/* volume info struct - see MS-FSCC 2.5.9 */
-#define MAX_VOL_LABEL_LEN	32
-struct smb3_fs_vol_info {
-	__le64	VolumeCreationTime;
-	__u32	VolumeSerialNumber;
-	__le32	VolumeLabelLength; /* includes trailing null */
-	__u8	SupportsObjects; /* True if eg like NTFS, supports objects */
-	__u8	Reserved;
-	__u8	VolumeLabel[]; /* variable len */
-} __packed;
-
 /* See MS-SMB2 2.2.23 through 2.2.25 */
 struct smb2_oplock_break {
 	struct smb2_hdr hdr;
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index cbb31efdbaa2..966a499d2eb8 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -5531,11 +5531,11 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 	}
 	case FS_VOLUME_INFORMATION:
 	{
-		struct filesystem_vol_info *info;
+		struct smb3_fs_vol_info *info;
 		size_t sz;
 		unsigned int serial_crc = 0;
 
-		info = (struct filesystem_vol_info *)(rsp->Buffer);
+		info = (struct smb3_fs_vol_info *)(rsp->Buffer);
 		info->VolumeCreationTime = 0;
 		serial_crc = crc32_le(serial_crc, share->name,
 				      strlen(share->name));
@@ -5544,14 +5544,14 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
 		serial_crc = crc32_le(serial_crc, ksmbd_netbios_name(),
 				      strlen(ksmbd_netbios_name()));
 		/* Taking dummy value of serial number*/
-		info->SerialNumber = cpu_to_le32(serial_crc);
+		info->VolumeSerialNumber = cpu_to_le32(serial_crc);
 		len = smbConvertToUTF16((__le16 *)info->VolumeLabel,
 					share->name, PATH_MAX,
 					conn->local_nls, 0);
 		len = len * 2;
-		info->VolumeLabelSize = cpu_to_le32(len);
+		info->VolumeLabelLength = cpu_to_le32(len);
 		info->Reserved = 0;
-		sz = sizeof(struct filesystem_vol_info) + len;
+		sz = sizeof(struct smb3_fs_vol_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 ca7e3610d074..b090b56743c4 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -90,14 +90,6 @@ struct smb_negotiate_rsp {
 	__le16 ByteCount;
 } __packed;
 
-struct filesystem_vol_info {
-	__le64 VolumeCreationTime;
-	__le32 SerialNumber;
-	__le32 VolumeLabelSize;
-	__le16 Reserved;
-	__le16 VolumeLabel[];
-} __packed;
-
 #define EXTENDED_INFO_MAGIC 0x43667364	/* Cfsd */
 #define STRING_LENGTH 28
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 2/5] smb: move some definitions from common/smb2pdu.h into common/fscc.h
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h zhang.guodong
@ 2026-02-16  8:20 ` zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 3/5] smb: move file_basic_info " zhang.guodong
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong, Steve French

From: ZhangGuoDong <zhangguodong@kylinos.cn>

These definitions are specified in MS-FSCC, so move them into fscc.h.

Only add some documentation references, no other changes.

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Reviewed-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/common/fscc.h    | 315 ++++++++++++++++++++++++++++++++++++++++
 fs/smb/common/smb2pdu.h | 307 ---------------------------------------
 2 files changed, 315 insertions(+), 307 deletions(-)

diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index d2e00eba1a98..b209d818e95e 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -12,6 +12,210 @@
 #ifndef _COMMON_SMB_FSCC_H
 #define _COMMON_SMB_FSCC_H
 
+/* Reparse structures - see MS-FSCC 2.1.2 */
+
+/* struct fsctl_reparse_info_req is empty, only response structs (see below) */
+struct reparse_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__u8	DataBuffer[]; /* Variable Length */
+} __packed;
+
+struct reparse_guid_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__u8	ReparseGuid[16];
+	__u8	DataBuffer[]; /* Variable Length */
+} __packed;
+
+struct reparse_mount_point_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__le16	SubstituteNameOffset;
+	__le16	SubstituteNameLength;
+	__le16	PrintNameOffset;
+	__le16	PrintNameLength;
+	__u8	PathBuffer[]; /* Variable Length */
+} __packed;
+
+#define SYMLINK_FLAG_RELATIVE 0x00000001
+
+struct reparse_symlink_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__le16	SubstituteNameOffset;
+	__le16	SubstituteNameLength;
+	__le16	PrintNameOffset;
+	__le16	PrintNameLength;
+	__le32	Flags;
+	__u8	PathBuffer[]; /* Variable Length */
+} __packed;
+
+/* For IO_REPARSE_TAG_NFS - see MS-FSCC 2.1.2.6 */
+#define NFS_SPECFILE_LNK	0x00000000014B4E4C
+#define NFS_SPECFILE_CHR	0x0000000000524843
+#define NFS_SPECFILE_BLK	0x00000000004B4C42
+#define NFS_SPECFILE_FIFO	0x000000004F464946
+#define NFS_SPECFILE_SOCK	0x000000004B434F53
+struct reparse_nfs_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__le64	InodeType; /* NFS_SPECFILE_* */
+	__u8	DataBuffer[];
+} __packed;
+
+/* For IO_REPARSE_TAG_LX_SYMLINK - see MS-FSCC 2.1.2.7 */
+struct reparse_wsl_symlink_data_buffer {
+	__le32	ReparseTag;
+	__le16	ReparseDataLength;
+	__u16	Reserved;
+	__le32	Version; /* Always 2 */
+	__u8	Target[]; /* Variable Length UTF-8 string without nul-term */
+} __packed;
+
+/* See MS-FSCC 2.3.7 */
+struct duplicate_extents_to_file {
+	__u64 PersistentFileHandle; /* source file handle, opaque endianness */
+	__u64 VolatileFileHandle;
+	__le64 SourceFileOffset;
+	__le64 TargetFileOffset;
+	__le64 ByteCount;  /* Bytes to be copied */
+} __packed;
+
+/* See MS-FSCC 2.3.9 */
+#define DUPLICATE_EXTENTS_DATA_EX_SOURCE_ATOMIC	0x00000001
+struct duplicate_extents_to_file_ex {
+	__le64 StructureSize; /* MUST be set to 0x30 */
+	__u64 PersistentFileHandle; /* source file handle, opaque endianness */
+	__u64 VolatileFileHandle;
+	__le64 SourceFileOffset;
+	__le64 TargetFileOffset;
+	__le64 ByteCount;  /* Bytes to be copied */
+	__le32 Flags;
+	__le32 Reserved;
+} __packed;
+
+/* See MS-FSCC 2.3.20 */
+struct fsctl_get_integrity_information_rsp {
+	__le16	ChecksumAlgorithm;
+	__le16	Reserved;
+	__le32	Flags;
+	__le32	ChecksumChunkSizeInBytes;
+	__le32	ClusterSizeInBytes;
+} __packed;
+
+/* See MS-FSCC 2.3.52 */
+struct file_allocated_range_buffer {
+	__le64	file_offset;
+	__le64	length;
+} __packed;
+
+/* See MS-FSCC 2.3.55 */
+struct fsctl_query_file_regions_req {
+	__le64	FileOffset;
+	__le64	Length;
+	__le32	DesiredUsage;
+	__le32	Reserved;
+} __packed;
+
+/* DesiredUsage flags see MS-FSCC 2.3.56.1 */
+#define FILE_USAGE_INVALID_RANGE	0x00000000
+#define FILE_USAGE_VALID_CACHED_DATA	0x00000001
+#define FILE_USAGE_NONCACHED_DATA	0x00000002
+struct file_region_info {
+	__le64	FileOffset;
+	__le64	Length;
+	__le32	DesiredUsage;
+	__le32	Reserved;
+} __packed;
+
+/* See MS-FSCC 2.3.56 */
+struct fsctl_query_file_region_rsp {
+	__le32 Flags;
+	__le32 TotalRegionEntryCount;
+	__le32 RegionEntryCount;
+	__u32  Reserved;
+	struct  file_region_info Regions[];
+} __packed;
+
+/* See MS-FSCC 2.3.58 */
+struct fsctl_query_on_disk_vol_info_rsp {
+	__le64	DirectoryCount;
+	__le64	FileCount;
+	__le16	FsFormatMajVersion;
+	__le16	FsFormatMinVersion;
+	__u8	FsFormatName[24];
+	__le64	FormatTime;
+	__le64	LastUpdateTime;
+	__u8	CopyrightInfo[68];
+	__u8	AbstractInfo[68];
+	__u8	FormatImplInfo[68];
+	__u8	LastModifyImplInfo[68];
+} __packed;
+
+/* See MS-FSCC 2.3.73 */
+struct fsctl_set_integrity_information_req {
+	__le16	ChecksumAlgorithm;
+	__le16	Reserved;
+	__le32	Flags;
+} __packed;
+
+/* See MS-FSCC 2.3.75 */
+struct fsctl_set_integrity_info_ex_req {
+	__u8	EnableIntegrity;
+	__u8	KeepState;
+	__u16	Reserved;
+	__le32	Flags;
+	__u8	Version;
+	__u8	Reserved2[7];
+} __packed;
+
+/*
+ * this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA
+ * See MS-FSCC 2.3.85
+ */
+struct file_zero_data_information {
+	__le64	FileOffset;
+	__le64	BeyondFinalZero;
+} __packed;
+
+/*
+ * This level 18, although with struct with same name is different from cifs
+ * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
+ * CurrentByteOffset.
+ * See MS-FSCC 2.4.2
+ */
+struct smb2_file_all_info { /* data block encoding of response to level 18 */
+	__le64 CreationTime;	/* Beginning of FILE_BASIC_INFO equivalent */
+	__le64 LastAccessTime;
+	__le64 LastWriteTime;
+	__le64 ChangeTime;
+	__le32 Attributes;
+	__u32  Pad1;		/* End of FILE_BASIC_INFO_INFO equivalent */
+	__le64 AllocationSize;	/* Beginning of FILE_STANDARD_INFO equivalent */
+	__le64 EndOfFile;	/* size ie offset to first free byte in file */
+	__le32 NumberOfLinks;	/* hard links */
+	__u8   DeletePending;
+	__u8   Directory;
+	__u16  Pad2;		/* End of FILE_STANDARD_INFO equivalent */
+	__le64 IndexNumber;
+	__le32 EASize;
+	__le32 AccessFlags;
+	__le64 CurrentByteOffset;
+	__le32 Mode;
+	__le32 AlignmentRequirement;
+	__le32 FileNameLength;
+	union {
+		char __pad;	/* Legacy structure padding */
+		DECLARE_FLEX_ARRAY(char, FileName);
+	};
+} __packed; /* level 18 Query */
+
 /* See MS-FSCC 2.4.8 */
 typedef struct {
 	__le32 NextEntryOffset;
@@ -46,6 +250,11 @@ typedef struct {
 	char FileName[];
 } __packed FILE_DIRECTORY_INFO;   /* level 0x101 FF resp data */
 
+/* See MS-FSCC 2.4.13 */
+struct smb2_file_eof_info { /* encoding of request for level 10 */
+	__le64 EndOfFile; /* new end of file value */
+} __packed; /* level 20 Set */
+
 /* See MS-FSCC 2.4.14 */
 typedef struct {
 	__le32 NextEntryOffset;
@@ -80,6 +289,26 @@ typedef struct {
 	char FileName[];
 } __packed FILE_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
 
+/* See MS-FSCC 2.4.27 */
+struct smb2_file_internal_info {
+	__le64 IndexNumber;
+} __packed; /* level 6 Query */
+
+/* See MS-FSCC 2.4.28.2 */
+struct smb2_file_link_info { /* encoding of request for level 11 */
+	/* New members MUST be added within the struct_group() macro below. */
+	__struct_group(smb2_file_link_info_hdr, __hdr, __packed,
+		__u8   ReplaceIfExists; /* 1 = replace existing link with new */
+					/* 0 = fail if link already exists */
+		__u8   Reserved[7];
+		__u64  RootDirectory;  /* MBZ for network operations (why says spec?) */
+		__le32 FileNameLength;
+	);
+	char   FileName[];     /* Name to be assigned to new link */
+} __packed; /* level 11 Set */
+static_assert(offsetof(struct smb2_file_link_info, FileName) == sizeof(struct smb2_file_link_info_hdr),
+	      "struct member likely outside of __struct_group()");
+
 /* See MS-FSCC 2.4.34 */
 struct smb2_file_network_open_info {
 	struct_group_attr(network_open_info, __packed,
@@ -94,6 +323,37 @@ struct smb2_file_network_open_info {
 	__le32 Reserved;
 } __packed; /* level 34 Query also similar returned in close rsp and open rsp */
 
+/* See MS-FSCC 2.4.42.2 */
+struct smb2_file_rename_info { /* encoding of request for level 10 */
+	/* New members MUST be added within the struct_group() macro below. */
+	__struct_group(smb2_file_rename_info_hdr, __hdr, __packed,
+		__u8   ReplaceIfExists; /* 1 = replace existing target with new */
+					/* 0 = fail if target already exists */
+		__u8   Reserved[7];
+		__u64  RootDirectory;  /* MBZ for network operations (why says spec?) */
+		__le32 FileNameLength;
+	);
+	char   FileName[];     /* New name to be assigned */
+	/* padding - overall struct size must be >= 24 so filename + pad >= 6 */
+} __packed; /* level 10 Set */
+static_assert(offsetof(struct smb2_file_rename_info, FileName) == sizeof(struct smb2_file_rename_info_hdr),
+	      "struct member likely outside of __struct_group()");
+
+/* File System Information Classes */
+/* See MS-FSCC 2.5 */
+#define FS_VOLUME_INFORMATION		1 /* Query */
+#define FS_LABEL_INFORMATION		2 /* Set */
+#define FS_SIZE_INFORMATION		3 /* Query */
+#define FS_DEVICE_INFORMATION		4 /* Query */
+#define FS_ATTRIBUTE_INFORMATION	5 /* Query */
+#define FS_CONTROL_INFORMATION		6 /* Query, Set */
+#define FS_FULL_SIZE_INFORMATION	7 /* Query */
+#define FS_OBJECT_ID_INFORMATION	8 /* Query, Set */
+#define FS_DRIVER_PATH_INFORMATION	9 /* Query */
+#define FS_SECTOR_SIZE_INFORMATION	11 /* SMB3 or later. Query */
+/* See POSIX Extensions to MS-FSCC 2.3.1.1 */
+#define FS_POSIX_INFORMATION		100 /* SMB3.1.1 POSIX. Query */
+
 /* See MS-FSCC 2.5.1 */
 #define MAX_FS_NAME_LEN		52
 typedef struct {
@@ -130,6 +390,45 @@ typedef struct {
 #define FILE_CASE_PRESERVED_NAMES	0x00000002
 #define FILE_CASE_SENSITIVE_SEARCH	0x00000001
 
+/*
+ * File System Control Information
+ * See MS-FSCC 2.5.2
+ */
+struct smb2_fs_control_info {
+	__le64 FreeSpaceStartFiltering;
+	__le64 FreeSpaceThreshold;
+	__le64 FreeSpaceStopFiltering;
+	__le64 DefaultQuotaThreshold;
+	__le64 DefaultQuotaLimit;
+	__le32 FileSystemControlFlags;
+	__le32 Padding;
+} __packed;
+
+/* See MS-FSCC 2.5.4 */
+struct smb2_fs_full_size_info {
+	__le64 TotalAllocationUnits;
+	__le64 CallerAvailableAllocationUnits;
+	__le64 ActualAvailableAllocationUnits;
+	__le32 SectorsPerAllocationUnit;
+	__le32 BytesPerSector;
+} __packed;
+
+/* See MS-FSCC 2.5.7 */
+#define SSINFO_FLAGS_ALIGNED_DEVICE		0x00000001
+#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
+#define SSINFO_FLAGS_NO_SEEK_PENALTY		0x00000004
+#define SSINFO_FLAGS_TRIM_ENABLED		0x00000008
+/* sector size info struct */
+struct smb3_fs_ss_info {
+	__le32 LogicalBytesPerSector;
+	__le32 PhysicalBytesPerSectorForAtomicity;
+	__le32 PhysicalBytesPerSectorForPerf;
+	__le32 FSEffPhysicalBytesPerSectorForAtomicity;
+	__le32 Flags;
+	__le32 ByteOffsetForSectorAlignment;
+	__le32 ByteOffsetForPartitionAlignment;
+} __packed;
+
 /* See MS-FSCC 2.5.8 */
 typedef struct {
 	__le64 TotalAllocationUnits;
@@ -200,6 +499,22 @@ typedef struct {
 #define FILE_ATTRIBUTE_NO_SCRUB_DATA_LE		cpu_to_le32(FILE_ATTRIBUTE_NO_SCRUB_DATA)
 #define FILE_ATTRIBUTE_MASK_LE			cpu_to_le32(FILE_ATTRIBUTE_MASK)
 
+/*
+ * SMB2 Notify Action Flags
+ * See MS-FSCC 2.7.1
+ */
+#define FILE_ACTION_ADDED                       0x00000001
+#define FILE_ACTION_REMOVED                     0x00000002
+#define FILE_ACTION_MODIFIED                    0x00000003
+#define FILE_ACTION_RENAMED_OLD_NAME            0x00000004
+#define FILE_ACTION_RENAMED_NEW_NAME            0x00000005
+#define FILE_ACTION_ADDED_STREAM                0x00000006
+#define FILE_ACTION_REMOVED_STREAM              0x00000007
+#define FILE_ACTION_MODIFIED_STREAM             0x00000008
+#define FILE_ACTION_REMOVED_BY_DELETE           0x00000009
+#define FILE_ACTION_ID_NOT_TUNNELLED            0x0000000A
+#define FILE_ACTION_TUNNELLED_ID_COLLISION      0x0000000B
+
 /*
  * Response contains array of the following structures
  * See MS-FSCC 2.7.1
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index 69dd7c792804..85a4248d4f29 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1006,22 +1006,6 @@ struct smb2_set_info_rsp {
 #define FILE_NOTIFY_CHANGE_STREAM_SIZE		0x00000400
 #define FILE_NOTIFY_CHANGE_STREAM_WRITE		0x00000800
 
-/*
- * SMB2 Notify Action Flags
- * See MS-FSCC 2.7.1
- */
-#define FILE_ACTION_ADDED                       0x00000001
-#define FILE_ACTION_REMOVED                     0x00000002
-#define FILE_ACTION_MODIFIED                    0x00000003
-#define FILE_ACTION_RENAMED_OLD_NAME            0x00000004
-#define FILE_ACTION_RENAMED_NEW_NAME            0x00000005
-#define FILE_ACTION_ADDED_STREAM                0x00000006
-#define FILE_ACTION_REMOVED_STREAM              0x00000007
-#define FILE_ACTION_MODIFIED_STREAM             0x00000008
-#define FILE_ACTION_REMOVED_BY_DELETE           0x00000009
-#define FILE_ACTION_ID_NOT_TUNNELLED            0x0000000A
-#define FILE_ACTION_TUNNELLED_ID_COLLISION      0x0000000B
-
 /* See MS-SMB2 2.2.35 */
 struct smb2_change_notify_req {
 	struct smb2_hdr hdr;
@@ -1499,105 +1483,6 @@ struct network_interface_info_ioctl_rsp {
 	};
 } __packed;
 
-/* this goes in the ioctl buffer when doing FSCTL_SET_ZERO_DATA */
-struct file_zero_data_information {
-	__le64	FileOffset;
-	__le64	BeyondFinalZero;
-} __packed;
-
-/* See MS-FSCC 2.3.7 */
-struct duplicate_extents_to_file {
-	__u64 PersistentFileHandle; /* source file handle, opaque endianness */
-	__u64 VolatileFileHandle;
-	__le64 SourceFileOffset;
-	__le64 TargetFileOffset;
-	__le64 ByteCount;  /* Bytes to be copied */
-} __packed;
-
-/* See MS-FSCC 2.3.9 */
-#define DUPLICATE_EXTENTS_DATA_EX_SOURCE_ATOMIC	0x00000001
-struct duplicate_extents_to_file_ex {
-	__le64 StructureSize; /* MUST be set to 0x30 */
-	__u64 PersistentFileHandle; /* source file handle, opaque endianness */
-	__u64 VolatileFileHandle;
-	__le64 SourceFileOffset;
-	__le64 TargetFileOffset;
-	__le64 ByteCount;  /* Bytes to be copied */
-	__le32 Flags;
-	__le32 Reserved;
-} __packed;
-
-
-/* See MS-FSCC 2.3.20 */
-struct fsctl_get_integrity_information_rsp {
-	__le16	ChecksumAlgorithm;
-	__le16	Reserved;
-	__le32	Flags;
-	__le32	ChecksumChunkSizeInBytes;
-	__le32	ClusterSizeInBytes;
-} __packed;
-
-/* See MS-FSCC 2.3.55 */
-struct fsctl_query_file_regions_req {
-	__le64	FileOffset;
-	__le64	Length;
-	__le32	DesiredUsage;
-	__le32	Reserved;
-} __packed;
-
-/* DesiredUsage flags see MS-FSCC 2.3.56.1 */
-#define FILE_USAGE_INVALID_RANGE	0x00000000
-#define FILE_USAGE_VALID_CACHED_DATA	0x00000001
-#define FILE_USAGE_NONCACHED_DATA	0x00000002
-
-struct file_region_info {
-	__le64	FileOffset;
-	__le64	Length;
-	__le32	DesiredUsage;
-	__le32	Reserved;
-} __packed;
-
-/* See MS-FSCC 2.3.56 */
-struct fsctl_query_file_region_rsp {
-	__le32 Flags;
-	__le32 TotalRegionEntryCount;
-	__le32 RegionEntryCount;
-	__u32  Reserved;
-	struct  file_region_info Regions[];
-} __packed;
-
-/* See MS-FSCC 2.3.58 */
-struct fsctl_query_on_disk_vol_info_rsp {
-	__le64	DirectoryCount;
-	__le64	FileCount;
-	__le16	FsFormatMajVersion;
-	__le16	FsFormatMinVersion;
-	__u8	FsFormatName[24];
-	__le64	FormatTime;
-	__le64	LastUpdateTime;
-	__u8	CopyrightInfo[68];
-	__u8	AbstractInfo[68];
-	__u8	FormatImplInfo[68];
-	__u8	LastModifyImplInfo[68];
-} __packed;
-
-/* See MS-FSCC 2.3.73 */
-struct fsctl_set_integrity_information_req {
-	__le16	ChecksumAlgorithm;
-	__le16	Reserved;
-	__le32	Flags;
-} __packed;
-
-/* See MS-FSCC 2.3.75 */
-struct fsctl_set_integrity_info_ex_req {
-	__u8	EnableIntegrity;
-	__u8	KeepState;
-	__u16	Reserved;
-	__le32	Flags;
-	__u8	Version;
-	__u8	Reserved2[7];
-} __packed;
-
 /* Integrity ChecksumAlgorithm choices for above */
 #define	CHECKSUM_TYPE_NONE	0x0000
 #define	CHECKSUM_TYPE_CRC64	0x0002
@@ -1606,72 +1491,6 @@ struct fsctl_set_integrity_info_ex_req {
 /* Integrity flags for above */
 #define FSCTL_INTEGRITY_FLAG_CHECKSUM_ENFORCEMENT_OFF	0x00000001
 
-/* Reparse structures - see MS-FSCC 2.1.2 */
-
-/* struct fsctl_reparse_info_req is empty, only response structs (see below) */
-struct reparse_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__u8	DataBuffer[]; /* Variable Length */
-} __packed;
-
-struct reparse_guid_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__u8	ReparseGuid[16];
-	__u8	DataBuffer[]; /* Variable Length */
-} __packed;
-
-struct reparse_mount_point_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__le16	SubstituteNameOffset;
-	__le16	SubstituteNameLength;
-	__le16	PrintNameOffset;
-	__le16	PrintNameLength;
-	__u8	PathBuffer[]; /* Variable Length */
-} __packed;
-
-#define SYMLINK_FLAG_RELATIVE 0x00000001
-
-struct reparse_symlink_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__le16	SubstituteNameOffset;
-	__le16	SubstituteNameLength;
-	__le16	PrintNameOffset;
-	__le16	PrintNameLength;
-	__le32	Flags;
-	__u8	PathBuffer[]; /* Variable Length */
-} __packed;
-
-/* For IO_REPARSE_TAG_NFS - see MS-FSCC 2.1.2.6 */
-#define NFS_SPECFILE_LNK	0x00000000014B4E4C
-#define NFS_SPECFILE_CHR	0x0000000000524843
-#define NFS_SPECFILE_BLK	0x00000000004B4C42
-#define NFS_SPECFILE_FIFO	0x000000004F464946
-#define NFS_SPECFILE_SOCK	0x000000004B434F53
-struct reparse_nfs_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__le64	InodeType; /* NFS_SPECFILE_* */
-	__u8	DataBuffer[];
-} __packed;
-
-/* For IO_REPARSE_TAG_LX_SYMLINK - see MS-FSCC 2.1.2.7 */
-struct reparse_wsl_symlink_data_buffer {
-	__le32	ReparseTag;
-	__le16	ReparseDataLength;
-	__u16	Reserved;
-	__le32	Version; /* Always 2 */
-	__u8	Target[]; /* Variable Length UTF-8 string without nul-term */
-} __packed;
-
 struct validate_negotiate_info_req {
 	__le32 Capabilities;
 	__u8   Guid[SMB2_CLIENT_GUID_SIZE];
@@ -1791,84 +1610,6 @@ struct smb2_query_info_rsp {
 	__u8   Buffer[];
 } __packed;
 
-/*
- *	PDU query infolevel structure definitions
- */
-
-/* See MS-FSCC 2.3.52 */
-struct file_allocated_range_buffer {
-	__le64	file_offset;
-	__le64	length;
-} __packed;
-
-struct smb2_file_internal_info {
-	__le64 IndexNumber;
-} __packed; /* level 6 Query */
-
-struct smb2_file_rename_info { /* encoding of request for level 10 */
-	/* New members MUST be added within the struct_group() macro below. */
-	__struct_group(smb2_file_rename_info_hdr, __hdr, __packed,
-		__u8   ReplaceIfExists; /* 1 = replace existing target with new */
-					/* 0 = fail if target already exists */
-		__u8   Reserved[7];
-		__u64  RootDirectory;  /* MBZ for network operations (why says spec?) */
-		__le32 FileNameLength;
-	);
-	char   FileName[];     /* New name to be assigned */
-	/* padding - overall struct size must be >= 24 so filename + pad >= 6 */
-} __packed; /* level 10 Set */
-static_assert(offsetof(struct smb2_file_rename_info, FileName) == sizeof(struct smb2_file_rename_info_hdr),
-	      "struct member likely outside of __struct_group()");
-
-struct smb2_file_link_info { /* encoding of request for level 11 */
-	/* New members MUST be added within the struct_group() macro below. */
-	__struct_group(smb2_file_link_info_hdr, __hdr, __packed,
-		__u8   ReplaceIfExists; /* 1 = replace existing link with new */
-					/* 0 = fail if link already exists */
-		__u8   Reserved[7];
-		__u64  RootDirectory;  /* MBZ for network operations (why says spec?) */
-		__le32 FileNameLength;
-	);
-	char   FileName[];     /* Name to be assigned to new link */
-} __packed; /* level 11 Set */
-static_assert(offsetof(struct smb2_file_link_info, FileName) == sizeof(struct smb2_file_link_info_hdr),
-	      "struct member likely outside of __struct_group()");
-
-/*
- * This level 18, although with struct with same name is different from cifs
- * level 0x107. Level 0x107 has an extra u64 between AccessFlags and
- * CurrentByteOffset.
- */
-struct smb2_file_all_info { /* data block encoding of response to level 18 */
-	__le64 CreationTime;	/* Beginning of FILE_BASIC_INFO equivalent */
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le32 Attributes;
-	__u32  Pad1;		/* End of FILE_BASIC_INFO_INFO equivalent */
-	__le64 AllocationSize;	/* Beginning of FILE_STANDARD_INFO equivalent */
-	__le64 EndOfFile;	/* size ie offset to first free byte in file */
-	__le32 NumberOfLinks;	/* hard links */
-	__u8   DeletePending;
-	__u8   Directory;
-	__u16  Pad2;		/* End of FILE_STANDARD_INFO equivalent */
-	__le64 IndexNumber;
-	__le32 EASize;
-	__le32 AccessFlags;
-	__le64 CurrentByteOffset;
-	__le32 Mode;
-	__le32 AlignmentRequirement;
-	__le32 FileNameLength;
-	union {
-		char __pad;	/* Legacy structure padding */
-		DECLARE_FLEX_ARRAY(char, FileName);
-	};
-} __packed; /* level 18 Query */
-
-struct smb2_file_eof_info { /* encoding of request for level 10 */
-	__le64 EndOfFile; /* new end of file value */
-} __packed; /* level 20 Set */
-
 /* Level 100 query info */
 struct smb311_posix_qinfo {
 	__le64 CreationTime;
@@ -1894,54 +1635,6 @@ struct smb311_posix_qinfo {
 	 */
 } __packed;
 
-/* File System Information Classes */
-#define FS_VOLUME_INFORMATION		1 /* Query */
-#define FS_LABEL_INFORMATION		2 /* Set */
-#define FS_SIZE_INFORMATION		3 /* Query */
-#define FS_DEVICE_INFORMATION		4 /* Query */
-#define FS_ATTRIBUTE_INFORMATION	5 /* Query */
-#define FS_CONTROL_INFORMATION		6 /* Query, Set */
-#define FS_FULL_SIZE_INFORMATION	7 /* Query */
-#define FS_OBJECT_ID_INFORMATION	8 /* Query, Set */
-#define FS_DRIVER_PATH_INFORMATION	9 /* Query */
-#define FS_SECTOR_SIZE_INFORMATION	11 /* SMB3 or later. Query */
-#define FS_POSIX_INFORMATION		100 /* SMB3.1.1 POSIX. Query */
-
-struct smb2_fs_full_size_info {
-	__le64 TotalAllocationUnits;
-	__le64 CallerAvailableAllocationUnits;
-	__le64 ActualAvailableAllocationUnits;
-	__le32 SectorsPerAllocationUnit;
-	__le32 BytesPerSector;
-} __packed;
-
-#define SSINFO_FLAGS_ALIGNED_DEVICE		0x00000001
-#define SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE 0x00000002
-#define SSINFO_FLAGS_NO_SEEK_PENALTY		0x00000004
-#define SSINFO_FLAGS_TRIM_ENABLED		0x00000008
-
-/* sector size info struct */
-struct smb3_fs_ss_info {
-	__le32 LogicalBytesPerSector;
-	__le32 PhysicalBytesPerSectorForAtomicity;
-	__le32 PhysicalBytesPerSectorForPerf;
-	__le32 FSEffPhysicalBytesPerSectorForAtomicity;
-	__le32 Flags;
-	__le32 ByteOffsetForSectorAlignment;
-	__le32 ByteOffsetForPartitionAlignment;
-} __packed;
-
-/* File System Control Information */
-struct smb2_fs_control_info {
-	__le64 FreeSpaceStartFiltering;
-	__le64 FreeSpaceThreshold;
-	__le64 FreeSpaceStopFiltering;
-	__le64 DefaultQuotaThreshold;
-	__le64 DefaultQuotaLimit;
-	__le32 FileSystemControlFlags;
-	__le32 Padding;
-} __packed;
-
 /* See MS-SMB2 2.2.23 through 2.2.25 */
 struct smb2_oplock_break {
 	struct smb2_hdr hdr;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 3/5] smb: move file_basic_info into common/fscc.h
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 2/5] smb: move some definitions from common/smb2pdu.h " zhang.guodong
@ 2026-02-16  8:20 ` zhang.guodong
  2026-02-16  8:20 ` [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp zhang.guodong
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong

From: ZhangGuoDong <zhangguodong@kylinos.cn>

This struct definition is specified in MS-FSCC, so move them into fscc.h.

Modify the following places:

  - smb2_file_basic_info -> file_basic_info
  - Pad1 -> Pad

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
 fs/smb/client/smb1pdu.h |  9 ---------
 fs/smb/common/fscc.h    | 10 ++++++++++
 fs/smb/server/smb2pdu.c | 14 +++++++-------
 fs/smb/server/smb2pdu.h |  9 ---------
 4 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/fs/smb/client/smb1pdu.h b/fs/smb/client/smb1pdu.h
index 97f7e1244a8b..7584e94d9b2b 100644
--- a/fs/smb/client/smb1pdu.h
+++ b/fs/smb/client/smb1pdu.h
@@ -2061,15 +2061,6 @@ typedef struct {
 	__le32 EASize;
 } __packed FILE_INFO_STANDARD;  /* level 1 SetPath/FileInfo */
 
-typedef struct {
-	__le64 CreationTime;
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le32 Attributes;
-	__u32 Pad;
-} __packed FILE_BASIC_INFO;	/* size info, level 0x101 */
-
 struct file_allocation_info {
 	__le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
 } __packed; /* size used on disk, for level 0x103 for set, 0x105 for query */
diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index b209d818e95e..716864b173fd 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -216,6 +216,16 @@ struct smb2_file_all_info { /* data block encoding of response to level 18 */
 	};
 } __packed; /* level 18 Query */
 
+/* See MS-FSCC 2.4.7 */
+typedef struct file_basic_info { /* data block encoding of response to level 18 */
+	__le64 CreationTime;
+	__le64 LastAccessTime;
+	__le64 LastWriteTime;
+	__le64 ChangeTime;
+	__le32 Attributes;
+	__u32  Pad;
+} __packed FILE_BASIC_INFO;	/* size info, level 0x101 */
+
 /* See MS-FSCC 2.4.8 */
 typedef struct {
 	__le32 NextEntryOffset;
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index 966a499d2eb8..eb2129ab7156 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4838,7 +4838,7 @@ static void get_file_access_info(struct smb2_query_info_rsp *rsp,
 static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
 			       struct ksmbd_file *fp, void *rsp_org)
 {
-	struct smb2_file_basic_info *basic_info;
+	struct file_basic_info *basic_info;
 	struct kstat stat;
 	u64 time;
 	int ret;
@@ -4854,7 +4854,7 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
 	if (ret)
 		return ret;
 
-	basic_info = (struct smb2_file_basic_info *)rsp->Buffer;
+	basic_info = (struct file_basic_info *)rsp->Buffer;
 	basic_info->CreationTime = cpu_to_le64(fp->create_time);
 	time = ksmbd_UnixTimeToNT(stat.atime);
 	basic_info->LastAccessTime = cpu_to_le64(time);
@@ -4863,9 +4863,9 @@ static int get_file_basic_info(struct smb2_query_info_rsp *rsp,
 	time = ksmbd_UnixTimeToNT(stat.ctime);
 	basic_info->ChangeTime = cpu_to_le64(time);
 	basic_info->Attributes = fp->f_ci->m_fattr;
-	basic_info->Pad1 = 0;
+	basic_info->Pad = 0;
 	rsp->OutputBufferLength =
-		cpu_to_le32(sizeof(struct smb2_file_basic_info));
+		cpu_to_le32(sizeof(struct file_basic_info));
 	return 0;
 }
 
@@ -6136,7 +6136,7 @@ static int smb2_create_link(struct ksmbd_work *work,
 }
 
 static int set_file_basic_info(struct ksmbd_file *fp,
-			       struct smb2_file_basic_info *file_info,
+			       struct file_basic_info *file_info,
 			       struct ksmbd_share_config *share)
 {
 	struct iattr attrs;
@@ -6418,10 +6418,10 @@ static int smb2_set_info_file(struct ksmbd_work *work, struct ksmbd_file *fp,
 	switch (req->FileInfoClass) {
 	case FILE_BASIC_INFORMATION:
 	{
-		if (buf_len < sizeof(struct smb2_file_basic_info))
+		if (buf_len < sizeof(struct file_basic_info))
 			return -EMSGSIZE;
 
-		return set_file_basic_info(fp, (struct smb2_file_basic_info *)buffer, share);
+		return set_file_basic_info(fp, (struct file_basic_info *)buffer, share);
 	}
 	case FILE_ALLOCATION_INFORMATION:
 	{
diff --git a/fs/smb/server/smb2pdu.h b/fs/smb/server/smb2pdu.h
index 257c6d26df26..9b3c4c9acb11 100644
--- a/fs/smb/server/smb2pdu.h
+++ b/fs/smb/server/smb2pdu.h
@@ -183,15 +183,6 @@ struct smb2_file_alignment_info {
 	__le32 AlignmentRequirement;
 } __packed;
 
-struct smb2_file_basic_info { /* data block encoding of response to level 18 */
-	__le64 CreationTime;	/* Beginning of FILE_BASIC_INFO equivalent */
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le32 Attributes;
-	__u32  Pad1;		/* End of FILE_BASIC_INFO_INFO equivalent */
-} __packed;
-
 struct smb2_file_alt_name_info {
 	__le32 FileNameLength;
 	char FileName[];
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
                   ` (2 preceding siblings ...)
  2026-02-16  8:20 ` [PATCH v3 3/5] smb: move file_basic_info " zhang.guodong
@ 2026-02-16  8:20 ` zhang.guodong
  2026-02-16 18:22   ` kernel test robot
  2026-02-16  8:20 ` [PATCH v3 5/5] smb: introduce struct file_posix_info zhang.guodong
  2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
  5 siblings, 1 reply; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong

From: ZhangGuoDong <zhangguodong@kylinos.cn>

Modify the following places:

  - introduce new struct create_posix_ctxt_rsp
  - some fields in "struct create_posix_rsp" -> "struct create_posix_ctxt_rsp"
  - create_posix_rsp_buf(): offsetof(..., nlink) -> offsetof(..., ctxt_rsp)

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
---
 fs/smb/client/smb2pdu.c |  9 +++++----
 fs/smb/client/smb2pdu.h |  6 ++----
 fs/smb/common/smb2pdu.h | 17 +++++++++++++++++
 fs/smb/server/oplock.c  |  8 ++++----
 fs/smb/server/smb2pdu.h |  6 ++----
 5 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 7f3edf42b9c3..f8825160355d 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2362,9 +2362,9 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
 
 	memset(posix, 0, sizeof(*posix));
 
-	posix->nlink = le32_to_cpu(*(__le32 *)(beg + 0));
-	posix->reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
-	posix->mode = le32_to_cpu(*(__le32 *)(beg + 8));
+	posix->ctxt_rsp.nlink = le32_to_cpu(*(__le32 *)(beg + 0));
+	posix->ctxt_rsp.reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
+	posix->ctxt_rsp.mode = le32_to_cpu(*(__le32 *)(beg + 8));
 
 	sid = beg + 12;
 	sid_len = posix_info_sid_size(sid, end);
@@ -2383,7 +2383,8 @@ parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
 	memcpy(&posix->group, sid, sid_len);
 
 	cifs_dbg(FYI, "nlink=%d mode=%o reparse_tag=%x\n",
-		 posix->nlink, posix->mode, posix->reparse_tag);
+		 posix->ctxt_rsp.nlink, posix->ctxt_rsp.mode,
+		 posix->ctxt_rsp.reparse_tag);
 }
 
 int smb2_parse_contexts(struct TCP_Server_Info *server,
diff --git a/fs/smb/client/smb2pdu.h b/fs/smb/client/smb2pdu.h
index 78bb99f29d38..4928fb620233 100644
--- a/fs/smb/client/smb2pdu.h
+++ b/fs/smb/client/smb2pdu.h
@@ -251,11 +251,9 @@ struct smb2_file_id_extd_directory_info {
 
 extern char smb2_padding[7];
 
-/* equivalent of the contents of SMB3.1.1 POSIX open context response */
+/* See POSIX-SMB2 2.2.14.2.16 */
 struct create_posix_rsp {
-	u32 nlink;
-	u32 reparse_tag;
-	u32 mode;
+	struct create_posix_ctxt_rsp ctxt_rsp;
 	struct smb_sid owner; /* var-sized on the wire */
 	struct smb_sid group; /* var-sized on the wire */
 } __packed;
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index 85a4248d4f29..5dd4ab245453 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1775,4 +1775,21 @@ struct smb2_lease_ack {
 #define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \
 				| READ_CONTROL | SYNCHRONIZE)
 
+/*
+ * [POSIX-SMB2] SMB3 POSIX Extensions
+ * Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/smb3_posix_extensions.md
+ */
+
+/*
+ * SMB2_CREATE_POSIX_CONTEXT Response
+ * See POSIX-SMB2 2.2.14.2.16
+ */
+struct create_posix_ctxt_rsp {
+	__le32 nlink;
+	__le32 reparse_tag;
+	__le32 mode;
+	// var sized owner SID
+	// var sized group SID
+} __packed;
+
 #endif				/* _COMMON_SMB2PDU_H */
diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
index a5967ac46604..171758ed94b2 100644
--- a/fs/smb/server/oplock.c
+++ b/fs/smb/server/oplock.c
@@ -1703,7 +1703,7 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
 	buf = (struct create_posix_rsp *)cc;
 	memset(buf, 0, sizeof(struct create_posix_rsp));
 	buf->ccontext.DataOffset = cpu_to_le16(offsetof
-			(struct create_posix_rsp, nlink));
+			(struct create_posix_rsp, ctxt_rsp));
 	/*
 	 * DataLength = nlink(4) + reparse_tag(4) + mode(4) +
 	 * domain sid(28) + unix group sid(16).
@@ -1730,9 +1730,9 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
 	buf->Name[14] = 0xCD;
 	buf->Name[15] = 0x7C;
 
-	buf->nlink = cpu_to_le32(inode->i_nlink);
-	buf->reparse_tag = cpu_to_le32(fp->volatile_id);
-	buf->mode = cpu_to_le32(inode->i_mode & 0777);
+	buf->ctxt_rsp.nlink = cpu_to_le32(inode->i_nlink);
+	buf->ctxt_rsp.reparse_tag = cpu_to_le32(fp->volatile_id);
+	buf->ctxt_rsp.mode = cpu_to_le32(inode->i_mode & 0777);
 	/*
 	 * SidBuffer(44) contain two sids(Domain sid(28), UNIX group sid(16)).
 	 * Domain sid(28) = revision(1) + num_subauth(1) + authority(6) +
diff --git a/fs/smb/server/smb2pdu.h b/fs/smb/server/smb2pdu.h
index 9b3c4c9acb11..dc6a81c64fd5 100644
--- a/fs/smb/server/smb2pdu.h
+++ b/fs/smb/server/smb2pdu.h
@@ -83,13 +83,11 @@ struct create_durable_rsp {
 	} Data;
 } __packed;
 
-/* equivalent of the contents of SMB3.1.1 POSIX open context response */
+/* See POSIX-SMB2 2.2.14.2.16 */
 struct create_posix_rsp {
 	struct create_context_hdr ccontext;
 	__u8    Name[16];
-	__le32 nlink;
-	__le32 reparse_tag;
-	__le32 mode;
+	struct create_posix_ctxt_rsp ctxt_rsp;
 	/* SidBuffer contain two sids(Domain sid(28), UNIX group sid(16)) */
 	u8 SidBuffer[44];
 } __packed;
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v3 5/5] smb: introduce struct file_posix_info
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
                   ` (3 preceding siblings ...)
  2026-02-16  8:20 ` [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp zhang.guodong
@ 2026-02-16  8:20 ` zhang.guodong
  2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
  5 siblings, 0 replies; 17+ messages in thread
From: zhang.guodong @ 2026-02-16  8:20 UTC (permalink / raw)
  To: smfrench, linkinjeon, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong
  Cc: linux-cifs, ZhangGuoDong

From: ZhangGuoDong <zhangguodong@kylinos.cn>

Modify the following places:

  - introduce new struct file_posix_info
  - some fields in "struct smb311_posix_qinfo" -> "struct file_posix_info"
  - some fields in "struct smb2_posix_info" -> "struct file_posix_info"

Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
---
 fs/smb/client/inode.c   | 22 ++++++------
 fs/smb/client/readdir.c | 28 ++++++++--------
 fs/smb/client/reparse.h |  4 +--
 fs/smb/client/smb2pdu.h | 15 +--------
 fs/smb/common/fscc.h    | 43 +++++++++++++++++++++++-
 fs/smb/common/smb2pdu.h | 25 --------------
 fs/smb/server/smb2pdu.c | 74 ++++++++++++++++++++---------------------
 fs/smb/server/smb2pdu.h | 21 +-----------
 8 files changed, 108 insertions(+), 124 deletions(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index c23c057162e6..b183db7bbb52 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -840,16 +840,16 @@ static void smb311_posix_info_to_fattr(struct cifs_fattr *fattr,
 	memset(fattr, 0, sizeof(*fattr));
 
 	/* no fattr->flags to set */
-	fattr->cf_cifsattrs = le32_to_cpu(info->DosAttributes);
-	fattr->cf_uniqueid = le64_to_cpu(info->Inode);
+	fattr->cf_cifsattrs = le32_to_cpu(info->fpinfo.DosAttributes);
+	fattr->cf_uniqueid = le64_to_cpu(info->fpinfo.Inode);
 
-	if (info->LastAccessTime)
-		fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
+	if (info->fpinfo.LastAccessTime)
+		fattr->cf_atime = cifs_NTtimeToUnix(info->fpinfo.LastAccessTime);
 	else
 		ktime_get_coarse_real_ts64(&fattr->cf_atime);
 
-	fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime);
-	fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
+	fattr->cf_ctime = cifs_NTtimeToUnix(info->fpinfo.ChangeTime);
+	fattr->cf_mtime = cifs_NTtimeToUnix(info->fpinfo.LastWriteTime);
 
 	if (data->adjust_tz) {
 		fattr->cf_ctime.tv_sec += tcon->ses->server->timeAdj;
@@ -860,11 +860,11 @@ static void smb311_posix_info_to_fattr(struct cifs_fattr *fattr,
 	 * The srv fs device id is overridden on network mount so setting
 	 * @fattr->cf_rdev isn't needed here.
 	 */
-	fattr->cf_eof = le64_to_cpu(info->EndOfFile);
-	fattr->cf_bytes = le64_to_cpu(info->AllocationSize);
-	fattr->cf_createtime = le64_to_cpu(info->CreationTime);
-	fattr->cf_nlink = le32_to_cpu(info->HardLinks);
-	fattr->cf_mode = wire_mode_to_posix(le32_to_cpu(info->Mode),
+	fattr->cf_eof = le64_to_cpu(info->fpinfo.EndOfFile);
+	fattr->cf_bytes = le64_to_cpu(info->fpinfo.AllocationSize);
+	fattr->cf_createtime = le64_to_cpu(info->fpinfo.CreationTime);
+	fattr->cf_nlink = le32_to_cpu(info->fpinfo.HardLinks);
+	fattr->cf_mode = wire_mode_to_posix(le32_to_cpu(info->fpinfo.Mode),
 					    fattr->cf_cifsattrs & ATTR_DIRECTORY);
 
 	if (cifs_open_data_reparse(data) &&
diff --git a/fs/smb/client/readdir.c b/fs/smb/client/readdir.c
index 67a8555efa1e..29dfaffaa5bb 100644
--- a/fs/smb/client/readdir.c
+++ b/fs/smb/client/readdir.c
@@ -246,22 +246,22 @@ cifs_posix_to_fattr(struct cifs_fattr *fattr, struct smb2_posix_info *info,
 	posix_info_parse(info, NULL, &parsed);
 
 	memset(fattr, 0, sizeof(*fattr));
-	fattr->cf_uniqueid = le64_to_cpu(info->Inode);
-	fattr->cf_bytes = le64_to_cpu(info->AllocationSize);
-	fattr->cf_eof = le64_to_cpu(info->EndOfFile);
+	fattr->cf_uniqueid = le64_to_cpu(info->fpinfo.Inode);
+	fattr->cf_bytes = le64_to_cpu(info->fpinfo.AllocationSize);
+	fattr->cf_eof = le64_to_cpu(info->fpinfo.EndOfFile);
 
-	fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime);
-	fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime);
-	fattr->cf_ctime = cifs_NTtimeToUnix(info->CreationTime);
+	fattr->cf_atime = cifs_NTtimeToUnix(info->fpinfo.LastAccessTime);
+	fattr->cf_mtime = cifs_NTtimeToUnix(info->fpinfo.LastWriteTime);
+	fattr->cf_ctime = cifs_NTtimeToUnix(info->fpinfo.CreationTime);
 
-	fattr->cf_nlink = le32_to_cpu(info->HardLinks);
-	fattr->cf_cifsattrs = le32_to_cpu(info->DosAttributes);
+	fattr->cf_nlink = le32_to_cpu(info->fpinfo.HardLinks);
+	fattr->cf_cifsattrs = le32_to_cpu(info->fpinfo.DosAttributes);
 
 	if (fattr->cf_cifsattrs & ATTR_REPARSE_POINT)
-		fattr->cf_cifstag = le32_to_cpu(info->ReparseTag);
+		fattr->cf_cifstag = le32_to_cpu(info->fpinfo.ReparseTag);
 
 	/* The Mode field in the response can now include the file type as well */
-	fattr->cf_mode = wire_mode_to_posix(le32_to_cpu(info->Mode),
+	fattr->cf_mode = wire_mode_to_posix(le32_to_cpu(info->fpinfo.Mode),
 					    fattr->cf_cifsattrs & ATTR_DIRECTORY);
 	fattr->cf_dtype = S_DT(fattr->cf_mode);
 
@@ -276,9 +276,9 @@ cifs_posix_to_fattr(struct cifs_fattr *fattr, struct smb2_posix_info *info,
 	}
 
 	cifs_dbg(FYI, "posix fattr: dev %d, reparse %d, mode %o\n",
-		 le32_to_cpu(info->DeviceId),
-		 le32_to_cpu(info->ReparseTag),
-		 le32_to_cpu(info->Mode));
+		 le32_to_cpu(info->fpinfo.DeviceId),
+		 le32_to_cpu(info->fpinfo.ReparseTag),
+		 le32_to_cpu(info->fpinfo.Mode));
 
 	sid_to_id(cifs_sb, &parsed.owner, fattr, SIDOWNER);
 	sid_to_id(cifs_sb, &parsed.group, fattr, SIDGROUP);
@@ -515,7 +515,7 @@ static void cifs_fill_dirent_posix(struct cifs_dirent *de,
 	de->name = parsed.name;
 	de->namelen = parsed.name_len;
 	de->resume_key = info->Ignored;
-	de->ino = le64_to_cpu(info->Inode);
+	de->ino = le64_to_cpu(info->fpinfo.Inode);
 }
 
 static void cifs_fill_dirent_unix(struct cifs_dirent *de,
diff --git a/fs/smb/client/reparse.h b/fs/smb/client/reparse.h
index 570b0d25aeba..410ee9133aea 100644
--- a/fs/smb/client/reparse.h
+++ b/fs/smb/client/reparse.h
@@ -106,10 +106,10 @@ static inline bool cifs_open_data_reparse(struct cifs_open_info_data *data)
 	if (data->contains_posix_file_info) {
 		struct smb311_posix_qinfo *fi = &data->posix_fi;
 
-		attrs = le32_to_cpu(fi->DosAttributes);
+		attrs = le32_to_cpu(fi->fpinfo.DosAttributes);
 		if (data->reparse_point) {
 			attrs |= ATTR_REPARSE_POINT;
-			fi->DosAttributes = cpu_to_le32(attrs);
+			fi->fpinfo.DosAttributes = cpu_to_le32(attrs);
 		}
 
 	} else {
diff --git a/fs/smb/client/smb2pdu.h b/fs/smb/client/smb2pdu.h
index 4928fb620233..07ba081750fb 100644
--- a/fs/smb/client/smb2pdu.h
+++ b/fs/smb/client/smb2pdu.h
@@ -269,20 +269,7 @@ struct create_posix_rsp {
 struct smb2_posix_info {
 	__le32 NextEntryOffset;
 	__u32 Ignored;
-	__le64 CreationTime;
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le64 EndOfFile;
-	__le64 AllocationSize;
-	__le32 DosAttributes;
-	__le64 Inode;
-	__le32 DeviceId;
-	__le32 Zero;
-	/* beginning of POSIX Create Context Response */
-	__le32 HardLinks;
-	__le32 ReparseTag;
-	__le32 Mode;
+	struct file_posix_info fpinfo;
 	/*
 	 * var sized owner SID
 	 * var sized group SID
diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index 716864b173fd..117bdc73e2a6 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -537,9 +537,50 @@ struct file_notify_information {
 } __packed;
 
 /*
- * See POSIX Extensions to MS-FSCC 2.3.2.1
+ * [POSIX-FSCC] POSIX Extensions to MS-FSCC
  * Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/fscc_posix_extensions.md
  */
+
+/*
+ * This information class is used to query file posix information.
+ * See POSIX-FSCC 2.3.1.1
+ */
+struct file_posix_info {
+	__le64 CreationTime;
+	__le64 LastAccessTime;
+	__le64 LastWriteTime;
+	__le64 ChangeTime;
+	__le64 EndOfFile;
+	__le64 AllocationSize;
+	__le32 DosAttributes;
+	__le64 Inode;
+	__le32 DeviceId;
+	__le32 Zero;
+	/*
+	 * beginning of POSIX Create Context Response
+	 * See POSIX-SMB2 2.2.14.2.16
+	 */
+	__le32 HardLinks;
+	__le32 ReparseTag;
+	__le32 Mode;
+	// var sized owner SID
+	// var sized group SID
+	/* end of POSIX Create Context Response */
+	// le32 filenamelength
+	// u8 filename[]
+} __packed;
+
+/* Level 100 query info */
+struct smb311_posix_qinfo {
+	struct file_posix_info fpinfo;
+	u8     Sids[];
+	/*
+	 * le32 filenamelength
+	 * u8  filename[]
+	 */
+} __packed;
+
+/* See POSIX-FSCC 2.3.2.1 */
 typedef struct {
 	/* For undefined recommended transfer size return -1 in that field */
 	__le32 OptimalTransferSize;  /* bsize on some os, iosize on other os */
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index 5dd4ab245453..f78dbf00a545 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1610,31 +1610,6 @@ struct smb2_query_info_rsp {
 	__u8   Buffer[];
 } __packed;
 
-/* Level 100 query info */
-struct smb311_posix_qinfo {
-	__le64 CreationTime;
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le64 EndOfFile;
-	__le64 AllocationSize;
-	__le32 DosAttributes;
-	__le64 Inode;
-	__le32 DeviceId;
-	__le32 Zero;
-	/* beginning of POSIX Create Context Response */
-	__le32 HardLinks;
-	__le32 ReparseTag;
-	__le32 Mode;
-	u8     Sids[];
-	/*
-	 * var sized owner SID
-	 * var sized group SID
-	 * le32 filenamelength
-	 * u8  filename[]
-	 */
-} __packed;
-
 /* See MS-SMB2 2.2.23 through 2.2.25 */
 struct smb2_oplock_break {
 	struct smb2_hdr hdr;
diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
index eb2129ab7156..1b372363cbf7 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -4051,44 +4051,44 @@ static int smb2_populate_readdir_entry(struct ksmbd_conn *conn, int info_level,
 
 		posix_info = (struct smb2_posix_info *)kstat;
 		posix_info->Ignored = 0;
-		posix_info->CreationTime = cpu_to_le64(ksmbd_kstat->create_time);
+		posix_info->fpinfo.CreationTime = cpu_to_le64(ksmbd_kstat->create_time);
 		time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->ctime);
-		posix_info->ChangeTime = cpu_to_le64(time);
+		posix_info->fpinfo.ChangeTime = cpu_to_le64(time);
 		time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->atime);
-		posix_info->LastAccessTime = cpu_to_le64(time);
+		posix_info->fpinfo.LastAccessTime = cpu_to_le64(time);
 		time = ksmbd_UnixTimeToNT(ksmbd_kstat->kstat->mtime);
-		posix_info->LastWriteTime = cpu_to_le64(time);
-		posix_info->EndOfFile = cpu_to_le64(ksmbd_kstat->kstat->size);
-		posix_info->AllocationSize = cpu_to_le64(ksmbd_kstat->kstat->blocks << 9);
-		posix_info->DeviceId = cpu_to_le32(ksmbd_kstat->kstat->rdev);
-		posix_info->HardLinks = cpu_to_le32(ksmbd_kstat->kstat->nlink);
-		posix_info->Mode = cpu_to_le32(ksmbd_kstat->kstat->mode & 0777);
+		posix_info->fpinfo.LastWriteTime = cpu_to_le64(time);
+		posix_info->fpinfo.EndOfFile = cpu_to_le64(ksmbd_kstat->kstat->size);
+		posix_info->fpinfo.AllocationSize = cpu_to_le64(ksmbd_kstat->kstat->blocks << 9);
+		posix_info->fpinfo.DeviceId = cpu_to_le32(ksmbd_kstat->kstat->rdev);
+		posix_info->fpinfo.HardLinks = cpu_to_le32(ksmbd_kstat->kstat->nlink);
+		posix_info->fpinfo.Mode = cpu_to_le32(ksmbd_kstat->kstat->mode & 0777);
 		switch (ksmbd_kstat->kstat->mode & S_IFMT) {
 		case S_IFDIR:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_DIR << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_DIR << POSIX_FILETYPE_SHIFT);
 			break;
 		case S_IFLNK:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_SYMLINK << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_SYMLINK << POSIX_FILETYPE_SHIFT);
 			break;
 		case S_IFCHR:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_CHARDEV << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_CHARDEV << POSIX_FILETYPE_SHIFT);
 			break;
 		case S_IFBLK:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_BLKDEV << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_BLKDEV << POSIX_FILETYPE_SHIFT);
 			break;
 		case S_IFIFO:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_FIFO << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_FIFO << POSIX_FILETYPE_SHIFT);
 			break;
 		case S_IFSOCK:
-			posix_info->Mode |= cpu_to_le32(POSIX_TYPE_SOCKET << POSIX_FILETYPE_SHIFT);
+			posix_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_SOCKET << POSIX_FILETYPE_SHIFT);
 		}
 
-		posix_info->Inode = cpu_to_le64(ksmbd_kstat->kstat->ino);
-		posix_info->DosAttributes =
+		posix_info->fpinfo.Inode = cpu_to_le64(ksmbd_kstat->kstat->ino);
+		posix_info->fpinfo.DosAttributes =
 			S_ISDIR(ksmbd_kstat->kstat->mode) ?
 				FILE_ATTRIBUTE_DIRECTORY_LE : FILE_ATTRIBUTE_ARCHIVE_LE;
 		if (d_info->hide_dot_file && d_info->name[0] == '.')
-			posix_info->DosAttributes |= FILE_ATTRIBUTE_HIDDEN_LE;
+			posix_info->fpinfo.DosAttributes |= FILE_ATTRIBUTE_HIDDEN_LE;
 		/*
 		 * SidBuffer(32) contain two sids(Domain sid(16), UNIX group sid(16)).
 		 * UNIX sid(16) = revision(1) + num_subauth(1) + authority(6) +
@@ -5276,45 +5276,45 @@ static int find_file_posix_info(struct smb2_query_info_rsp *rsp,
 		return ret;
 
 	file_info = (struct smb311_posix_qinfo *)rsp->Buffer;
-	file_info->CreationTime = cpu_to_le64(fp->create_time);
+	file_info->fpinfo.CreationTime = cpu_to_le64(fp->create_time);
 	time = ksmbd_UnixTimeToNT(stat.atime);
-	file_info->LastAccessTime = cpu_to_le64(time);
+	file_info->fpinfo.LastAccessTime = cpu_to_le64(time);
 	time = ksmbd_UnixTimeToNT(stat.mtime);
-	file_info->LastWriteTime = cpu_to_le64(time);
+	file_info->fpinfo.LastWriteTime = cpu_to_le64(time);
 	time = ksmbd_UnixTimeToNT(stat.ctime);
-	file_info->ChangeTime = cpu_to_le64(time);
-	file_info->DosAttributes = fp->f_ci->m_fattr;
-	file_info->Inode = cpu_to_le64(stat.ino);
+	file_info->fpinfo.ChangeTime = cpu_to_le64(time);
+	file_info->fpinfo.DosAttributes = fp->f_ci->m_fattr;
+	file_info->fpinfo.Inode = cpu_to_le64(stat.ino);
 	if (ksmbd_stream_fd(fp) == false) {
-		file_info->EndOfFile = cpu_to_le64(stat.size);
-		file_info->AllocationSize = cpu_to_le64(stat.blocks << 9);
+		file_info->fpinfo.EndOfFile = cpu_to_le64(stat.size);
+		file_info->fpinfo.AllocationSize = cpu_to_le64(stat.blocks << 9);
 	} else {
-		file_info->EndOfFile = cpu_to_le64(fp->stream.size);
-		file_info->AllocationSize = cpu_to_le64(fp->stream.size);
+		file_info->fpinfo.EndOfFile = cpu_to_le64(fp->stream.size);
+		file_info->fpinfo.AllocationSize = cpu_to_le64(fp->stream.size);
 	}
-	file_info->HardLinks = cpu_to_le32(stat.nlink);
-	file_info->Mode = cpu_to_le32(stat.mode & 0777);
+	file_info->fpinfo.HardLinks = cpu_to_le32(stat.nlink);
+	file_info->fpinfo.Mode = cpu_to_le32(stat.mode & 0777);
 	switch (stat.mode & S_IFMT) {
 	case S_IFDIR:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_DIR << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_DIR << POSIX_FILETYPE_SHIFT);
 		break;
 	case S_IFLNK:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_SYMLINK << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_SYMLINK << POSIX_FILETYPE_SHIFT);
 		break;
 	case S_IFCHR:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_CHARDEV << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_CHARDEV << POSIX_FILETYPE_SHIFT);
 		break;
 	case S_IFBLK:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_BLKDEV << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_BLKDEV << POSIX_FILETYPE_SHIFT);
 		break;
 	case S_IFIFO:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_FIFO << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_FIFO << POSIX_FILETYPE_SHIFT);
 		break;
 	case S_IFSOCK:
-		file_info->Mode |= cpu_to_le32(POSIX_TYPE_SOCKET << POSIX_FILETYPE_SHIFT);
+		file_info->fpinfo.Mode |= cpu_to_le32(POSIX_TYPE_SOCKET << POSIX_FILETYPE_SHIFT);
 	}
 
-	file_info->DeviceId = cpu_to_le32(stat.rdev);
+	file_info->fpinfo.DeviceId = cpu_to_le32(stat.rdev);
 
 	/*
 	 * Sids(32) contain two sids(Domain sid(16), UNIX group sid(16)).
diff --git a/fs/smb/server/smb2pdu.h b/fs/smb/server/smb2pdu.h
index dc6a81c64fd5..1eec48607666 100644
--- a/fs/smb/server/smb2pdu.h
+++ b/fs/smb/server/smb2pdu.h
@@ -276,30 +276,11 @@ struct create_sd_buf_req {
 struct smb2_posix_info {
 	__le32 NextEntryOffset;
 	__u32 Ignored;
-	__le64 CreationTime;
-	__le64 LastAccessTime;
-	__le64 LastWriteTime;
-	__le64 ChangeTime;
-	__le64 EndOfFile;
-	__le64 AllocationSize;
-	__le32 DosAttributes;
-	__le64 Inode;
-	__le32 DeviceId;
-	__le32 Zero;
-	/* beginning of POSIX Create Context Response */
-	__le32 HardLinks;
-	__le32 ReparseTag;
-	__le32 Mode;
+	struct file_posix_info fpinfo;
 	/* SidBuffer contain two sids (UNIX user sid(16), UNIX group sid(16)) */
 	u8 SidBuffer[32];
 	__le32 name_len;
 	u8 name[];
-	/*
-	 * var sized owner SID
-	 * var sized group SID
-	 * le32 filenamelength
-	 * u8  filename[]
-	 */
 } __packed;
 
 /* functions */
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h
  2026-02-16  8:20 ` [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h zhang.guodong
@ 2026-02-16 16:05   ` kernel test robot
  0 siblings, 0 replies; 17+ messages in thread
From: kernel test robot @ 2026-02-16 16:05 UTC (permalink / raw)
  To: zhang.guodong, smfrench, linkinjeon, pc, ronniesahlberg, sprasad,
	tom, bharathsm, senozhatsky, dhowells, chenxiaosong,
	chenxiaosong.chenxiaosong
  Cc: oe-kbuild-all, linux-cifs, ZhangGuoDong, Steve French

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on brauner-vfs/vfs.all linus/master v6.19 next-20260213]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/zhang-guodong-linux-dev/smb-move-smb3_fs_vol_info-into-common-fscc-h/20260216-162407
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
patch link:    https://lore.kernel.org/r/20260216082018.156695-2-zhang.guodong%40linux.dev
patch subject: [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h
config: i386-randconfig-r123-20260216 (https://download.01.org/0day-ci/archive/20260216/202602162321.pMV2aDap-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260216/202602162321.pMV2aDap-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602162321.pMV2aDap-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/smb/client/smb2pdu.c:6230:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] vol_serial_number @@     got restricted __le32 [usertype] VolumeSerialNumber @@
   fs/smb/client/smb2pdu.c:6230:41: sparse:     expected unsigned int [usertype] vol_serial_number
   fs/smb/client/smb2pdu.c:6230:41: sparse:     got restricted __le32 [usertype] VolumeSerialNumber

vim +6230 fs/smb/client/smb2pdu.c

2d304217832ea7 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6140  
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6141  int
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6142  SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6143  	      u64 persistent_fid, u64 volatile_fid, int level)
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6144  {
40eff45b5dc7df fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-12  6145  	struct smb_rqst rqst;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6146  	struct smb2_query_info_rsp *rsp = NULL;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6147  	struct kvec iov;
da502f7df03d2d fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-25  6148  	struct kvec rsp_iov;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6149  	int rc = 0;
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6150  	int resp_buftype, max_len, min_len;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6151  	struct cifs_ses *ses = tcon->ses;
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6152  	struct TCP_Server_Info *server;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6153  	unsigned int rsp_len, offset;
7fb8986e7449d0 fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-31  6154  	int flags = 0;
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6155  	int retries = 0, cur_sleep = 0;
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6156  
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6157  replay_again:
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6158  	/* reinitialize for possible replay */
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6159  	flags = 0;
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6160  	server = cifs_pick_channel(ses);
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6161  
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6162  	if (level == FS_DEVICE_INFORMATION) {
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6163  		max_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6164  		min_len = sizeof(FILE_SYSTEM_DEVICE_INFO);
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6165  	} else if (level == FS_ATTRIBUTE_INFORMATION) {
c4a2a49f7df481 fs/smb/client/smb2pdu.c ChenXiaoSong    2025-11-17  6166  		max_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO) + MAX_FS_NAME_LEN;
c4a2a49f7df481 fs/smb/client/smb2pdu.c ChenXiaoSong    2025-11-17  6167  		min_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO);
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6168  	} else if (level == FS_SECTOR_SIZE_INFORMATION) {
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6169  		max_len = sizeof(struct smb3_fs_ss_info);
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6170  		min_len = sizeof(struct smb3_fs_ss_info);
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6171  	} else if (level == FS_VOLUME_INFORMATION) {
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6172  		max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN;
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6173  		min_len = sizeof(struct smb3_fs_vol_info);
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6174  	} else {
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6175  		cifs_dbg(FYI, "Invalid qfsinfo level %d\n", level);
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6176  		return -EINVAL;
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6177  	}
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6178  
352d96f3acc6e0 fs/cifs/smb2pdu.c       Aurelien Aptel  2020-05-31  6179  	rc = build_qfs_info_req(&iov, tcon, server,
352d96f3acc6e0 fs/cifs/smb2pdu.c       Aurelien Aptel  2020-05-31  6180  				level, max_len,
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6181  				persistent_fid, volatile_fid);
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6182  	if (rc)
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6183  		return rc;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6184  
5a77e75fedce55 fs/cifs/smb2pdu.c       Steve French    2018-05-09  6185  	if (smb3_encryption_required(tcon))
7fb8986e7449d0 fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-31  6186  		flags |= CIFS_TRANSFORM_REQ;
7fb8986e7449d0 fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-31  6187  
40eff45b5dc7df fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-12  6188  	memset(&rqst, 0, sizeof(struct smb_rqst));
40eff45b5dc7df fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-12  6189  	rqst.rq_iov = &iov;
40eff45b5dc7df fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-12  6190  	rqst.rq_nvec = 1;
40eff45b5dc7df fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-12  6191  
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6192  	if (retries) {
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6193  		/* Back-off before retry */
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6194  		if (cur_sleep)
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6195  			msleep(cur_sleep);
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6196  		smb2_set_replay(server, &rqst);
16d480ed4990ed fs/smb/client/smb2pdu.c Shyam Prasad N  2026-01-31  6197  	}
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6198  
352d96f3acc6e0 fs/cifs/smb2pdu.c       Aurelien Aptel  2020-05-31  6199  	rc = cifs_send_recv(xid, ses, server,
352d96f3acc6e0 fs/cifs/smb2pdu.c       Aurelien Aptel  2020-05-31  6200  			    &rqst, &resp_buftype, flags, &rsp_iov);
33eae65c6f4977 fs/smb/client/smb2pdu.c Paulo Alcantara 2023-12-13  6201  	free_qfs_info_req(&iov);
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6202  	if (rc) {
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6203  		cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6204  		goto qfsattr_exit;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6205  	}
da502f7df03d2d fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-25  6206  	rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base;
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6207  
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6208  	rsp_len = le32_to_cpu(rsp->OutputBufferLength);
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6209  	offset = le16_to_cpu(rsp->OutputBufferOffset);
730928c8f4be88 fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-08-08  6210  	rc = smb2_validate_iov(offset, rsp_len, &rsp_iov, min_len);
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6211  	if (rc)
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6212  		goto qfsattr_exit;
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6213  
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6214  	if (level == FS_ATTRIBUTE_INFORMATION)
1fc6ad2f10ad6f fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-01  6215  		memcpy(&tcon->fsAttrInfo, offset
49f466bdbdf395 fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-01  6216  			+ (char *)rsp, min_t(unsigned int,
c4a2a49f7df481 fs/smb/client/smb2pdu.c ChenXiaoSong    2025-11-17  6217  			rsp_len, min_len));
2167114c6ea6e7 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6218  	else if (level == FS_DEVICE_INFORMATION)
1fc6ad2f10ad6f fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-01  6219  		memcpy(&tcon->fsDevInfo, offset
49f466bdbdf395 fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-01  6220  			+ (char *)rsp, sizeof(FILE_SYSTEM_DEVICE_INFO));
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6221  	else if (level == FS_SECTOR_SIZE_INFORMATION) {
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6222  		struct smb3_fs_ss_info *ss_info = (struct smb3_fs_ss_info *)
1fc6ad2f10ad6f fs/cifs/smb2pdu.c       Ronnie Sahlberg 2018-06-01  6223  			(offset + (char *)rsp);
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6224  		tcon->ss_flags = le32_to_cpu(ss_info->Flags);
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6225  		tcon->perf_sector_size =
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6226  			le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf);
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6227  	} else if (level == FS_VOLUME_INFORMATION) {
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6228  		struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *)
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6229  			(offset + (char *)rsp);
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24 @6230  		tcon->vol_serial_number = vol_info->VolumeSerialNumber;
21ba3845b59c73 fs/cifs/smb2pdu.c       Steve French    2018-06-24  6231  		tcon->vol_create_time = vol_info->VolumeCreationTime;
af6a12ea8d4bb3 fs/cifs/smb2pdu.c       Steven French   2013-10-09  6232  	}
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6233  
34f626406c09dd fs/cifs/smb2pdu.c       Steve French    2013-10-09  6234  qfsattr_exit:
da502f7df03d2d fs/cifs/smb2pdu.c       Pavel Shilovsky 2016-10-25  6235  	free_rsp_buf(resp_buftype, rsp_iov.iov_base);
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6236  
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6237  	if (is_replayable_error(rc) &&
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6238  	    smb2_should_replay(tcon, &retries, &cur_sleep))
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6239  		goto replay_again;
4f1fffa2376922 fs/smb/client/smb2pdu.c Shyam Prasad N  2024-01-21  6240  
6fc05c25ca35e6 fs/cifs/smb2pdu.c       Pavel Shilovsky 2012-09-18  6241  	return rc;
6fc05c25ca35e6 fs/cifs/smb2pdu.c       Pavel Shilovsky 2012-09-18  6242  }
f7ba7fe685bc3e fs/cifs/smb2pdu.c       Pavel Shilovsky 2012-09-19  6243  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
  2026-02-16  8:20 ` [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp zhang.guodong
@ 2026-02-16 18:22   ` kernel test robot
  2026-02-17 14:20     ` ZhangGuoDong
  0 siblings, 1 reply; 17+ messages in thread
From: kernel test robot @ 2026-02-16 18:22 UTC (permalink / raw)
  To: zhang.guodong, smfrench, linkinjeon, pc, ronniesahlberg, sprasad,
	tom, bharathsm, senozhatsky, dhowells, chenxiaosong,
	chenxiaosong.chenxiaosong
  Cc: oe-kbuild-all, linux-cifs, ZhangGuoDong

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on cifs/for-next]
[also build test WARNING on brauner-vfs/vfs.all linus/master next-20260216]
[cannot apply to v6.19]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/zhang-guodong-linux-dev/smb-move-smb3_fs_vol_info-into-common-fscc-h/20260216-162407
base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
patch link:    https://lore.kernel.org/r/20260216082018.156695-5-zhang.guodong%40linux.dev
patch subject: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
config: i386-randconfig-r123-20260216 (https://download.01.org/0day-ci/archive/20260217/202602170244.C33LgPOh-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260217/202602170244.C33LgPOh-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602170244.C33LgPOh-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/smb/client/smb2pdu.c:2365:31: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] nlink @@     got unsigned int [usertype] @@
   fs/smb/client/smb2pdu.c:2365:31: sparse:     expected restricted __le32 [usertype] nlink
   fs/smb/client/smb2pdu.c:2365:31: sparse:     got unsigned int [usertype]
>> fs/smb/client/smb2pdu.c:2366:37: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] reparse_tag @@     got unsigned int [usertype] @@
   fs/smb/client/smb2pdu.c:2366:37: sparse:     expected restricted __le32 [usertype] reparse_tag
   fs/smb/client/smb2pdu.c:2366:37: sparse:     got unsigned int [usertype]
>> fs/smb/client/smb2pdu.c:2367:30: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [usertype] mode @@     got unsigned int [usertype] @@
   fs/smb/client/smb2pdu.c:2367:30: sparse:     expected restricted __le32 [usertype] mode
   fs/smb/client/smb2pdu.c:2367:30: sparse:     got unsigned int [usertype]
   fs/smb/client/smb2pdu.c:6231:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] vol_serial_number @@     got restricted __le32 [usertype] VolumeSerialNumber @@
   fs/smb/client/smb2pdu.c:6231:41: sparse:     expected unsigned int [usertype] vol_serial_number
   fs/smb/client/smb2pdu.c:6231:41: sparse:     got restricted __le32 [usertype] VolumeSerialNumber

vim +2365 fs/smb/client/smb2pdu.c

  2353	
  2354	static void
  2355	parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info,
  2356			 struct create_posix_rsp *posix)
  2357	{
  2358		int sid_len;
  2359		u8 *beg = (u8 *)cc + le16_to_cpu(cc->DataOffset);
  2360		u8 *end = beg + le32_to_cpu(cc->DataLength);
  2361		u8 *sid;
  2362	
  2363		memset(posix, 0, sizeof(*posix));
  2364	
> 2365		posix->ctxt_rsp.nlink = le32_to_cpu(*(__le32 *)(beg + 0));
> 2366		posix->ctxt_rsp.reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
> 2367		posix->ctxt_rsp.mode = le32_to_cpu(*(__le32 *)(beg + 8));
  2368	
  2369		sid = beg + 12;
  2370		sid_len = posix_info_sid_size(sid, end);
  2371		if (sid_len < 0) {
  2372			cifs_dbg(VFS, "bad owner sid in posix create response\n");
  2373			return;
  2374		}
  2375		memcpy(&posix->owner, sid, sid_len);
  2376	
  2377		sid = sid + sid_len;
  2378		sid_len = posix_info_sid_size(sid, end);
  2379		if (sid_len < 0) {
  2380			cifs_dbg(VFS, "bad group sid in posix create response\n");
  2381			return;
  2382		}
  2383		memcpy(&posix->group, sid, sid_len);
  2384	
  2385		cifs_dbg(FYI, "nlink=%d mode=%o reparse_tag=%x\n",
  2386			 posix->ctxt_rsp.nlink, posix->ctxt_rsp.mode,
  2387			 posix->ctxt_rsp.reparse_tag);
  2388	}
  2389	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
  2026-02-16 18:22   ` kernel test robot
@ 2026-02-17 14:20     ` ZhangGuoDong
       [not found]       ` <CAH2r5muK5WrHkJsJ=Rix7ceFFZNzpQkUZSaSsHi8PMXVpw88pw@mail.gmail.com>
  0 siblings, 1 reply; 17+ messages in thread
From: ZhangGuoDong @ 2026-02-17 14:20 UTC (permalink / raw)
  To: kernel test robot, smfrench, linkinjeon, chenxiaosong,
	chenxiaosong.chenxiaosong
  Cc: oe-kbuild-all, linux-cifs, ZhangGuoDong

For patch 01 and patch 04, I followed these steps and did not observe 
any build warnings.

On 2026/2/17 02:22, kernel test robot wrote:
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on cifs/for-next]
> [also build test WARNING on brauner-vfs/vfs.all linus/master next-20260216]
> [cannot apply to v6.19]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:https://github.com/intel-lab-lkp/linux/commits/zhang-guodong-linux-dev/smb-move-smb3_fs_vol_info-into-common-fscc-h/20260216-162407
> base:   git://git.samba.org/sfrench/cifs-2.6.git for-next
> patch link:https://lore.kernel.org/r/20260216082018.156695-5-zhang.guodong%40linux.dev
> patch subject: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
> config: i386-randconfig-r123-20260216 (https://download.01.org/0day-ci/archive/20260217/202602170244.C33LgPOh-lkp@intel.com/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project  87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260217/202602170244.C33LgPOh-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot<lkp@intel.com>
> | Closes:https://lore.kernel.org/oe-kbuild-all/202602170244.C33LgPOh-lkp@intel.com/

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
       [not found]             ` <d6149e9f-9607-4379-a74d-c4bbe12fef00@linux.dev>
@ 2026-02-19  8:16               ` ChenXiaoSong
  2026-02-19 13:14                 ` ChenXiaoSong
  0 siblings, 1 reply; 17+ messages in thread
From: ChenXiaoSong @ 2026-02-19  8:16 UTC (permalink / raw)
  To: ZhangGuoDong, Steve French; +Cc: linux-cifs, chenxiaosong

The changes in parse_posix_ctxt() seem to be fixing a bug. Perhaps we 
should submit it as a separate bugfix patch (add Reported-by: kernel 
test robot).

Steve, what do you think?

Thanks,
ChenXiaoSong <chenxiaosong@kylinos.cn>

On 2026/2/19 15:19, ZhangGuoDong wrote:
> I can now see these warnings. We should make the following changes, what 
> do you think?
> 
> --- a/fs/smb/client/cifsglob.h
> +++ b/fs/smb/client/cifsglob.h
> @@ -1270,7 +1270,7 @@ struct cifs_tcon {
> -       __u32 vol_serial_number;
> +       __le32 vol_serial_number;
> 
> --- a/fs/smb/client/smb2pdu.c
> +++ b/fs/smb/client/smb2pdu.c
> @@ -2362,9 +2362,9 @@ parse_posix_ctxt(struct create_context *cc, struct 
> smb2_file_all_info *info,
> -       posix->ctxt_rsp.nlink = le32_to_cpu(*(__le32 *)(beg + 0));
> -       posix->ctxt_rsp.reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
> -       posix->ctxt_rsp.mode = le32_to_cpu(*(__le32 *)(beg + 8));
> +       posix->ctxt_rsp.nlink = cpu_to_le32(*(u32 *)(beg + 0));
> +       posix->ctxt_rsp.reparse_tag = cpu_to_le32(*(u32 *)(beg + 4));
> +       posix->ctxt_rsp.mode = cpu_to_le32(*(u32 *)(beg + 8));

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp
  2026-02-19  8:16               ` ChenXiaoSong
@ 2026-02-19 13:14                 ` ChenXiaoSong
  0 siblings, 0 replies; 17+ messages in thread
From: ChenXiaoSong @ 2026-02-19 13:14 UTC (permalink / raw)
  To: ZhangGuoDong, Steve French; +Cc: linux-cifs, chenxiaosong

Hi GuoDong,

The changes to patch 04 should be as follows:

--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -2362,9 +2362,9 @@ parse_posix_ctxt(struct create_context *cc, struct
-       posix->ctxt_rsp.nlink = le32_to_cpu(*(__le32 *)(beg + 0));
-       posix->ctxt_rsp.reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
-       posix->ctxt_rsp.mode = le32_to_cpu(*(__le32 *)(beg + 8));
+       posix->ctxt_rsp.nlink = *(__le32 *)(beg + 0);
+       posix->ctxt_rsp.reparse_tag = *(__le32 *)(beg + 4);
+       posix->ctxt_rsp.mode = *(__le32 *)(beg + 8);

Thanks,
ChenXiaoSong <chenxiaosong@kylinos.cn>

On 2026/2/19 16:16, ChenXiaoSong wrote:
> The changes in parse_posix_ctxt() seem to be fixing a bug. Perhaps we 
> should submit it as a separate bugfix patch (add Reported-by: kernel 
> test robot).
> 
> Steve, what do you think?
> 
> Thanks,
> ChenXiaoSong <chenxiaosong@kylinos.cn>
> 
> On 2026/2/19 15:19, ZhangGuoDong wrote:
>> I can now see these warnings. We should make the following changes, 
>> what do you think?
>>
>> --- a/fs/smb/client/cifsglob.h
>> +++ b/fs/smb/client/cifsglob.h
>> @@ -1270,7 +1270,7 @@ struct cifs_tcon {
>> -       __u32 vol_serial_number;
>> +       __le32 vol_serial_number;
>>
>> --- a/fs/smb/client/smb2pdu.c
>> +++ b/fs/smb/client/smb2pdu.c
>> @@ -2362,9 +2362,9 @@ parse_posix_ctxt(struct create_context *cc, 
>> struct smb2_file_all_info *info,
>> -       posix->ctxt_rsp.nlink = le32_to_cpu(*(__le32 *)(beg + 0));
>> -       posix->ctxt_rsp.reparse_tag = le32_to_cpu(*(__le32 *)(beg + 4));
>> -       posix->ctxt_rsp.mode = le32_to_cpu(*(__le32 *)(beg + 8));
>> +       posix->ctxt_rsp.nlink = cpu_to_le32(*(u32 *)(beg + 0));
>> +       posix->ctxt_rsp.reparse_tag = cpu_to_le32(*(u32 *)(beg + 4));
>> +       posix->ctxt_rsp.mode = cpu_to_le32(*(u32 *)(beg + 8));

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
                   ` (4 preceding siblings ...)
  2026-02-16  8:20 ` [PATCH v3 5/5] smb: introduce struct file_posix_info zhang.guodong
@ 2026-02-20  1:27 ` Namjae Jeon
  2026-02-20 10:54   ` ZhangGuoDong
                     ` (2 more replies)
  5 siblings, 3 replies; 17+ messages in thread
From: Namjae Jeon @ 2026-02-20  1:27 UTC (permalink / raw)
  To: zhang.guodong
  Cc: smfrench, pc, ronniesahlberg, sprasad, tom, bharathsm,
	senozhatsky, dhowells, chenxiaosong, chenxiaosong.chenxiaosong,
	linux-cifs, ZhangGuoDong

> ZhangGuoDong (5):
>   smb: move smb3_fs_vol_info into common/fscc.h
>   smb: move some definitions from common/smb2pdu.h into common/fscc.h
>   smb: move file_basic_info into common/fscc.h
>   smb: introduce struct create_posix_ctxt_rsp
>   smb: introduce struct file_posix_info
For patches 0004 and 0005, please move the complete definition to the
common header instead of a partial split. So we should also use a
flexible array member for this, and ensure that all related code is
updated to handle the flexible array correctly.
Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
@ 2026-02-20 10:54   ` ZhangGuoDong
  2026-02-22  7:39   ` ChenXiaoSong
  2026-02-25  3:14   ` ZhangGuoDong
  2 siblings, 0 replies; 17+ messages in thread
From: ZhangGuoDong @ 2026-02-20 10:54 UTC (permalink / raw)
  To: Namjae Jeon
  Cc: smfrench, chenxiaosong, chenxiaosong.chenxiaosong, linux-cifs,
	ZhangGuoDong

Got it, thanks for your suggestions.

On 2026/2/20 09:27, Namjae Jeon wrote:
> For patches 0004 and 0005, please move the complete definition to the
> common header instead of a partial split. So we should also use a
> flexible array member for this, and ensure that all related code is
> updated to handle the flexible array correctly.
> Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
  2026-02-20 10:54   ` ZhangGuoDong
@ 2026-02-22  7:39   ` ChenXiaoSong
  2026-02-22 15:26     ` ChenXiaoSong
  2026-02-25  3:14   ` ZhangGuoDong
  2 siblings, 1 reply; 17+ messages in thread
From: ChenXiaoSong @ 2026-02-22  7:39 UTC (permalink / raw)
  To: Namjae Jeon, smfrench, zhang.guodong
  Cc: pc, ronniesahlberg, sprasad, tom, bharathsm, senozhatsky,
	dhowells, chenxiaosong, linux-cifs, ZhangGuoDong

Hi Namjae and Steve,

In server-side create_posix_rsp_buf(), there is the following comment:

  * SidBuffer(44) contain two sids(Domain sid(28), UNIX group sid(16)).
  * Domain sid(28) = revision(1) + num_subauth(1) + authority(6) +
  *                  sub_auth(4 * 4(num_subauth)) + RID(4).
  * UNIX group id(16) = revision(1) + num_subauth(1) + authority(6) +
  *                     sub_auth(4 * 1(num_subauth)) + RID(4).

However, according to the SID description in the link below (Link[1]), 
the relative identifier (RID) seems to be the last subauth item 
(consistent with the client-side posix_info_sid_size()). Should we 
remove RID(4)? Please let me know if my understanding is incorrect.

Link[1]: 
https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-identifiers#sid-architecture

Thanks,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>
On 2026/2/20 09:27, Namjae Jeon wrote:
>> ZhangGuoDong (5):
>>    smb: move smb3_fs_vol_info into common/fscc.h
>>    smb: move some definitions from common/smb2pdu.h into common/fscc.h
>>    smb: move file_basic_info into common/fscc.h
>>    smb: introduce struct create_posix_ctxt_rsp
>>    smb: introduce struct file_posix_info
> For patches 0004 and 0005, please move the complete definition to the
> common header instead of a partial split. So we should also use a
> flexible array member for this, and ensure that all related code is
> updated to handle the flexible array correctly.
> Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-22  7:39   ` ChenXiaoSong
@ 2026-02-22 15:26     ` ChenXiaoSong
  2026-02-22 15:42       ` ChenXiaoSong
  0 siblings, 1 reply; 17+ messages in thread
From: ChenXiaoSong @ 2026-02-22 15:26 UTC (permalink / raw)
  To: Namjae Jeon, smfrench, zhang.guodong
  Cc: pc, ronniesahlberg, sprasad, tom, bharathsm, senozhatsky,
	dhowells, chenxiaosong, linux-cifs, ZhangGuoDong

`num_subauth` is incremented by 1 at the end of `id_to_sid()`, so the 
code is correct.

Thanks,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>

On 2026/2/22 15:39, ChenXiaoSong wrote:
> Hi Namjae and Steve,
> 
> In server-side create_posix_rsp_buf(), there is the following comment:
> 
>   * SidBuffer(44) contain two sids(Domain sid(28), UNIX group sid(16)).
>   * Domain sid(28) = revision(1) + num_subauth(1) + authority(6) +
>   *                  sub_auth(4 * 4(num_subauth)) + RID(4).
>   * UNIX group id(16) = revision(1) + num_subauth(1) + authority(6) +
>   *                     sub_auth(4 * 1(num_subauth)) + RID(4).
> 
> However, according to the SID description in the link below (Link[1]), 
> the relative identifier (RID) seems to be the last subauth item 
> (consistent with the client-side posix_info_sid_size()). Should we 
> remove RID(4)? Please let me know if my understanding is incorrect.
> 
> Link[1]: 
> https://learn.microsoft.com/en-us/windows-server/identity/ad-ds/manage/understand-security-identifiers#sid-architecture
> 
> Thanks,
> ChenXiaoSong <chenxiaosong@chenxiaosong.com>
> On 2026/2/20 09:27, Namjae Jeon wrote:
>>> ZhangGuoDong (5):
>>>    smb: move smb3_fs_vol_info into common/fscc.h
>>>    smb: move some definitions from common/smb2pdu.h into common/fscc.h
>>>    smb: move file_basic_info into common/fscc.h
>>>    smb: introduce struct create_posix_ctxt_rsp
>>>    smb: introduce struct file_posix_info
>> For patches 0004 and 0005, please move the complete definition to the
>> common header instead of a partial split. So we should also use a
>> flexible array member for this, and ensure that all related code is
>> updated to handle the flexible array correctly.
>> Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-22 15:26     ` ChenXiaoSong
@ 2026-02-22 15:42       ` ChenXiaoSong
  0 siblings, 0 replies; 17+ messages in thread
From: ChenXiaoSong @ 2026-02-22 15:42 UTC (permalink / raw)
  To: Namjae Jeon, smfrench, zhang.guodong
  Cc: pc, ronniesahlberg, sprasad, tom, bharathsm, senozhatsky,
	dhowells, chenxiaosong, linux-cifs, ZhangGuoDong

By the way, when the client mount option specifies `posix`, it seems 
that `parse_posix_ctxt()` is never executed, because the `struct 
create_posix_rsp *posix` pointer passed to `smb2_parse_contexts()` is 
always NULL.

Thanks,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>

On 2026/2/22 23:26, ChenXiaoSong wrote:
> `num_subauth` is incremented by 1 at the end of `id_to_sid()`, so the 
> code is correct.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2
  2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
  2026-02-20 10:54   ` ZhangGuoDong
  2026-02-22  7:39   ` ChenXiaoSong
@ 2026-02-25  3:14   ` ZhangGuoDong
  2 siblings, 0 replies; 17+ messages in thread
From: ZhangGuoDong @ 2026-02-25  3:14 UTC (permalink / raw)
  To: Namjae Jeon, smfrench; +Cc: chenxiaosong, linux-cifs

For patches 0005, struct `smb311_posix_qinfo` and `smb2_posix_info` 
cannot use flexible array member for SID buffers. So we can only move 
fixed (non-variable) part of the structures to the common header file.

We should extract and move the fixed (non-variable) part to the common 
header file, since it is defined three times which makes it hard to 
maintain.

Link: 
https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/fscc_posix_extensions.md#2311-fileposixinformation

struct smb311_posix_qinfo / smb2_posix_info {
   fixed (non-variable) part
   variable sized owner SID and group SID
   le32 filenamelength
   u8 filename[] // variable
};

On 2026/2/20 09:27, Namjae Jeon wrote:
> For patches 0004 and 0005, please move the complete definition to the
> common header instead of a partial split. So we should also use a
> flexible array member for this, and ensure that all related code is
> updated to handle the flexible array correctly.
> Thanks.

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-02-25  3:14 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16  8:20 [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
2026-02-16  8:20 ` [PATCH v3 1/5] smb: move smb3_fs_vol_info into common/fscc.h zhang.guodong
2026-02-16 16:05   ` kernel test robot
2026-02-16  8:20 ` [PATCH v3 2/5] smb: move some definitions from common/smb2pdu.h " zhang.guodong
2026-02-16  8:20 ` [PATCH v3 3/5] smb: move file_basic_info " zhang.guodong
2026-02-16  8:20 ` [PATCH v3 4/5] smb: introduce struct create_posix_ctxt_rsp zhang.guodong
2026-02-16 18:22   ` kernel test robot
2026-02-17 14:20     ` ZhangGuoDong
     [not found]       ` <CAH2r5muK5WrHkJsJ=Rix7ceFFZNzpQkUZSaSsHi8PMXVpw88pw@mail.gmail.com>
     [not found]         ` <b840459a-8a31-46e7-817a-3b80e9ed1353@linux.dev>
     [not found]           ` <CAH2r5muScb7NmeJa1BNwAt8Qzb7WmwVfvskZ=9LEV6WWyO5HyQ@mail.gmail.com>
     [not found]             ` <d6149e9f-9607-4379-a74d-c4bbe12fef00@linux.dev>
2026-02-19  8:16               ` ChenXiaoSong
2026-02-19 13:14                 ` ChenXiaoSong
2026-02-16  8:20 ` [PATCH v3 5/5] smb: introduce struct file_posix_info zhang.guodong
2026-02-20  1:27 ` [PATCH v3 0/5] smb: move duplicate definitions into common header file, part 2 Namjae Jeon
2026-02-20 10:54   ` ZhangGuoDong
2026-02-22  7:39   ` ChenXiaoSong
2026-02-22 15:26     ` ChenXiaoSong
2026-02-22 15:42       ` ChenXiaoSong
2026-02-25  3:14   ` ZhangGuoDong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox