diff options
author | Volker Lendecke <vl@samba.org> | 2009-01-03 10:34:59 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-01-03 19:07:57 +0100 |
commit | 27abf6731ed472580157a0447e858e11f6f63f3b (patch) | |
tree | 2e5bbfb63813075ca2980b7d51fcd069031eaadb /source3 | |
parent | 141b76d747a0741cf9175529ec638f4625fcb099 (diff) | |
download | samba-27abf6731ed472580157a0447e858e11f6f63f3b.tar.gz samba-27abf6731ed472580157a0447e858e11f6f63f3b.tar.bz2 samba-27abf6731ed472580157a0447e858e11f6f63f3b.zip |
struct async_req doesn't really need to carry an event_context
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/async_req.h | 12 | ||||
-rw-r--r-- | source3/lib/async_req.c | 9 | ||||
-rw-r--r-- | source3/lib/async_sock.c | 10 | ||||
-rw-r--r-- | source3/libsmb/async_smb.c | 2 | ||||
-rw-r--r-- | source3/libsmb/clireadwrite.c | 10 | ||||
-rw-r--r-- | source3/winbindd/winbindd_reqtrans.c | 10 |
6 files changed, 24 insertions, 29 deletions
diff --git a/source3/include/async_req.h b/source3/include/async_req.h index 14a30696c4..2633027e37 100644 --- a/source3/include/async_req.h +++ b/source3/include/async_req.h @@ -97,13 +97,6 @@ struct async_req { NTSTATUS status; /** - * @brief The event context we are using - * - * The event context that this async request works on. - */ - struct event_context *event_ctx; - - /** * @brief What to do on completion * * This is used for the user of an async request, fn is called when @@ -122,7 +115,7 @@ struct async_req { } async; }; -struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev); +struct async_req *async_req_new(TALLOC_CTX *mem_ctx); char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req); @@ -130,7 +123,8 @@ void async_req_done(struct async_req *req); void async_req_error(struct async_req *req, NTSTATUS status); -bool async_post_status(struct async_req *req, NTSTATUS status); +bool async_post_status(struct async_req *req, struct event_context *ev, + NTSTATUS status); bool async_req_nomem(const void *p, struct async_req *req); diff --git a/source3/lib/async_req.c b/source3/lib/async_req.c index 159666f15c..8c9b2e6b47 100644 --- a/source3/lib/async_req.c +++ b/source3/lib/async_req.c @@ -49,7 +49,7 @@ char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req) * The new async request will be initialized in state ASYNC_REQ_IN_PROGRESS */ -struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev) +struct async_req *async_req_new(TALLOC_CTX *mem_ctx) { struct async_req *result; @@ -58,7 +58,6 @@ struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev) return NULL; } result->state = ASYNC_REQ_IN_PROGRESS; - result->event_ctx = ev; result->print = async_req_print; return result; } @@ -135,12 +134,12 @@ static void async_trigger(struct event_context *ev, struct timed_event *te, * conventions, independent of whether the request was actually deferred. */ -bool async_post_status(struct async_req *req, NTSTATUS status) +bool async_post_status(struct async_req *req, struct event_context *ev, + NTSTATUS status) { req->status = status; - if (event_add_timed(req->event_ctx, req, timeval_zero(), - "async_trigger", + if (event_add_timed(ev, req, timeval_zero(), "async_trigger", async_trigger, req) == NULL) { return false; } diff --git a/source3/lib/async_sock.c b/source3/lib/async_sock.c index 3e9d6f7904..cb545854dd 100644 --- a/source3/lib/async_sock.c +++ b/source3/lib/async_sock.c @@ -106,7 +106,7 @@ static struct async_req *async_syscall_new(TALLOC_CTX *mem_ctx, struct async_req *result; struct async_syscall_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -628,7 +628,8 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, p->old_sockflags = sys_fcntl_long(fd, F_GETFL, 0); if (p->old_sockflags == -1) { - if (async_post_status(result, map_nt_error_from_unix(errno))) { + if (async_post_status(result, ev, + map_nt_error_from_unix(errno))) { return result; } TALLOC_FREE(result); @@ -641,7 +642,7 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, if (state->result.result_int == 0) { state->sys_errno = 0; - if (async_post_status(result, NT_STATUS_OK)) { + if (async_post_status(result, ev, NT_STATUS_OK)) { return result; } sys_fcntl_long(fd, F_SETFL, p->old_sockflags); @@ -664,7 +665,8 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, state->sys_errno = errno; - if (async_post_status(result, map_nt_error_from_unix(errno))) { + if (async_post_status(result, ev, + map_nt_error_from_unix(errno))) { return result; } sys_fcntl_long(fd, F_SETFL, p->old_sockflags); diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 82a919455a..a1fcf8eb07 100644 --- a/source3/libsmb/async_smb.c +++ b/source3/libsmb/async_smb.c @@ -435,7 +435,7 @@ static struct async_req *cli_request_chain(TALLOC_CTX *mem_ctx, req->async = tmp_reqs; req->num_async += 1; - req->async[req->num_async-1] = async_req_new(mem_ctx, ev); + req->async[req->num_async-1] = async_req_new(mem_ctx); if (req->async[req->num_async-1] == NULL) { DEBUG(0, ("async_req_new failed\n")); req->num_async -= 1; diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index b33d0f0938..1d5582e61d 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -278,7 +278,7 @@ struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, struct cli_pull_state *state; int i; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { goto failed; } @@ -302,7 +302,7 @@ struct async_req *cli_pull_send(TALLOC_CTX *mem_ctx, state->top_req = 0; if (size == 0) { - if (!async_post_status(result, NT_STATUS_OK)) { + if (!async_post_status(result, ev, NT_STATUS_OK)) { goto failed; } return result; @@ -843,7 +843,7 @@ static struct async_req *cli_writeall_send(TALLOC_CTX *mem_ctx, struct async_req *subreq; struct cli_writeall_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { goto fail; } @@ -969,7 +969,7 @@ struct async_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct cli_push_state *state; int i; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { goto failed; } @@ -1034,7 +1034,7 @@ struct async_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev, } if (i == 0) { - if (!async_post_status(result, NT_STATUS_OK)) { + if (!async_post_status(result, ev, NT_STATUS_OK)) { goto failed; } return result; diff --git a/source3/winbindd/winbindd_reqtrans.c b/source3/winbindd/winbindd_reqtrans.c index ea16c5f81e..6c4f0f2c75 100644 --- a/source3/winbindd/winbindd_reqtrans.c +++ b/source3/winbindd/winbindd_reqtrans.c @@ -43,7 +43,7 @@ struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx, struct async_req *result, *subreq; struct req_read_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -205,7 +205,7 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx, struct async_req *result, *subreq; struct req_write_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -304,7 +304,7 @@ struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx, struct async_req *result, *subreq; struct resp_read_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -458,7 +458,7 @@ struct async_req *wb_resp_write_send(TALLOC_CTX *mem_ctx, struct async_req *result, *subreq; struct resp_write_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -564,7 +564,7 @@ struct async_req *wb_trans_send(TALLOC_CTX *mem_ctx, struct async_req *result, *subreq; struct wb_trans_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } |