From: zhang.guodong@linux.dev
To: smfrench@gmail.com, linkinjeon@kernel.org, chenxiaosong@chenxiaosong.com
Cc: linux-cifs@vger.kernel.org,
ZhangGuoDong <zhangguodong@kylinos.cn>,
ChenXiaoSong <chenxiaosong@kylinos.cn>,
Steve French <stfrench@microsoft.com>
Subject: [PATCH v4 3/5] smb: move filesystem_vol_info into common/fscc.h
Date: Wed, 25 Feb 2026 04:10:58 +0000 [thread overview]
Message-ID: <20260225041100.707468-4-zhang.guodong@linux.dev> (raw)
In-Reply-To: <20260225041100.707468-1-zhang.guodong@linux.dev>
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:
- smb3_fs_vol_info -> filesystem_vol_info
- SerialNumber -> VolumeSerialNumber
- VolumeLabelSize -> VolumeLabelLength
- struct smb_mnt_fs_info: __le32 vol_serial_number
- struct cifs_tcon: __le32 vol_serial_number
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/client/cifs_debug.c | 2 +-
fs/smb/client/cifs_ioctl.h | 2 +-
fs/smb/client/cifsfs.c | 2 +-
fs/smb/client/cifsglob.h | 2 +-
fs/smb/client/fscache.c | 2 +-
fs/smb/client/smb2pdu.c | 6 +++---
fs/smb/common/fscc.h | 11 +++++++++++
fs/smb/common/smb2pdu.h | 11 -----------
fs/smb/server/smb2pdu.c | 5 +++--
fs/smb/server/smb_common.h | 8 --------
10 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/fs/smb/client/cifs_debug.c b/fs/smb/client/cifs_debug.c
index 217444e3e6d0..8bb909a57edf 100644
--- a/fs/smb/client/cifs_debug.c
+++ b/fs/smb/client/cifs_debug.c
@@ -92,7 +92,7 @@ static void cifs_debug_tcon(struct seq_file *m, struct cifs_tcon *tcon)
else
seq_printf(m, " type: %d ", dev_type);
- seq_printf(m, "Serial Number: 0x%x", tcon->vol_serial_number);
+ seq_printf(m, "Serial Number: 0x%x", le32_to_cpu(tcon->vol_serial_number));
if ((tcon->seal) ||
(tcon->ses->session_flags & SMB2_SESSION_FLAG_ENCRYPT_DATA) ||
diff --git a/fs/smb/client/cifs_ioctl.h b/fs/smb/client/cifs_ioctl.h
index 147496ac9f9f..b512d8af017f 100644
--- a/fs/smb/client/cifs_ioctl.h
+++ b/fs/smb/client/cifs_ioctl.h
@@ -11,7 +11,7 @@ struct smb_mnt_fs_info {
__u32 version; /* 0001 */
__u16 protocol_id;
__u16 tcon_flags;
- __u32 vol_serial_number;
+ __le32 vol_serial_number;
__u32 vol_create_time;
__u32 share_caps;
__u32 share_flags;
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 427558404aa5..93e9cfa042eb 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -373,7 +373,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
else
buf->f_namelen = PATH_MAX;
- buf->f_fsid.val[0] = tcon->vol_serial_number;
+ buf->f_fsid.val[0] = le32_to_cpu(tcon->vol_serial_number);
/* are using part of create time for more randomness, see man statfs */
buf->f_fsid.val[1] = (int)le64_to_cpu(tcon->vol_create_time);
diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h
index 6f9b6c72962b..aa4462b0df25 100644
--- a/fs/smb/client/cifsglob.h
+++ b/fs/smb/client/cifsglob.h
@@ -1270,7 +1270,7 @@ struct cifs_tcon {
__le32 capabilities;
__u32 share_flags;
__u32 maximal_access;
- __u32 vol_serial_number;
+ __le32 vol_serial_number;
__le64 vol_create_time;
__u64 snapshot_time; /* for timewarp tokens - timestamp of snapshot */
__u32 handle_timeout; /* persistent and durable handle timeout in ms */
diff --git a/fs/smb/client/fscache.c b/fs/smb/client/fscache.c
index 01424a5cdb99..9801b7fa58ac 100644
--- a/fs/smb/client/fscache.c
+++ b/fs/smb/client/fscache.c
@@ -29,7 +29,7 @@ static void cifs_fscache_fill_volume_coherency(
memset(cd, 0, sizeof(*cd));
cd->resource_id = cpu_to_le64(tcon->resource_id);
cd->vol_create_time = tcon->vol_create_time;
- cd->vol_serial_number = cpu_to_le32(tcon->vol_serial_number);
+ cd->vol_serial_number = tcon->vol_serial_number;
}
int cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index a2a96d817717..c7004b4eb87c 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -6164,8 +6164,8 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
max_len = sizeof(struct smb3_fs_ss_info);
min_len = sizeof(struct smb3_fs_ss_info);
} else if (level == FS_VOLUME_INFORMATION) {
- max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN;
- min_len = sizeof(struct smb3_fs_vol_info);
+ max_len = sizeof(struct filesystem_vol_info) + MAX_VOL_LABEL_LEN;
+ min_len = sizeof(struct filesystem_vol_info);
} else {
cifs_dbg(FYI, "Invalid qfsinfo level %d\n", level);
return -EINVAL;
@@ -6220,7 +6220,7 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
tcon->perf_sector_size =
le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf);
} else if (level == FS_VOLUME_INFORMATION) {
- struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *)
+ struct filesystem_vol_info *vol_info = (struct filesystem_vol_info *)
(offset + (char *)rsp);
tcon->vol_serial_number = vol_info->VolumeSerialNumber;
tcon->vol_create_time = vol_info->VolumeCreationTime;
diff --git a/fs/smb/common/fscc.h b/fs/smb/common/fscc.h
index 076cbcffa26a..b4ccddca9256 100644
--- a/fs/smb/common/fscc.h
+++ b/fs/smb/common/fscc.h
@@ -447,6 +447,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 filesystem_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 538e7a12ea93..85a4248d4f29 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -1635,17 +1635,6 @@ struct smb311_posix_qinfo {
*/
} __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 c787d9fd6dd2..b5dcd9cff2e2 100644
--- a/fs/smb/server/smb2pdu.c
+++ b/fs/smb/server/smb2pdu.c
@@ -5544,13 +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;
+ info->SupportsObjects = 0;
sz = sizeof(struct filesystem_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.53.0
next prev parent reply other threads:[~2026-02-25 4:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 4:10 [PATCH v4 0/5] smb: move duplicate definitions into common header file, part 2 zhang.guodong
2026-02-25 4:10 ` [PATCH v4 1/5] smb: move some definitions from common/smb2pdu.h into common/fscc.h zhang.guodong
2026-02-25 4:10 ` [PATCH v4 2/5] smb: move file_basic_info " zhang.guodong
2026-02-25 4:10 ` zhang.guodong [this message]
2026-02-27 2:37 ` [PATCH v4 3/5] smb: move filesystem_vol_info " Namjae Jeon
2026-02-27 2:48 ` ZhangGuoDong
2026-02-25 4:10 ` [PATCH v4 4/5] smb: update some doc references zhang.guodong
2026-03-01 17:41 ` Steve French
2026-02-25 4:11 ` [PATCH v4 5/5] smb: introduce struct file_posix_info zhang.guodong
2026-02-27 4:37 ` Namjae Jeon
2026-03-03 2:41 ` ZhangGuoDong
2026-03-03 3:00 ` ZhangGuoDong
2026-03-03 7:31 ` ChenXiaoSong
2026-03-03 8:58 ` ChenXiaoSong
2026-03-03 9:41 ` ChenXiaoSong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260225041100.707468-4-zhang.guodong@linux.dev \
--to=zhang.guodong@linux.dev \
--cc=chenxiaosong@chenxiaosong.com \
--cc=chenxiaosong@kylinos.cn \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
--cc=stfrench@microsoft.com \
--cc=zhangguodong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox