Skip to content

Commit 833a75f

Browse files
ChenXiaoSongsmfrench
authored andcommitted
smb: move create_durable_req_v2 to common/smb2pdu.h
Modify the following places: - some fields in "struct create_durable_req_v2" -> struct durable_context_v2 - durable_context_v2 -> durable_context_v2_req - create_durable_v2 -> create_durable_req_v2 Then move duplicate definitions to common header file. Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 884a1d4 commit 833a75f

5 files changed

Lines changed: 25 additions & 32 deletions

File tree

fs/smb/client/smb2pdu.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,21 +2424,21 @@ add_lease_context(struct TCP_Server_Info *server,
24242424
return 0;
24252425
}
24262426

2427-
static struct create_durable_v2 *
2427+
static struct create_durable_req_v2 *
24282428
create_durable_v2_buf(struct cifs_open_parms *oparms)
24292429
{
24302430
struct cifs_fid *pfid = oparms->fid;
2431-
struct create_durable_v2 *buf;
2431+
struct create_durable_req_v2 *buf;
24322432

2433-
buf = kzalloc(sizeof(struct create_durable_v2), GFP_KERNEL);
2433+
buf = kzalloc(sizeof(struct create_durable_req_v2), GFP_KERNEL);
24342434
if (!buf)
24352435
return NULL;
24362436

24372437
buf->ccontext.DataOffset = cpu_to_le16(offsetof
2438-
(struct create_durable_v2, dcontext));
2439-
buf->ccontext.DataLength = cpu_to_le32(sizeof(struct durable_context_v2));
2438+
(struct create_durable_req_v2, dcontext));
2439+
buf->ccontext.DataLength = cpu_to_le32(sizeof(struct durable_context_v2_req));
24402440
buf->ccontext.NameOffset = cpu_to_le16(offsetof
2441-
(struct create_durable_v2, Name));
2441+
(struct create_durable_req_v2, Name));
24422442
buf->ccontext.NameLength = cpu_to_le16(4);
24432443

24442444
/*
@@ -2508,7 +2508,7 @@ add_durable_v2_context(struct kvec *iov, unsigned int *num_iovec,
25082508
iov[num].iov_base = create_durable_v2_buf(oparms);
25092509
if (iov[num].iov_base == NULL)
25102510
return -ENOMEM;
2511-
iov[num].iov_len = sizeof(struct create_durable_v2);
2511+
iov[num].iov_len = sizeof(struct create_durable_req_v2);
25122512
*num_iovec = num + 1;
25132513
return 0;
25142514
}

fs/smb/client/smb2pdu.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,6 @@ struct share_redirect_error_context_rsp {
137137
/* See MS-SMB2 2.2.13.2.11 */
138138
/* Flags */
139139
#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002
140-
struct durable_context_v2 {
141-
__le32 Timeout;
142-
__le32 Flags;
143-
__u64 Reserved;
144-
__u8 CreateGuid[16];
145-
} __packed;
146-
147-
struct create_durable_v2 {
148-
struct create_context_hdr ccontext;
149-
__u8 Name[8];
150-
struct durable_context_v2 dcontext;
151-
} __packed;
152140

153141
/* See MS-SMB2 2.2.13.2.12 */
154142
struct durable_reconnect_context_v2 {

fs/smb/common/smb2pdu.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,20 @@ struct create_mxac_req {
12901290
__le64 Timestamp;
12911291
} __packed;
12921292

1293+
/* See MS-SMB2 2.2.13.2.11 */
1294+
struct durable_context_v2_req {
1295+
__le32 Timeout;
1296+
__le32 Flags; /* see SMB2_DHANDLE_FLAG_PERSISTENT */
1297+
__u64 Reserved;
1298+
__u8 CreateGuid[16];
1299+
} __packed;
1300+
1301+
struct create_durable_req_v2 {
1302+
struct create_context_hdr ccontext;
1303+
__u8 Name[8];
1304+
struct durable_context_v2_req dcontext;
1305+
} __packed;
1306+
12931307
/* See MS-SMB2 2.2.14.2.5 */
12941308
struct create_mxac_rsp {
12951309
struct create_context_hdr ccontext;

fs/smb/server/smb2pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2806,7 +2806,7 @@ static int parse_durable_handle_context(struct ksmbd_work *work,
28062806
durable_v2_blob =
28072807
(struct create_durable_req_v2 *)context;
28082808
ksmbd_debug(SMB, "Request for durable v2 open\n");
2809-
dh_info->fp = ksmbd_lookup_fd_cguid(durable_v2_blob->CreateGuid);
2809+
dh_info->fp = ksmbd_lookup_fd_cguid(durable_v2_blob->dcontext.CreateGuid);
28102810
if (dh_info->fp) {
28112811
if (!memcmp(conn->ClientGUID, dh_info->fp->client_guid,
28122812
SMB2_CLIENT_GUID_SIZE)) {
@@ -2824,11 +2824,11 @@ static int parse_durable_handle_context(struct ksmbd_work *work,
28242824
if ((lc && (lc->req_state & SMB2_LEASE_HANDLE_CACHING_LE)) ||
28252825
req_op_level == SMB2_OPLOCK_LEVEL_BATCH) {
28262826
dh_info->CreateGuid =
2827-
durable_v2_blob->CreateGuid;
2827+
durable_v2_blob->dcontext.CreateGuid;
28282828
dh_info->persistent =
2829-
le32_to_cpu(durable_v2_blob->Flags);
2829+
le32_to_cpu(durable_v2_blob->dcontext.Flags);
28302830
dh_info->timeout =
2831-
le32_to_cpu(durable_v2_blob->Timeout);
2831+
le32_to_cpu(durable_v2_blob->dcontext.Timeout);
28322832
dh_info->type = dh_idx;
28332833
}
28342834
break;

fs/smb/server/smb2pdu.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,6 @@ struct preauth_integrity_info {
6666
/* Apple Defined Contexts */
6767
#define SMB2_CREATE_AAPL "AAPL"
6868

69-
struct create_durable_req_v2 {
70-
struct create_context_hdr ccontext;
71-
__u8 Name[8];
72-
__le32 Timeout;
73-
__le32 Flags;
74-
__u8 Reserved[8];
75-
__u8 CreateGuid[16];
76-
} __packed;
77-
7869
#define DURABLE_HANDLE_MAX_TIMEOUT 300000
7970

8071
struct create_durable_reconn_req {

0 commit comments

Comments
 (0)