diff options
author | Simo Sorce <idra@samba.org> | 2009-02-28 15:44:30 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-03-02 11:02:09 -0500 |
commit | 67d41d0fc7567cf141b12e866dd227d393e33551 (patch) | |
tree | 117ee0ddd513e0d2008c02d9ff5ead1dd7818ccc /source3/rpc_client | |
parent | 04a2b455a0385fc3aa23850d4841ab3495efc3e6 (diff) | |
download | samba-67d41d0fc7567cf141b12e866dd227d393e33551.tar.gz samba-67d41d0fc7567cf141b12e866dd227d393e33551.tar.bz2 samba-67d41d0fc7567cf141b12e866dd227d393e33551.zip |
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.
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/rpc_transport_sock.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source3/rpc_client/rpc_transport_sock.c b/source3/rpc_client/rpc_transport_sock.c index 658ffe30d6..b1d9d8fbe1 100644 --- a/source3/rpc_client/rpc_transport_sock.c +++ b/source3/rpc_client/rpc_transport_sock.c @@ -61,8 +61,7 @@ static struct async_req *rpc_sock_read_send(TALLOC_CTX *mem_ctx, if (subreq == NULL) { goto fail; } - subreq->async.fn = rpc_sock_read_done; - subreq->async.private_data = result; + tevent_req_set_callback(subreq, rpc_sock_read_done, result); return result; fail: TALLOC_FREE(result); @@ -71,8 +70,8 @@ static struct async_req *rpc_sock_read_send(TALLOC_CTX *mem_ctx, static void rpc_sock_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 rpc_sock_read_state *state = talloc_get_type_abort( req->private_data, struct rpc_sock_read_state); int err; @@ -123,8 +122,7 @@ static struct async_req *rpc_sock_write_send(TALLOC_CTX *mem_ctx, if (subreq == NULL) { goto fail; } - subreq->async.fn = rpc_sock_write_done; - subreq->async.private_data = result; + tevent_req_set_callback(subreq, rpc_sock_write_done, result); return result; fail: TALLOC_FREE(result); @@ -133,8 +131,8 @@ static struct async_req *rpc_sock_write_send(TALLOC_CTX *mem_ctx, static void rpc_sock_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 rpc_sock_write_state *state = talloc_get_type_abort( req->private_data, struct rpc_sock_write_state); int err; |