9P: Add cancelled() to the transport functions.
And move transport-specific code out of net/9p/client.c Signed-off-by: Simon Derr <simon.derr@bull.net> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
This commit is contained in:
parent
05a782d416
commit
afd8d65411
|
@ -40,6 +40,8 @@
|
||||||
* @close: member function to discard a connection on this transport
|
* @close: member function to discard a connection on this transport
|
||||||
* @request: member function to issue a request to the transport
|
* @request: member function to issue a request to the transport
|
||||||
* @cancel: member function to cancel a request (if it hasn't been sent)
|
* @cancel: member function to cancel a request (if it hasn't been sent)
|
||||||
|
* @cancelled: member function to notify that a cancelled request will not
|
||||||
|
* not receive a reply
|
||||||
*
|
*
|
||||||
* This is the basic API for a transport module which is registered by the
|
* This is the basic API for a transport module which is registered by the
|
||||||
* transport module with the 9P core network module and used by the client
|
* transport module with the 9P core network module and used by the client
|
||||||
|
@ -58,6 +60,7 @@ struct p9_trans_module {
|
||||||
void (*close) (struct p9_client *);
|
void (*close) (struct p9_client *);
|
||||||
int (*request) (struct p9_client *, struct p9_req_t *req);
|
int (*request) (struct p9_client *, struct p9_req_t *req);
|
||||||
int (*cancel) (struct p9_client *, struct p9_req_t *req);
|
int (*cancel) (struct p9_client *, struct p9_req_t *req);
|
||||||
|
int (*cancelled)(struct p9_client *, struct p9_req_t *req);
|
||||||
int (*zc_request)(struct p9_client *, struct p9_req_t *,
|
int (*zc_request)(struct p9_client *, struct p9_req_t *,
|
||||||
char *, char *, int , int, int, int);
|
char *, char *, int , int, int, int);
|
||||||
};
|
};
|
||||||
|
|
|
@ -663,16 +663,13 @@ static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq)
|
||||||
if (IS_ERR(req))
|
if (IS_ERR(req))
|
||||||
return PTR_ERR(req);
|
return PTR_ERR(req);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we haven't received a response for oldreq,
|
* if we haven't received a response for oldreq,
|
||||||
* remove it from the list
|
* remove it from the list
|
||||||
*/
|
*/
|
||||||
if (oldreq->status == REQ_STATUS_FLSH) {
|
if (oldreq->status == REQ_STATUS_FLSH)
|
||||||
spin_lock(&c->lock);
|
if (c->trans_mod->cancelled)
|
||||||
list_del(&oldreq->req_list);
|
c->trans_mod->cancelled(c, oldreq);
|
||||||
spin_unlock(&c->lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
p9_free_req(c, req);
|
p9_free_req(c, req);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -709,6 +709,20 @@ static int p9_fd_cancel(struct p9_client *client, struct p9_req_t *req)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
|
||||||
|
{
|
||||||
|
p9_debug(P9_DEBUG_TRANS, "client %p req %p\n", client, req);
|
||||||
|
|
||||||
|
/* we haven't received a response for oldreq,
|
||||||
|
* remove it from the list.
|
||||||
|
*/
|
||||||
|
spin_lock(&client->lock);
|
||||||
|
list_del(&req->req_list);
|
||||||
|
spin_unlock(&client->lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse_opts - parse mount options into p9_fd_opts structure
|
* parse_opts - parse mount options into p9_fd_opts structure
|
||||||
* @params: options string passed from mount
|
* @params: options string passed from mount
|
||||||
|
@ -1050,6 +1064,7 @@ static struct p9_trans_module p9_tcp_trans = {
|
||||||
.close = p9_fd_close,
|
.close = p9_fd_close,
|
||||||
.request = p9_fd_request,
|
.request = p9_fd_request,
|
||||||
.cancel = p9_fd_cancel,
|
.cancel = p9_fd_cancel,
|
||||||
|
.cancelled = p9_fd_cancelled,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1061,6 +1076,7 @@ static struct p9_trans_module p9_unix_trans = {
|
||||||
.close = p9_fd_close,
|
.close = p9_fd_close,
|
||||||
.request = p9_fd_request,
|
.request = p9_fd_request,
|
||||||
.cancel = p9_fd_cancel,
|
.cancel = p9_fd_cancel,
|
||||||
|
.cancelled = p9_fd_cancelled,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1072,6 +1088,7 @@ static struct p9_trans_module p9_fd_trans = {
|
||||||
.close = p9_fd_close,
|
.close = p9_fd_close,
|
||||||
.request = p9_fd_request,
|
.request = p9_fd_request,
|
||||||
.cancel = p9_fd_cancel,
|
.cancel = p9_fd_cancel,
|
||||||
|
.cancelled = p9_fd_cancelled,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue