Skip to content

Commit 95e1d37

Browse files
ZhangGuoDongsmfrench
authored andcommitted
smb: move filesystem_vol_info into common/fscc.h
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>
1 parent 31884d4 commit 95e1d37

5 files changed

Lines changed: 18 additions & 25 deletions

File tree

fs/smb/client/smb2pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6147,8 +6147,8 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
61476147
max_len = sizeof(struct smb3_fs_ss_info);
61486148
min_len = sizeof(struct smb3_fs_ss_info);
61496149
} else if (level == FS_VOLUME_INFORMATION) {
6150-
max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN;
6151-
min_len = sizeof(struct smb3_fs_vol_info);
6150+
max_len = sizeof(struct filesystem_vol_info) + MAX_VOL_LABEL_LEN;
6151+
min_len = sizeof(struct filesystem_vol_info);
61526152
} else {
61536153
cifs_dbg(FYI, "Invalid qfsinfo level %d\n", level);
61546154
return -EINVAL;
@@ -6203,9 +6203,9 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
62036203
tcon->perf_sector_size =
62046204
le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf);
62056205
} else if (level == FS_VOLUME_INFORMATION) {
6206-
struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *)
6206+
struct filesystem_vol_info *vol_info = (struct filesystem_vol_info *)
62076207
(offset + (char *)rsp);
6208-
tcon->vol_serial_number = vol_info->VolumeSerialNumber;
6208+
tcon->vol_serial_number = le32_to_cpu(vol_info->VolumeSerialNumber);
62096209
tcon->vol_create_time = vol_info->VolumeCreationTime;
62106210
}
62116211

fs/smb/common/fscc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,17 @@ typedef struct {
447447
__le32 BytesPerSector;
448448
} __packed FILE_SYSTEM_SIZE_INFO; /* size info, level 0x103 */
449449

450+
/* volume info struct - see MS-FSCC 2.5.9 */
451+
#define MAX_VOL_LABEL_LEN 32
452+
struct filesystem_vol_info {
453+
__le64 VolumeCreationTime;
454+
__le32 VolumeSerialNumber;
455+
__le32 VolumeLabelLength; /* includes trailing null */
456+
__u8 SupportsObjects; /* True if eg like NTFS, supports objects */
457+
__u8 Reserved;
458+
__u8 VolumeLabel[]; /* variable len */
459+
} __packed;
460+
450461
/* See MS-FSCC 2.5.10 */
451462
typedef struct {
452463
__le32 DeviceType;

fs/smb/common/smb2pdu.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,17 +1635,6 @@ struct smb311_posix_qinfo {
16351635
*/
16361636
} __packed;
16371637

1638-
/* volume info struct - see MS-FSCC 2.5.9 */
1639-
#define MAX_VOL_LABEL_LEN 32
1640-
struct smb3_fs_vol_info {
1641-
__le64 VolumeCreationTime;
1642-
__u32 VolumeSerialNumber;
1643-
__le32 VolumeLabelLength; /* includes trailing null */
1644-
__u8 SupportsObjects; /* True if eg like NTFS, supports objects */
1645-
__u8 Reserved;
1646-
__u8 VolumeLabel[]; /* variable len */
1647-
} __packed;
1648-
16491638
/* See MS-SMB2 2.2.23 through 2.2.25 */
16501639
struct smb2_oplock_break {
16511640
struct smb2_hdr hdr;

fs/smb/server/smb2pdu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5583,13 +5583,14 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
55835583
serial_crc = crc32_le(serial_crc, ksmbd_netbios_name(),
55845584
strlen(ksmbd_netbios_name()));
55855585
/* Taking dummy value of serial number*/
5586-
info->SerialNumber = cpu_to_le32(serial_crc);
5586+
info->VolumeSerialNumber = cpu_to_le32(serial_crc);
55875587
len = smbConvertToUTF16((__le16 *)info->VolumeLabel,
55885588
share->name, PATH_MAX,
55895589
conn->local_nls, 0);
55905590
len = len * 2;
5591-
info->VolumeLabelSize = cpu_to_le32(len);
5591+
info->VolumeLabelLength = cpu_to_le32(len);
55925592
info->Reserved = 0;
5593+
info->SupportsObjects = 0;
55935594
sz = sizeof(struct filesystem_vol_info) + len;
55945595
rsp->OutputBufferLength = cpu_to_le32(sz);
55955596
break;

fs/smb/server/smb_common.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@ struct smb_negotiate_rsp {
9090
__le16 ByteCount;
9191
} __packed;
9292

93-
struct filesystem_vol_info {
94-
__le64 VolumeCreationTime;
95-
__le32 SerialNumber;
96-
__le32 VolumeLabelSize;
97-
__le16 Reserved;
98-
__le16 VolumeLabel[];
99-
} __packed;
100-
10193
#define EXTENDED_INFO_MAGIC 0x43667364 /* Cfsd */
10294
#define STRING_LENGTH 28
10395

0 commit comments

Comments
 (0)