|
@@ -454,12 +454,11 @@ wait_for_response(struct TCP_Server_Info *server, struct mid_q_entry *midQ)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
-cifs_setup_async_request(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
- unsigned int nvec, struct mid_q_entry **ret_mid)
|
|
|
+struct mid_q_entry *
|
|
|
+cifs_setup_async_request(struct TCP_Server_Info *server, struct smb_rqst *rqst)
|
|
|
{
|
|
|
int rc;
|
|
|
- struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
|
|
|
+ struct smb_hdr *hdr = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
|
|
|
struct mid_q_entry *mid;
|
|
|
|
|
|
/* enable signing if server requires it */
|
|
@@ -468,16 +467,15 @@ cifs_setup_async_request(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
|
|
|
mid = AllocMidQEntry(hdr, server);
|
|
|
if (mid == NULL)
|
|
|
- return -ENOMEM;
|
|
|
+ return ERR_PTR(-ENOMEM);
|
|
|
|
|
|
- rc = cifs_sign_smbv(iov, nvec, server, &mid->sequence_number);
|
|
|
+ rc = cifs_sign_rqst(rqst, server, &mid->sequence_number);
|
|
|
if (rc) {
|
|
|
DeleteMidQEntry(mid);
|
|
|
- return rc;
|
|
|
+ return ERR_PTR(rc);
|
|
|
}
|
|
|
|
|
|
- *ret_mid = mid;
|
|
|
- return 0;
|
|
|
+ return mid;
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -485,9 +483,9 @@ cifs_setup_async_request(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
* the result. Caller is responsible for dealing with timeouts.
|
|
|
*/
|
|
|
int
|
|
|
-cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
- unsigned int nvec, mid_receive_t *receive,
|
|
|
- mid_callback_t *callback, void *cbdata, const int flags)
|
|
|
+cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
|
|
|
+ mid_receive_t *receive, mid_callback_t *callback,
|
|
|
+ void *cbdata, const int flags)
|
|
|
{
|
|
|
int rc, timeout, optype;
|
|
|
struct mid_q_entry *mid;
|
|
@@ -500,12 +498,12 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
return rc;
|
|
|
|
|
|
mutex_lock(&server->srv_mutex);
|
|
|
- rc = server->ops->setup_async_request(server, iov, nvec, &mid);
|
|
|
- if (rc) {
|
|
|
+ mid = server->ops->setup_async_request(server, rqst);
|
|
|
+ if (IS_ERR(mid)) {
|
|
|
mutex_unlock(&server->srv_mutex);
|
|
|
add_credits(server, 1, optype);
|
|
|
wake_up(&server->request_q);
|
|
|
- return rc;
|
|
|
+ return PTR_ERR(mid);
|
|
|
}
|
|
|
|
|
|
mid->receive = receive;
|
|
@@ -520,7 +518,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct kvec *iov,
|
|
|
|
|
|
|
|
|
cifs_in_send_inc(server);
|
|
|
- rc = smb_sendv(server, iov, nvec);
|
|
|
+ rc = smb_send_rqst(server, rqst);
|
|
|
cifs_in_send_dec(server);
|
|
|
cifs_save_when_sent(mid);
|
|
|
mutex_unlock(&server->srv_mutex);
|
|
@@ -630,22 +628,22 @@ cifs_check_receive(struct mid_q_entry *mid, struct TCP_Server_Info *server,
|
|
|
return map_smb_to_linux_error(mid->resp_buf, log_error);
|
|
|
}
|
|
|
|
|
|
-int
|
|
|
-cifs_setup_request(struct cifs_ses *ses, struct kvec *iov,
|
|
|
- unsigned int nvec, struct mid_q_entry **ret_mid)
|
|
|
+struct mid_q_entry *
|
|
|
+cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst)
|
|
|
{
|
|
|
int rc;
|
|
|
- struct smb_hdr *hdr = (struct smb_hdr *)iov[0].iov_base;
|
|
|
+ struct smb_hdr *hdr = (struct smb_hdr *)rqst->rq_iov[0].iov_base;
|
|
|
struct mid_q_entry *mid;
|
|
|
|
|
|
rc = allocate_mid(ses, hdr, &mid);
|
|
|
if (rc)
|
|
|
- return rc;
|
|
|
- rc = cifs_sign_smbv(iov, nvec, ses->server, &mid->sequence_number);
|
|
|
- if (rc)
|
|
|
+ return ERR_PTR(rc);
|
|
|
+ rc = cifs_sign_rqst(rqst, ses->server, &mid->sequence_number);
|
|
|
+ if (rc) {
|
|
|
cifs_delete_mid(mid);
|
|
|
- *ret_mid = mid;
|
|
|
- return rc;
|
|
|
+ return ERR_PTR(rc);
|
|
|
+ }
|
|
|
+ return mid;
|
|
|
}
|
|
|
|
|
|
int
|
|
@@ -658,6 +656,8 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
|
|
|
struct mid_q_entry *midQ;
|
|
|
char *buf = iov[0].iov_base;
|
|
|
unsigned int credits = 1;
|
|
|
+ struct smb_rqst rqst = { .rq_iov = iov,
|
|
|
+ .rq_nvec = n_vec };
|
|
|
|
|
|
timeout = flags & CIFS_TIMEOUT_MASK;
|
|
|
optype = flags & CIFS_OP_MASK;
|
|
@@ -695,13 +695,13 @@ SendReceive2(const unsigned int xid, struct cifs_ses *ses,
|
|
|
|
|
|
mutex_lock(&ses->server->srv_mutex);
|
|
|
|
|
|
- rc = ses->server->ops->setup_request(ses, iov, n_vec, &midQ);
|
|
|
- if (rc) {
|
|
|
+ midQ = ses->server->ops->setup_request(ses, &rqst);
|
|
|
+ if (IS_ERR(midQ)) {
|
|
|
mutex_unlock(&ses->server->srv_mutex);
|
|
|
cifs_small_buf_release(buf);
|
|
|
/* Update # of requests on wire to server */
|
|
|
add_credits(ses->server, 1, optype);
|
|
|
- return rc;
|
|
|
+ return PTR_ERR(midQ);
|
|
|
}
|
|
|
|
|
|
midQ->mid_state = MID_REQUEST_SUBMITTED;
|