Skip to content

Commit 9c98f5e

Browse files
ZhangGuoDongsmfrench
authored andcommitted
smb: move resume_key_ioctl_rsp to common/smb2pdu.h
Rename 2 places: - resume_key_req -> resume_key_ioctl_rsp - server: ResumeKey -> ResumeKeyU64 Merge the struct members of the server and the client, then move duplicate definitions to common header file. Co-developed-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent cc26f59 commit 9c98f5e

5 files changed

Lines changed: 14 additions & 16 deletions

File tree

fs/smb/client/smb2ops.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,7 +1528,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
15281528
{
15291529
int rc;
15301530
unsigned int ret_data_len;
1531-
struct resume_key_req *res_key;
1531+
struct resume_key_ioctl_rsp *res_key;
15321532

15331533
rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
15341534
FSCTL_SRV_REQUEST_RESUME_KEY, NULL, 0 /* no input */,
@@ -1541,7 +1541,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
15411541
cifs_tcon_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc);
15421542
goto req_res_key_exit;
15431543
}
1544-
if (ret_data_len < sizeof(struct resume_key_req)) {
1544+
if (ret_data_len < sizeof(struct resume_key_ioctl_rsp)) {
15451545
cifs_tcon_dbg(VFS, "Invalid refcopy resume key length\n");
15461546
rc = -EINVAL;
15471547
goto req_res_key_exit;

fs/smb/client/smb2pdu.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,6 @@ struct crt_sd_ctxt {
193193
struct smb3_sd sd;
194194
} __packed;
195195

196-
struct resume_key_req {
197-
char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
198-
__le32 ContextLength; /* MBZ */
199-
char Context[]; /* ignored, Windows sets to 4 bytes of zero */
200-
} __packed;
201-
202196
/* See MS-FSCC 2.3.29 and 2.3.30 */
203197
struct get_retrieval_pointer_count_req {
204198
__le64 StartingVcn; /* virtual cluster number (signed) */

fs/smb/common/smb2pdu.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,16 @@ struct copychunk_ioctl_rsp {
14171417
__le32 TotalBytesWritten;
14181418
} __packed;
14191419

1420+
/* See MS-SMB2 2.2.32.3 */
1421+
struct resume_key_ioctl_rsp {
1422+
union {
1423+
char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
1424+
__u64 ResumeKeyU64[3];
1425+
};
1426+
__le32 ContextLength; /* MBZ */
1427+
char Context[]; /* ignored, Windows sets to 4 bytes of zero */
1428+
} __packed;
1429+
14201430
struct smb2_ioctl_rsp {
14211431
struct smb2_hdr hdr;
14221432
__le16 StructureSize; /* Must be 49 */

fs/smb/server/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8112,8 +8112,8 @@ static int fsctl_request_resume_key(struct ksmbd_work *work,
81128112
return -ENOENT;
81138113

81148114
memset(key_rsp, 0, sizeof(*key_rsp));
8115-
key_rsp->ResumeKey[0] = req->VolatileFileId;
8116-
key_rsp->ResumeKey[1] = req->PersistentFileId;
8115+
key_rsp->ResumeKeyU64[0] = req->VolatileFileId;
8116+
key_rsp->ResumeKeyU64[1] = req->PersistentFileId;
81178117
ksmbd_fd_put(work, fp);
81188118

81198119
return 0;

fs/smb/server/smb2pdu.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,6 @@ struct file_object_buf_type1_ioctl_rsp {
168168
__u8 DomainId[16];
169169
} __packed;
170170

171-
struct resume_key_ioctl_rsp {
172-
__u64 ResumeKey[3];
173-
__le32 ContextLength;
174-
__u8 Context[4]; /* ignored, Windows sets to 4 bytes of zero */
175-
} __packed;
176-
177171
struct file_sparse {
178172
__u8 SetSparse;
179173
} __packed;

0 commit comments

Comments
 (0)