]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: move resume_key_ioctl_rsp to common/smb2pdu.h
authorZhangGuoDong <zhangguodong@kylinos.cn>
Mon, 27 Oct 2025 07:22:05 +0000 (15:22 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 1 Dec 2025 03:11:44 +0000 (21:11 -0600)
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>
fs/smb/client/smb2ops.c
fs/smb/client/smb2pdu.h
fs/smb/common/smb2pdu.h
fs/smb/server/smb2pdu.c
fs/smb/server/smb2pdu.h

index dd569cc5abcc694fd5542dfafb3dc0e1ceb2028f..4b005a7adce048178da5d121d9620b2d030c28ae 100644 (file)
@@ -1528,7 +1528,7 @@ SMB2_request_res_key(const unsigned int xid, struct cifs_tcon *tcon,
 {
        int rc;
        unsigned int ret_data_len;
-       struct resume_key_req *res_key;
+       struct resume_key_ioctl_rsp *res_key;
 
        rc = SMB2_ioctl(xid, tcon, persistent_fid, volatile_fid,
                        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,
                cifs_tcon_dbg(VFS, "refcpy ioctl error %d getting resume key\n", rc);
                goto req_res_key_exit;
        }
-       if (ret_data_len < sizeof(struct resume_key_req)) {
+       if (ret_data_len < sizeof(struct resume_key_ioctl_rsp)) {
                cifs_tcon_dbg(VFS, "Invalid refcopy resume key length\n");
                rc = -EINVAL;
                goto req_res_key_exit;
index de2d83c6463c998044f3108135d4bcb741acbc96..0ce9f93f108f1706e1e69ca5754f880923884e05 100644 (file)
@@ -193,12 +193,6 @@ struct crt_sd_ctxt {
        struct smb3_sd sd;
 } __packed;
 
-struct resume_key_req {
-       char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
-       __le32  ContextLength;  /* MBZ */
-       char    Context[];      /* ignored, Windows sets to 4 bytes of zero */
-} __packed;
-
 /* See MS-FSCC 2.3.29 and 2.3.30 */
 struct get_retrieval_pointer_count_req {
        __le64 StartingVcn; /* virtual cluster number (signed) */
index 1bd5835c56e45f958f0f17791e0037615816823f..a7ea4214d06184ed80c18b7fa3ad8258cb4fee92 100644 (file)
@@ -1417,6 +1417,16 @@ struct copychunk_ioctl_rsp {
        __le32 TotalBytesWritten;
 } __packed;
 
+/* See MS-SMB2 2.2.32.3 */
+struct resume_key_ioctl_rsp {
+       union {
+               char ResumeKey[COPY_CHUNK_RES_KEY_SIZE];
+               __u64 ResumeKeyU64[3];
+       };
+       __le32  ContextLength;  /* MBZ */
+       char    Context[];      /* ignored, Windows sets to 4 bytes of zero */
+} __packed;
+
 struct smb2_ioctl_rsp {
        struct smb2_hdr hdr;
        __le16 StructureSize; /* Must be 49 */
index 33f89dca19201daa11f1b8c37ee9b413d2e65dea..2cef4e192dbe841a33ddf08920f17debb7f8e616 100644 (file)
@@ -8112,8 +8112,8 @@ static int fsctl_request_resume_key(struct ksmbd_work *work,
                return -ENOENT;
 
        memset(key_rsp, 0, sizeof(*key_rsp));
-       key_rsp->ResumeKey[0] = req->VolatileFileId;
-       key_rsp->ResumeKey[1] = req->PersistentFileId;
+       key_rsp->ResumeKeyU64[0] = req->VolatileFileId;
+       key_rsp->ResumeKeyU64[1] = req->PersistentFileId;
        ksmbd_fd_put(work, fp);
 
        return 0;
index 284d6771060e9c4489b130c1f73ab81f64466dff..807079d19d1e11b233f216f9805f75ee159a79d7 100644 (file)
@@ -168,12 +168,6 @@ struct file_object_buf_type1_ioctl_rsp {
        __u8 DomainId[16];
 } __packed;
 
-struct resume_key_ioctl_rsp {
-       __u64 ResumeKey[3];
-       __le32 ContextLength;
-       __u8 Context[4]; /* ignored, Windows sets to 4 bytes of zero */
-} __packed;
-
 struct file_sparse {
        __u8    SetSparse;
 } __packed;