]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: move filesystem_vol_info into common/fscc.h
authorZhangGuoDong <zhangguodong@kylinos.cn>
Tue, 3 Mar 2026 15:13:16 +0000 (15:13 +0000)
committerSteve French <stfrench@microsoft.com>
Sun, 12 Apr 2026 23:07:54 +0000 (18:07 -0500)
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

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>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c
fs/smb/common/fscc.h
fs/smb/common/smb2pdu.h
fs/smb/server/smb2pdu.c
fs/smb/server/smb_common.h

index 5188218c25be4202b631a37df7cb06f831abf674..59d7418cc480639776a11fe358eadc733d61af2e 100644 (file)
@@ -6147,8 +6147,8 @@ replay_again:
                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;
@@ -6203,9 +6203,9 @@ replay_again:
                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_serial_number = le32_to_cpu(vol_info->VolumeSerialNumber);
                tcon->vol_create_time = vol_info->VolumeCreationTime;
        }
 
index 076cbcffa26a049ea2ab5379c6365591c0c5d28a..b4ccddca925656b19e949118d109fe904330bd26 100644 (file)
@@ -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;
index 538e7a12ea934cdf80bf81656fc9d70b71e15a35..85a4248d4f29d9bdc12d2a45c5b142d05874e16f 100644 (file)
@@ -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;
index 18b9b14d17539fe8205f1a22ce25bb900feae3c1..764a78dec46aedbba5693d489c5b9fd98e3909ea 100644 (file)
@@ -5583,13 +5583,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;
index ca7e3610d07477723485985784be66d32c62e194..b090b56743c4cd1298fc8354850cd2ed6f7ebdda 100644 (file)
@@ -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