[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251209011020.3270989-9-chenxiaosong.chenxiaosong@linux.dev>
Date: Tue, 9 Dec 2025 09:10:14 +0800
From: chenxiaosong.chenxiaosong@...ux.dev
To: sfrench@...ba.org,
smfrench@...il.com,
linkinjeon@...nel.org,
linkinjeon@...ba.org
Cc: linux-cifs@...r.kernel.org,
linux-kernel@...r.kernel.org,
liuzhengyuan@...inos.cn,
huhai@...inos.cn,
liuyun01@...inos.cn,
ZhangGuoDong <zhangguodong@...inos.cn>,
ChenXiaoSong <chenxiaosong@...inos.cn>
Subject: [PATCH 08/13] smb: move smb3_fs_vol_info into common/fscc.h
From: ZhangGuoDong <zhangguodong@...inos.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.
Co-developed-by: ChenXiaoSong <chenxiaosong@...inos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@...inos.cn>
Signed-off-by: ZhangGuoDong <zhangguodong@...inos.cn>
---
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 5bf6c82e27f7..bd1e0824ac4a 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;
+ __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-FSCC 2.5.10 */
typedef struct {
__le32 DeviceType;
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index 5d6ca221d4b6..a4804674aaba 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1938,17 +1938,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 ddd031ad7689..4faa44fa9875 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -5514,11 +5514,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));
@@ -5527,14 +5527,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 2baf4aa330eb..b8da31cdbfd1 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.43.0
Powered by blists - more mailing lists