diff options
author | Volker Lendecke <vl@samba.org> | 2009-03-08 09:35:13 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-03-08 11:20:59 +0100 |
commit | 9a64d7cfbedec6fc634b523c2185213c136a5074 (patch) | |
tree | b9618b6279e233ec5de5b718233bc83a7b761822 /source3/lib | |
parent | f5ee31602c7880b11dff82258764eb9a76cdc83b (diff) | |
download | samba-9a64d7cfbedec6fc634b523c2185213c136a5074.tar.gz samba-9a64d7cfbedec6fc634b523c2185213c136a5074.tar.bz2 samba-9a64d7cfbedec6fc634b523c2185213c136a5074.zip |
Convert wb_req_write to tevent_req
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/wb_reqtrans.c | 28 | ||||
-rw-r--r-- | source3/lib/wbclient.c | 27 |
2 files changed, 28 insertions, 27 deletions
diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c index 2051696a02..9fcef0bb76 100644 --- a/source3/lib/wb_reqtrans.c +++ b/source3/lib/wb_reqtrans.c @@ -222,17 +222,17 @@ struct req_write_state { static void wb_req_write_done(struct tevent_req *subreq); -struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, int fd, - struct winbindd_request *wb_req) +struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct tevent_queue *queue, int fd, + struct winbindd_request *wb_req) { - struct async_req *result; - struct tevent_req *subreq; + struct tevent_req *result, *subreq; struct req_write_state *state; int count = 1; - if (!async_req_setup(mem_ctx, &result, &state, - struct req_write_state)) { + result = tevent_req_create(mem_ctx, &state, struct req_write_state); + if (result == NULL) { return NULL; } @@ -245,7 +245,7 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx, count = 2; } - subreq = writev_send(state, ev, NULL, fd, state->iov, count); + subreq = writev_send(state, ev, queue, fd, state->iov, count); if (subreq == NULL) { goto fail; } @@ -259,23 +259,23 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx, static void wb_req_write_done(struct tevent_req *subreq) { - struct async_req *req = - tevent_req_callback_data(subreq, struct async_req); + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); int err; ssize_t ret; ret = writev_recv(subreq, &err); TALLOC_FREE(subreq); if (ret < 0) { - async_req_error(req, map_wbc_err_from_errno(err)); + tevent_req_error(req, map_wbc_err_from_errno(err)); return; } - async_req_done(req); + tevent_req_done(req); } -wbcErr wb_req_write_recv(struct async_req *req) +wbcErr wb_req_write_recv(struct tevent_req *req) { - return async_req_simple_recv_wbcerr(req); + return tevent_req_simple_recv_wbcerr(req); } struct resp_read_state { diff --git a/source3/lib/wbclient.c b/source3/lib/wbclient.c index 7034e668ed..254e57b5f2 100644 --- a/source3/lib/wbclient.c +++ b/source3/lib/wbclient.c @@ -294,7 +294,7 @@ struct wb_int_trans_state { struct winbindd_response *wb_resp; }; -static void wb_int_trans_write_done(struct async_req *subreq); +static void wb_int_trans_write_done(struct tevent_req *subreq); static void wb_int_trans_read_done(struct async_req *subreq); static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx, @@ -302,7 +302,7 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx, struct winbindd_request *wb_req) { struct async_req *result; - struct async_req *subreq; + struct tevent_req *subreq; struct wb_int_trans_state *state; if (!async_req_setup(mem_ctx, &result, &state, @@ -325,12 +325,12 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx, state->wb_req->length = sizeof(struct winbindd_request); state->wb_req->pid = getpid(); - subreq = wb_req_write_send(state, state->ev, state->fd, state->wb_req); + subreq = wb_req_write_send(state, state->ev, NULL, state->fd, + state->wb_req); if (subreq == NULL) { goto fail; } - subreq->async.fn = wb_int_trans_write_done; - subreq->async.priv = result; + tevent_req_set_callback(subreq, wb_int_trans_write_done, result); return result; @@ -339,12 +339,13 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx, return NULL; } -static void wb_int_trans_write_done(struct async_req *subreq) +static void wb_int_trans_write_done(struct tevent_req *subreq) { - struct async_req *req = talloc_get_type_abort( - subreq->async.priv, struct async_req); + struct async_req *req = tevent_req_callback_data( + subreq, struct async_req); struct wb_int_trans_state *state = talloc_get_type_abort( req->private_data, struct wb_int_trans_state); + struct async_req *subreq2; wbcErr wbc_err; wbc_err = wb_req_write_recv(subreq); @@ -354,12 +355,12 @@ static void wb_int_trans_write_done(struct async_req *subreq) return; } - subreq = wb_resp_read_send(state, state->ev, state->fd); - if (subreq == NULL) { - async_req_error(req, WBC_ERR_NO_MEMORY); + subreq2 = wb_resp_read_send(state, state->ev, state->fd); + if (async_req_nomem(subreq2, req)) { + return; } - subreq->async.fn = wb_int_trans_read_done; - subreq->async.priv = req; + subreq2->async.fn = wb_int_trans_read_done; + subreq2->async.priv = req; } static void wb_int_trans_read_done(struct async_req *subreq) |