[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251211143228.172470-5-chenxiaosong.chenxiaosong@linux.dev>
Date: Thu, 11 Dec 2025 22:32:25 +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,
ZhangGuoDong <zhangguodong@...inos.cn>,
ChenXiaoSong <chenxiaosong@...inos.cn>
Subject: [PATCH v2 4/7] 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 0123f34db1e8..5949facd005a 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 28460c3d4979..5dfdf9ec11c7 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 f3184b217575..f58b212481e0 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -5507,11 +5507,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));
@@ -5520,14 +5520,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 89adfd190370..f47ce4a6719c 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -91,14 +91,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