From c34d5f445aae8180650dd2cae994bd5573870c04 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 5 Jan 2009 10:22:50 +0100 Subject: s3:events: change event_add_timed() prototype to match samba4 metze --- source3/smbd/blocking.c | 4 ++-- source3/smbd/fileio.c | 3 +-- source3/smbd/oplock.c | 3 +-- source3/smbd/process.c | 27 +++++++++++++++++---------- 4 files changed, 21 insertions(+), 16 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 2237a89ace6..2b90d24c878 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -68,7 +68,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); @@ -123,7 +123,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/source3/smbd/fileio.c b/source3/smbd/fileio.c index e67f926a049..30253d44664 100644 --- a/source3/smbd/fileio.c +++ b/source3/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/source3/smbd/oplock.c b/source3/smbd/oplock.c index 261d8fd6702..6efa3dcfc62 100644 --- a/source3/smbd/oplock.c +++ b/source3/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/source3/smbd/process.c b/source3/smbd/process.c index 67e6067b260..cd9eaa6b1ed 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -583,26 +583,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); @@ -637,14 +644,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; } -- cgit v1.2.1