From 097db28c5d2d1014ffe63430dbe6f944807faa5c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 29 Mar 2009 13:28:18 +0200 Subject: Convert cli_write_andx to tevent_req --- source3/rpc_client/rpc_transport_np.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/rpc_transport_np.c b/source3/rpc_client/rpc_transport_np.c index cc8f2e17c6..730a309acf 100644 --- a/source3/rpc_client/rpc_transport_np.c +++ b/source3/rpc_client/rpc_transport_np.c @@ -49,7 +49,7 @@ struct rpc_np_write_state { size_t written; }; -static void rpc_np_write_done(struct async_req *subreq); +static void rpc_np_write_done(struct tevent_req *subreq); static struct tevent_req *rpc_np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, @@ -58,8 +58,7 @@ static struct tevent_req *rpc_np_write_send(TALLOC_CTX *mem_ctx, { struct rpc_transport_np_state *np_transport = talloc_get_type_abort( priv, struct rpc_transport_np_state); - struct tevent_req *req; - struct async_req *subreq; + struct tevent_req *req, *subreq; struct rpc_np_write_state *state; req = tevent_req_create(mem_ctx, &state, struct rpc_np_write_state); @@ -72,21 +71,17 @@ static struct tevent_req *rpc_np_write_send(TALLOC_CTX *mem_ctx, np_transport->fnum, 8, /* 8 means message mode. */ data, 0, size); - if (subreq == NULL) { - goto fail; + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); } - subreq->async.fn = rpc_np_write_done; - subreq->async.priv = req; + tevent_req_set_callback(subreq, rpc_np_write_done, req); return req; - fail: - TALLOC_FREE(req); - return NULL; } -static void rpc_np_write_done(struct async_req *subreq) +static void rpc_np_write_done(struct tevent_req *subreq) { - struct tevent_req *req = talloc_get_type_abort( - subreq->async.priv, struct tevent_req); + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); struct rpc_np_write_state *state = tevent_req_data( req, struct rpc_np_write_state); NTSTATUS status; -- cgit