[SCM] Samba Shared Repository - branch master updated - b6138bf4f22e7a093d35e2f23992595acae55068

Volker Lendecke vlendec at samba.org
Sat Jan 3 18:03:03 GMT 2009


The branch, master has been updated
       via  b6138bf4f22e7a093d35e2f23992595acae55068 (commit)
       via  27abf6731ed472580157a0447e858e11f6f63f3b (commit)
      from  141b76d747a0741cf9175529ec638f4625fcb099 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit b6138bf4f22e7a093d35e2f23992595acae55068
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 27 18:42:45 2008 +0100

    Fix retval of async_syscall_result_int

commit 27abf6731ed472580157a0447e858e11f6f63f3b
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jan 3 10:34:59 2009 +0100

    struct async_req doesn't really need to carry an event_context

-----------------------------------------------------------------------

Summary of changes:
 source3/include/async_req.h          |   12 +++---------
 source3/include/async_sock.h         |    2 +-
 source3/lib/async_req.c              |    9 ++++-----
 source3/lib/async_sock.c             |   12 +++++++-----
 source3/libsmb/async_smb.c           |    2 +-
 source3/libsmb/clireadwrite.c        |   10 +++++-----
 source3/winbindd/winbindd_reqtrans.c |   10 +++++-----
 7 files changed, 26 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/async_req.h b/source3/include/async_req.h
index 14a3069..2633027 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/include/async_sock.h b/source3/include/async_sock.h
index f0cd5fd..892ffef 100644
--- a/source3/include/async_sock.h
+++ b/source3/include/async_sock.h
@@ -24,7 +24,7 @@
 
 ssize_t async_syscall_result_ssize_t(struct async_req *req, int *perrno);
 size_t async_syscall_result_size_t(struct async_req *req, int *perrno);
-ssize_t async_syscall_result_int(struct async_req *req, int *perrno);
+int async_syscall_result_int(struct async_req *req, int *perrno);
 
 struct async_req *async_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
 			     int fd, const void *buffer, size_t length,
diff --git a/source3/lib/async_req.c b/source3/lib/async_req.c
index 159666f..8c9b2e6 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 3e9d6f7..107d140 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;
 	}
@@ -209,7 +209,7 @@ size_t async_syscall_result_size_t(struct async_req *req, int *perrno)
  * @retval The return value from the asynchronously called syscall
  */
 
-ssize_t async_syscall_result_int(struct async_req *req, int *perrno)
+int async_syscall_result_int(struct async_req *req, int *perrno)
 {
 	struct async_syscall_state *state = talloc_get_type_abort(
 		req->private_data, struct async_syscall_state);
@@ -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 82a9194..a1fcf8e 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 b33d0f0..1d5582e 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 ea16c5f..6c4f0f2 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;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list