[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-4797-ga632a1b

Jeremy Allison jra at samba.org
Tue Jan 6 19:24:01 GMT 2009


The branch, v3-3-test has been updated
       via  a632a1bcd694cff03de3456dac582800e94c451e (commit)
      from  f76614169f1e0a932cf2895702cfa9e8a5735875 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit a632a1bcd694cff03de3456dac582800e94c451e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Jan 6 11:22:08 2009 -0800

    s3:events: change event_add_timed() prototype to match samba4
    
    metze

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

Summary of changes:
 source/include/event.h                |    6 ++++--
 source/lib/async_req.c                |    5 ++---
 source/lib/ctdbd_conn.c               |    3 +--
 source/lib/events.c                   |    8 ++++----
 source/lib/smbldap.c                  |   12 ++++++------
 source/modules/vfs_aio_fork.c         |    6 ++----
 source/nmbd/nmbd_processlogon.c       |    3 +--
 source/printing/notify.c              |    3 +--
 source/rpc_server/srv_samr_nt.c       |    3 +--
 source/smbd/blocking.c                |    4 ++--
 source/smbd/fileio.c                  |    3 +--
 source/smbd/oplock.c                  |    3 +--
 source/smbd/process.c                 |   27 +++++++++++++++++----------
 source/utils/smbcontrol.c             |    7 +++----
 source/winbindd/winbindd_cm.c         |    6 ++----
 source/winbindd/winbindd_cred_cache.c |   18 +++---------------
 source/winbindd/winbindd_dual.c       |   11 +++--------
 17 files changed, 54 insertions(+), 74 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/event.h b/source/include/event.h
index 0d5e559..3d40000 100644
--- a/source/include/event.h
+++ b/source/include/event.h
@@ -28,15 +28,17 @@ struct timed_event;
 
 /* The following definitions come from lib/events.c  */
 
-struct timed_event *event_add_timed(struct event_context *event_ctx,
+struct timed_event *_event_add_timed(struct event_context *event_ctx,
 				TALLOC_CTX *mem_ctx,
 				struct timeval when,
 				const char *event_name,
 				void (*handler)(struct event_context *event_ctx,
 						struct timed_event *te,
-						const struct timeval *now,
+						struct timeval now,
 						void *private_data),
 				void *private_data);
+#define event_add_timed(event_ctx, mem_ctx, when, handler, private_data) \
+	_event_add_timed(event_ctx, mem_ctx, when, #handler, handler, private_data)
 struct fd_event *event_add_fd(struct event_context *event_ctx,
 			      TALLOC_CTX *mem_ctx,
 			      int fd, uint16_t flags,
diff --git a/source/lib/async_req.c b/source/lib/async_req.c
index 501a6b5..e8c1935 100644
--- a/source/lib/async_req.c
+++ b/source/lib/async_req.c
@@ -104,12 +104,12 @@ void async_req_error(struct async_req *req, NTSTATUS status)
  * @brief Timed event callback
  * @param[in] ev	Event context
  * @param[in] te	The timed event
- * @param[in] now	current time
+ * @param[in] now	zero time
  * @param[in] priv	The async request to be finished
  */
 
 static void async_trigger(struct event_context *ev, struct timed_event *te,
-			  const struct timeval *now, void *priv)
+			  struct timeval now, void *priv)
 {
 	struct async_req *req = talloc_get_type_abort(priv, struct async_req);
 
@@ -140,7 +140,6 @@ bool async_post_status(struct async_req *req, NTSTATUS status)
 	req->status = status;
 
 	if (event_add_timed(req->event_ctx, req, timeval_zero(),
-			    "async_trigger",
 			    async_trigger, req) == NULL) {
 		return false;
 	}
diff --git a/source/lib/ctdbd_conn.c b/source/lib/ctdbd_conn.c
index 424c316..1b07fd4 100644
--- a/source/lib/ctdbd_conn.c
+++ b/source/lib/ctdbd_conn.c
@@ -200,7 +200,7 @@ struct deferred_msg_state {
 
 static void deferred_message_dispatch(struct event_context *event_ctx,
 				      struct timed_event *te,
-				      const struct timeval *now,
+				      struct timeval now,
 				      void *private_data)
 {
 	struct deferred_msg_state *state = talloc_get_type_abort(
@@ -386,7 +386,6 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32 reqid,
 		evt = event_add_timed(conn->msg_ctx->event_ctx,
 				      conn->msg_ctx->event_ctx,
 				      timeval_zero(),
-				      "deferred_message_dispatch",
 				      deferred_message_dispatch,
 				      msg_state);
 		if (evt == NULL) {
diff --git a/source/lib/events.c b/source/lib/events.c
index d4b9648..0dd8727 100644
--- a/source/lib/events.c
+++ b/source/lib/events.c
@@ -27,7 +27,7 @@ struct timed_event {
 	const char *event_name;
 	void (*handler)(struct event_context *event_ctx,
 			struct timed_event *te,
-			const struct timeval *now,
+			struct timeval now,
 			void *private_data);
 	void *private_data;
 };
@@ -88,13 +88,13 @@ static void add_event_by_time(struct timed_event *te)
  handed to it.
 ****************************************************************************/
 
-struct timed_event *event_add_timed(struct event_context *event_ctx,
+struct timed_event *_event_add_timed(struct event_context *event_ctx,
 				TALLOC_CTX *mem_ctx,
 				struct timeval when,
 				const char *event_name,
 				void (*handler)(struct event_context *event_ctx,
 						struct timed_event *te,
-						const struct timeval *now,
+						struct timeval now,
 						void *private_data),
 				void *private_data)
 {
@@ -241,7 +241,7 @@ bool run_events(struct event_context *event_ctx,
 
 		event_ctx->timed_events->handler(
 			event_ctx,
-			event_ctx->timed_events, &now,
+			event_ctx->timed_events, now,
 			event_ctx->timed_events->private_data);
 
 		fired = True;
diff --git a/source/lib/smbldap.c b/source/lib/smbldap.c
index 9c2ee3a..8e7ecdf 100644
--- a/source/lib/smbldap.c
+++ b/source/lib/smbldap.c
@@ -1014,7 +1014,7 @@ static int smbldap_connect_system(struct smbldap_state *ldap_state, LDAP * ldap_
 
 static void smbldap_idle_fn(struct event_context *event_ctx,
 			    struct timed_event *te,
-			    const struct timeval *now,
+			    struct timeval now,
 			    void *private_data);
 
 /**********************************************************************
@@ -1079,7 +1079,7 @@ static int smbldap_open(struct smbldap_state *ldap_state)
 		ldap_state->idle_event = event_add_timed(
 			ldap_state->event_context, NULL,
 			timeval_current_ofs(SMBLDAP_IDLE_TIME, 0),
-			"smbldap_idle_fn", smbldap_idle_fn, ldap_state);
+			smbldap_idle_fn, ldap_state);
 	}
 
 	DEBUG(4,("The LDAP server is successfully connected\n"));
@@ -1572,7 +1572,7 @@ int smbldap_search_suffix (struct smbldap_state *ldap_state,
 
 static void smbldap_idle_fn(struct event_context *event_ctx,
 			    struct timed_event *te,
-			    const struct timeval *now,
+			    struct timeval now,
 			    void *private_data)
 {
 	struct smbldap_state *state = (struct smbldap_state *)private_data;
@@ -1584,13 +1584,13 @@ static void smbldap_idle_fn(struct event_context *event_ctx,
 		return;
 	}
 		
-	if ((state->last_use+SMBLDAP_IDLE_TIME) > now->tv_sec) {
+	if ((state->last_use+SMBLDAP_IDLE_TIME) > now.tv_sec) {
 		DEBUG(10,("ldap connection not idle...\n"));
 
 		state->idle_event = event_add_timed(
 			event_ctx, NULL,
-			timeval_add(now, SMBLDAP_IDLE_TIME, 0),
-			"smbldap_idle_fn", smbldap_idle_fn,
+			timeval_add(&now, SMBLDAP_IDLE_TIME, 0),
+			smbldap_idle_fn,
 			private_data);
 		return;
 	}
diff --git a/source/modules/vfs_aio_fork.c b/source/modules/vfs_aio_fork.c
index 7914e8f..30b14f2 100644
--- a/source/modules/vfs_aio_fork.c
+++ b/source/modules/vfs_aio_fork.c
@@ -216,7 +216,7 @@ static ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd)
 
 static void aio_child_cleanup(struct event_context *event_ctx,
 			      struct timed_event *te,
-			      const struct timeval *now,
+			      struct timeval now,
 			      void *private_data)
 {
 	struct aio_child_list *list = talloc_get_type_abort(
@@ -252,8 +252,7 @@ static void aio_child_cleanup(struct event_context *event_ctx,
 		 * Re-schedule the next cleanup round
 		 */
 		list->cleanup_event = event_add_timed(smbd_event_context(), list,
-						      timeval_add(now, 30, 0),
-						      "aio_child_cleanup",
+						      timeval_add(&now, 30, 0),
 						      aio_child_cleanup, list);
 
 	}
@@ -284,7 +283,6 @@ static struct aio_child_list *init_aio_children(struct vfs_handle_struct *handle
 	if (data->cleanup_event == NULL) {
 		data->cleanup_event = event_add_timed(smbd_event_context(), data,
 						      timeval_current_ofs(30, 0),
-						      "aio_child_cleanup",
 						      aio_child_cleanup, data);
 		if (data->cleanup_event == NULL) {
 			TALLOC_FREE(data);
diff --git a/source/nmbd/nmbd_processlogon.c b/source/nmbd/nmbd_processlogon.c
index 814eaf7..54e868a 100644
--- a/source/nmbd/nmbd_processlogon.c
+++ b/source/nmbd/nmbd_processlogon.c
@@ -52,7 +52,7 @@ static bool delay_logon(const char *peer_name, const char *peer_addr)
 
 static void delayed_init_logon_handler(struct event_context *event_ctx,
 				       struct timed_event *te,
-				       const struct timeval *now,
+				       struct timeval now,
 				       void *private_data)
 {
 	struct packet_struct *p = (struct packet_struct *)private_data;
@@ -657,7 +657,6 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
 					event_add_timed(nmbd_event_context(),
 							NULL,
 							when,
-							"delayed_init_logon",
 							delayed_init_logon_handler,
 							p);
 				} else {
diff --git a/source/printing/notify.c b/source/printing/notify.c
index b24a8a5..860a400 100644
--- a/source/printing/notify.c
+++ b/source/printing/notify.c
@@ -221,7 +221,7 @@ void print_notify_send_messages(struct messaging_context *msg_ctx,
 
 static void print_notify_event_send_messages(struct event_context *event_ctx,
 					struct timed_event *te,
-					const struct timeval *now,
+					struct timeval now,
 					void *private_data)
 {
 	/* Remove this timed event handler. */
@@ -326,7 +326,6 @@ to notify_queue_head\n", msg->type, msg->field, msg->printer));
 		/* Add an event for 1 second's time to send this queue. */
 		notify_event = event_add_timed(smbd_event_context(), NULL,
 					timeval_current_ofs(1,0),
-					"print_notify",
 					print_notify_event_send_messages, NULL);
 	}
 
diff --git a/source/rpc_server/srv_samr_nt.c b/source/rpc_server/srv_samr_nt.c
index 2c27f30..7b2fe6f 100644
--- a/source/rpc_server/srv_samr_nt.c
+++ b/source/rpc_server/srv_samr_nt.c
@@ -454,7 +454,7 @@ static void free_samr_info(void *ptr)
 
 static void disp_info_cache_idle_timeout_handler(struct event_context *ev_ctx,
 						 struct timed_event *te,
-						 const struct timeval *now,
+						 struct timeval now,
 						 void *private_data)
 {
 	DISP_INFO *disp_info = (DISP_INFO *)private_data;
@@ -483,7 +483,6 @@ static void set_disp_info_cache_timeout(DISP_INFO *disp_info, time_t secs_fromno
 	disp_info->cache_timeout_event = event_add_timed(
 		smbd_event_context(), NULL,
 		timeval_current_ofs(secs_fromnow, 0),
-		"disp_info_cache_idle_timeout_handler",
 		disp_info_cache_idle_timeout_handler, (void *)disp_info);
 }
 
diff --git a/source/smbd/blocking.c b/source/smbd/blocking.c
index 479361a..2c37fea 100644
--- a/source/smbd/blocking.c
+++ b/source/smbd/blocking.c
@@ -81,7 +81,7 @@ static void process_blocking_lock_queue(void);
 
 static void brl_timeout_fn(struct event_context *event_ctx,
 			   struct timed_event *te,
-			   const struct timeval *now,
+			   struct timeval now,
 			   void *private_data)
 {
 	SMB_ASSERT(brl_timeout == te);
@@ -136,7 +136,7 @@ static bool recalc_brl_timeout(void)
 	}
 
 	if (!(brl_timeout = event_add_timed(smbd_event_context(), NULL,
-					    next_timeout, "brl_timeout",
+					    next_timeout,
 					    brl_timeout_fn, NULL))) {
 		return False;
 	}
diff --git a/source/smbd/fileio.c b/source/smbd/fileio.c
index e67f926..30253d4 100644
--- a/source/smbd/fileio.c
+++ b/source/smbd/fileio.c
@@ -173,7 +173,7 @@ static int wcp_file_size_change(files_struct *fsp)
 
 static void update_write_time_handler(struct event_context *ctx,
 				      struct timed_event *te,
-				      const struct timeval *now,
+				      struct timeval now,
 				      void *private_data)
 {
 	files_struct *fsp = (files_struct *)private_data;
@@ -221,7 +221,6 @@ void trigger_write_time_update(struct files_struct *fsp)
 	fsp->update_write_time_event =
 		event_add_timed(smbd_event_context(), NULL,
 				timeval_current_ofs(0, delay),
-				"update_write_time_handler",
 				update_write_time_handler, fsp);
 }
 
diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c
index 4b3ab96..37747c7 100644
--- a/source/smbd/oplock.c
+++ b/source/smbd/oplock.c
@@ -346,7 +346,7 @@ static files_struct *initial_break_processing(struct file_id id, unsigned long f
 
 static void oplock_timeout_handler(struct event_context *ctx,
 				   struct timed_event *te,
-				   const struct timeval *now,
+				   struct timeval now,
 				   void *private_data)
 {
 	files_struct *fsp = (files_struct *)private_data;
@@ -373,7 +373,6 @@ static void add_oplock_timeout_handler(files_struct *fsp)
 	fsp->oplock_timeout =
 		event_add_timed(smbd_event_context(), NULL,
 				timeval_current_ofs(OPLOCK_BREAK_TIMEOUT, 0),
-				"oplock_timeout_handler",
 				oplock_timeout_handler, fsp);
 
 	if (fsp->oplock_timeout == NULL) {
diff --git a/source/smbd/process.c b/source/smbd/process.c
index 3184063..aeb0fc4 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -578,26 +578,33 @@ struct idle_event {
 	void *private_data;
 };
 
-static void idle_event_handler(struct event_context *ctx,
-			       struct timed_event *te,
-			       const struct timeval *now,
-			       void *private_data)
+static void smbd_idle_event_handler(struct event_context *ctx,
+				    struct timed_event *te,
+				    struct timeval now,
+				    void *private_data)
 {
 	struct idle_event *event =
 		talloc_get_type_abort(private_data, struct idle_event);
 
 	TALLOC_FREE(event->te);
 
-	if (!event->handler(now, event->private_data)) {
+	DEBUG(10,("smbd_idle_event_handler: %s %p called\n",
+		  event->name, event->te));
+
+	if (!event->handler(&now, event->private_data)) {
+		DEBUG(10,("smbd_idle_event_handler: %s %p stopped\n",
+			  event->name, event->te));
 		/* Don't repeat, delete ourselves */
 		TALLOC_FREE(event);
 		return;
 	}
 
+	DEBUG(10,("smbd_idle_event_handler: %s %p rescheduled\n",
+		  event->name, event->te));
+
 	event->te = event_add_timed(ctx, event,
-				    timeval_sum(now, &event->interval),
-				    event->name,
-				    idle_event_handler, event);
+				    timeval_sum(&now, &event->interval),
+				    smbd_idle_event_handler, event);
 
 	/* We can't do much but fail here. */
 	SMB_ASSERT(event->te != NULL);
@@ -632,14 +639,14 @@ struct idle_event *event_add_idle(struct event_context *event_ctx,
 
 	result->te = event_add_timed(event_ctx, result,
 				     timeval_sum(&now, &interval),
-				     result->name,
-				     idle_event_handler, result);
+				     smbd_idle_event_handler, result);
 	if (result->te == NULL) {
 		DEBUG(0, ("event_add_timed failed\n"));
 		TALLOC_FREE(result);
 		return NULL;
 	}
 
+	DEBUG(10,("event_add_idle: %s %p\n", result->name, result->te));
 	return result;
 }
 
diff --git a/source/utils/smbcontrol.c b/source/utils/smbcontrol.c
index 750030d..962d119 100644
--- a/source/utils/smbcontrol.c
+++ b/source/utils/smbcontrol.c
@@ -65,9 +65,9 @@ static bool send_message(struct messaging_context *msg_ctx,
 	return ret;
 }
 
-static void timeout_handler(struct event_context *event_ctx,
+static void smbcontrol_timeout(struct event_context *event_ctx,
 			    struct timed_event *te,
-			    const struct timeval *now,
+			    struct timeval now,
 			    void *private_data)
 {
 	bool *timed_out = (bool *)private_data;
@@ -85,8 +85,7 @@ static void wait_replies(struct messaging_context *msg_ctx,
 
 	if (!(te = event_add_timed(messaging_event_context(msg_ctx), NULL,
 				   timeval_current_ofs(timeout, 0),
-				   "smbcontrol_timeout",
-				   timeout_handler, (void *)&timed_out))) {
+				   smbcontrol_timeout, (void *)&timed_out))) {
 		DEBUG(0, ("event_add_timed failed\n"));
 		return;
 	}
diff --git a/source/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c
index c22beb4..c2b7fdb 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -272,7 +272,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain)
 
 static void check_domain_online_handler(struct event_context *ctx,
 					struct timed_event *te,
-					const struct timeval *now,
+					struct timeval now,
 					void *private_data)
 {
         struct winbindd_domain *domain =
@@ -286,7 +286,7 @@ static void check_domain_online_handler(struct event_context *ctx,
 
 	/* Are we still in "startup" mode ? */
 
-	if (domain->startup && (now->tv_sec > domain->startup_time + 30)) {
+	if (domain->startup && (now.tv_sec > domain->startup_time + 30)) {
 		/* No longer in "startup" mode. */
 		DEBUG(10,("check_domain_online_handler: domain %s no longer in 'startup' mode.\n",
 			domain->name ));
@@ -367,7 +367,6 @@ void set_domain_offline(struct winbindd_domain *domain)
 	domain->check_online_event = event_add_timed(winbind_event_context(),
 						NULL,
 						timeval_current_ofs(domain->check_online_timeout,0),
-						"check_domain_online_handler",
 						check_domain_online_handler,
 						domain);
 
@@ -518,7 +517,6 @@ void set_domain_online_request(struct winbindd_domain *domain)
 	domain->check_online_event = event_add_timed(winbind_event_context(),
 						     NULL,
 						     tev,
-						     "check_domain_online_handler",
 						     check_domain_online_handler,
 						     domain);
 
diff --git a/source/winbindd/winbindd_cred_cache.c b/source/winbindd/winbindd_cred_cache.c
index 15e948c..a922a04 100644
--- a/source/winbindd/winbindd_cred_cache.c
+++ b/source/winbindd/winbindd_cred_cache.c
@@ -36,7 +36,7 @@
 static struct WINBINDD_CCACHE_ENTRY *ccache_list;
 static void krb5_ticket_gain_handler(struct event_context *,
 				     struct timed_event *,
-				     const struct timeval *,
+				     struct timeval,
 				     void *);
 
 /* The Krb5 ticket refresh handler should be scheduled
@@ -95,7 +95,7 @@ void ccache_remove_all_after_fork(void)
 
 static void krb5_ticket_refresh_handler(struct event_context *event_ctx,
 					struct timed_event *te,
-					const struct timeval *now,
+					struct timeval now,
 					void *private_data)
 {
 	struct WINBINDD_CCACHE_ENTRY *entry =
@@ -165,7 +165,6 @@ rekinit:
 					entry->event = event_add_timed(winbind_event_context(),
 								       entry, 
 								       timeval_set(new_start, 0),
-								       "krb5_ticket_gain_handler",
 								       krb5_ticket_gain_handler,
 								       entry);
 					return;
@@ -246,7 +245,6 @@ rekinit:
 			entry->event = event_add_timed(winbind_event_context(),
 							entry,
 							timeval_set(new_start, 0),
-							"krb5_ticket_gain_handler",
 							krb5_ticket_gain_handler,
 							entry);
 			return;
@@ -280,7 +278,6 @@ done:
 		entry->refresh_time = 0;
 		entry->event = event_add_timed(winbind_event_context(), entry,
 						timeval_set(expire_time, 0),
-						"krb5_ticket_gain_handler",
 						krb5_ticket_gain_handler,
 						entry);
 		return;
@@ -291,7 +288,6 @@ done:
 	}
 	entry->event = event_add_timed(winbind_event_context(), entry,
 				       timeval_set(new_start, 0),
-				       "krb5_ticket_refresh_handler",
 				       krb5_ticket_refresh_handler,
 				       entry);
 
@@ -304,7 +300,7 @@ done:
 
 static void krb5_ticket_gain_handler(struct event_context *event_ctx,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list