From 67d41d0fc7567cf141b12e866dd227d393e33551 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 28 Feb 2009 15:44:30 -0500 Subject: Make struct tevent_req opaque Move struct tevent_req in tevent_internal, and ad getters and setters for private data and the callback function. This patch also renames 'private_state' into 'data'. What is held in this pointer is in fact data and not a state like enum tevent_req_state. Calling it 'state' is confusing. The functions addedd are: tevent_req_set_callback() - sets req->async.fn and req->async.private_data tevent_req_set_print_fn() - sets req->private_print tevent_req_callback_data() - gets req->async.private_data tevent_req_data() - gets rea->data This way it is much simpler to keep API/ABI compatibility in the future. --- source3/rpc_server/srv_pipe_hnd.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 33e89c8acb..a5d059c06a 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -1247,14 +1247,13 @@ static void np_write_trigger(struct async_req *req) if (async_req_nomem(subreq, req)) { return; } - subreq->async.fn = np_write_done; - subreq->async.private_data = req; + tevent_req_set_callback(subreq, np_write_done, req); } static void np_write_done(struct tevent_req *subreq) { - struct async_req *req = talloc_get_type_abort( - subreq->async.private_data, struct async_req); + struct async_req *req = + tevent_req_callback_data(subreq, struct async_req); struct np_write_state *state = talloc_get_type_abort( req->private_data, struct np_write_state); ssize_t received; @@ -1398,14 +1397,13 @@ static void np_read_trigger(struct async_req *req) if (async_req_nomem(subreq, req)) { return; } - subreq->async.fn = np_read_done; - subreq->async.private_data = req; + tevent_req_set_callback(subreq, np_read_done, req); } static void np_read_done(struct tevent_req *subreq) { - struct async_req *req = talloc_get_type_abort( - subreq->async.private_data, struct async_req); + struct async_req *req = + tevent_req_callback_data(subreq, struct async_req); struct np_read_state *state = talloc_get_type_abort( req->private_data, struct np_read_state); ssize_t received; -- cgit