[SCM] Samba Shared Repository - branch master updated -
59612beea63f5017d0e3c0370ce1e6ad22275901
Stefan Metzmacher
metze at samba.org
Mon Jan 5 14:08:03 GMT 2009
The branch, master has been updated
via 59612beea63f5017d0e3c0370ce1e6ad22275901 (commit)
via 303c57ef785a6189b16d879cf719998f17ab097a (commit)
via 321d875af91941e3009cffaa6ff7b0718e7ddad3 (commit)
via 83ff9d3bcd5cfe9d060a8b1f0695e5b66be47efd (commit)
via f1aa4457c3dd0c3d6654482ff0dc0b3105a9cc35 (commit)
via c34d5f445aae8180650dd2cae994bd5573870c04 (commit)
via ee5be748e64f6c8f4814ff322e38511a9a65f4fc (commit)
via 077d5cff71bdb95f5829ae27309958e4661e4184 (commit)
via 492d0e351760458e06452ce948d33f346b3fbb52 (commit)
via 94c4376b497445435edc3e02292b1326a05d1d1e (commit)
via f81f21c09b7792915b68cca410e6ec3eb7ee2e0a (commit)
via a1c9e61643eaec5441cf5d79d399b78874eeb703 (commit)
via 2428ec46d82e09b76402ed00b2d369ba2cb417d4 (commit)
via f389b97c698aff9888ae9cdde9eb10e8e9fab4c7 (commit)
via 022e2f81991f12637ca0eeb3a030d4cec69d6fb9 (commit)
from 73875cd344608b591fa884ab99b5f3a10550c149 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 59612beea63f5017d0e3c0370ce1e6ad22275901
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 5 11:53:29 2009 +0100
s3:winbindd: also handle fd events from the winbind_event_context()
metze
commit 303c57ef785a6189b16d879cf719998f17ab097a
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Jan 4 19:29:12 2009 +0100
s3:events: register as tevent backend
metze
commit 321d875af91941e3009cffaa6ff7b0718e7ddad3
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Jan 4 19:27:31 2009 +0100
s3: build lib/tevent staticly into samba3
metze
commit 83ff9d3bcd5cfe9d060a8b1f0695e5b66be47efd
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 10:00:43 2008 +0100
s3:events: get rid of the stupid set_event_dispatch_time() function
metze
commit f1aa4457c3dd0c3d6654482ff0dc0b3105a9cc35
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 09:19:27 2008 +0100
s3:events: get rid of the stupid cancel_named_event() function
metze
commit c34d5f445aae8180650dd2cae994bd5573870c04
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 5 10:22:50 2009 +0100
s3:events: change event_add_timed() prototype to match samba4
metze
commit ee5be748e64f6c8f4814ff322e38511a9a65f4fc
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 5 09:06:05 2009 +0100
s3:events: move prototypes to event.h
metze
commit 077d5cff71bdb95f5829ae27309958e4661e4184
Author: Stefan Metzmacher <metze at samba.org>
Date: Sun Jan 4 19:53:09 2009 +0100
s3:events: remove unused stuff
metze
commit 492d0e351760458e06452ce948d33f346b3fbb52
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 09:56:36 2008 +0100
s3:winbindd: regain tickets for all ccache entries, when we go online
set_event_dispatch_time() is stupid by design and only handles
the first event with a given name.
metze
commit 94c4376b497445435edc3e02292b1326a05d1d1e
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 09:17:20 2008 +0100
s3:winbindd: cancel all ccache entry events and not just one
cancel_named_event() is stupid by design and also only cancels
one single event.
metze
commit f81f21c09b7792915b68cca410e6ec3eb7ee2e0a
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 09:34:20 2008 +0100
s3:winbindd: recreate the per domain check_online_event without relying on global state
set_event_dispatch_time() is stupid by design and just picks the first
event with the given name.
metze
commit a1c9e61643eaec5441cf5d79d399b78874eeb703
Author: Stefan Metzmacher <metze at samba.org>
Date: Mon Jan 5 11:50:17 2009 +0100
s3:winbindd: rename fd_event => winbindd_fd_event
It's really confusing to have two versions of 'fd_event'
metze
commit 2428ec46d82e09b76402ed00b2d369ba2cb417d4
Author: Stefan Metzmacher <metze at samba.org>
Date: Tue Dec 30 09:32:31 2008 +0100
s3:winbindd: move WINBINDD_CCACHE_ENTRY and WINBINDD_MEMORY_CREDS to winbindd.h
metze
commit f389b97c698aff9888ae9cdde9eb10e8e9fab4c7
Author: Bo Yang <boyang at novell.com>
Date: Sun Jan 4 16:45:30 2009 +0800
Fix broken krb5 refresh chain
Signed-off-by: Stefan Metzmacher <metze at samba.org>
commit 022e2f81991f12637ca0eeb3a030d4cec69d6fb9
Author: Bo Yang <boyang at novell.com>
Date: Mon Jan 5 19:47:45 2009 +0800
clean event context after child is forked.
Signed-off-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
nsswitch/winbind_struct_protocol.h | 27 ---
source3/Makefile.in | 3 +-
source3/configure.in | 10 +
source3/include/event.h | 26 ++-
source3/include/includes.h | 3 +-
source3/include/proto.h | 41 +----
source3/include/smb.h | 3 -
source3/lib/async_req.c | 13 +-
source3/lib/ctdbd_conn.c | 3 +-
source3/lib/events.c | 356 +++++++++++++++-----------------
source3/lib/smbldap.c | 12 +-
source3/lib/util.c | 3 +
source3/modules/vfs_aio_fork.c | 6 +-
source3/nmbd/asyncdns.c | 3 +-
source3/nmbd/nmbd.c | 3 +-
source3/nmbd/nmbd_processlogon.c | 3 +-
source3/printing/notify.c | 3 +-
source3/printing/print_cups.c | 3 +-
source3/printing/printing.c | 3 +-
source3/rpc_server/srv_samr_nt.c | 3 +-
source3/smbd/blocking.c | 4 +-
source3/smbd/fileio.c | 3 +-
source3/smbd/oplock.c | 3 +-
source3/smbd/process.c | 27 ++-
source3/smbd/server.c | 7 +-
source3/utils/net_lua.c | 4 +-
source3/utils/smbcontrol.c | 7 +-
source3/winbindd/winbindd.c | 38 +++--
source3/winbindd/winbindd.h | 43 +++-
source3/winbindd/winbindd_cm.c | 52 +++---
source3/winbindd/winbindd_cred_cache.c | 318 ++++++++++++++++++++++++----
source3/winbindd/winbindd_dual.c | 82 +++++---
source3/winbindd/winbindd_proto.h | 10 +-
33 files changed, 679 insertions(+), 446 deletions(-)
Changeset truncated at 500 lines:
diff --git a/nsswitch/winbind_struct_protocol.h b/nsswitch/winbind_struct_protocol.h
index fe3da81..0b3e744 100644
--- a/nsswitch/winbind_struct_protocol.h
+++ b/nsswitch/winbind_struct_protocol.h
@@ -484,31 +484,4 @@ struct winbindd_response {
} extra_data;
};
-struct WINBINDD_MEMORY_CREDS {
- struct WINBINDD_MEMORY_CREDS *next, *prev;
- const char *username; /* lookup key. */
- uid_t uid;
- int ref_count;
- size_t len;
- uint8_t *nt_hash; /* Base pointer for the following 2 */
- uint8_t *lm_hash;
- char *pass;
-};
-
-struct WINBINDD_CCACHE_ENTRY {
- struct WINBINDD_CCACHE_ENTRY *next, *prev;
- const char *principal_name;
- const char *ccname;
- const char *service;
- const char *username;
- const char *realm;
- struct WINBINDD_MEMORY_CREDS *cred_ptr;
- int ref_count;
- uid_t uid;
- time_t create_time;
- time_t renew_until;
- time_t refresh_time;
- struct timed_event *event;
-};
-
#endif
diff --git a/source3/Makefile.in b/source3/Makefile.in
index c13f5ae..d938b94 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -359,7 +359,8 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) \
lib/tallocmsg.o lib/dmallocmsg.o libsmb/smb_signing.o \
lib/iconv.o lib/pam_errors.o intl/lang_tdb.o lib/conn_tdb.o \
lib/adt_tree.o lib/gencache.o \
- lib/module.o lib/events.o lib/ldap_escape.o @CHARSET_STATIC@ \
+ lib/module.o lib/events.o @LIBTEVENT_OBJ0@ \
+ lib/ldap_escape.o @CHARSET_STATIC@ \
lib/secdesc.o lib/util_seaccess.o lib/secace.o lib/secacl.o \
libads/krb5_errs.o lib/system_smbd.o lib/audit.o $(LIBNDR_OBJ) \
lib/file_id.o lib/idmap_cache.o
diff --git a/source3/configure.in b/source3/configure.in
index fc3cb26..6727181 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -31,6 +31,15 @@ for obj in ${TALLOC_OBJ}; do
done
AC_SUBST(LIBTALLOC_OBJ0)
+m4_include(../lib/tevent/libtevent.m4)
+
+LIBTEVENT_OBJ0=""
+for obj in ${TEVENT_OBJ}; do
+ LIBTEVENT_OBJ0="${LIBTEVENT_OBJ0} ${teventdir}/${obj}"
+done
+AC_SUBST(LIBTEVENT_OBJ0)
+LIBS="${LIBS} ${TEVENT_LIBS}"
+
# TODO: These should come from m4_include(lib/tdb/libtdb.m4)
# but currently this fails: things have to get merged from s4.
tdbdir="../lib/tdb"
@@ -50,6 +59,7 @@ AC_SUBST(LIBTDB_OBJ0)
SAMBA_CPPFLAGS="-Iinclude -I${srcdir-.}/include -I. -I${srcdir-.}"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/../lib/replace"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TALLOC_CFLAGS}"
+SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TEVENT_CFLAGS}"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${TDB_CFLAGS}"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/libaddns"
SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} -I${srcdir-.}/librpc"
diff --git a/source3/include/event.h b/source3/include/event.h
index 0465fae..93112a8 100644
--- a/source3/include/event.h
+++ b/source3/include/event.h
@@ -18,7 +18,27 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* bits for file descriptor event flags */
-#define EVENT_FD_READ 1
-#define EVENT_FD_WRITE 2
+#define TEVENT_COMPAT_DEFINES
+#include <tevent.h>
+
+#undef event_context_init
+#define event_context_init(mem_ctx) s3_tevent_context_init(mem_ctx)
+
+/* The following definitions come from lib/events.c */
+
+void event_fd_set_writeable(struct fd_event *fde);
+void event_fd_set_not_writeable(struct fd_event *fde);
+void event_fd_set_readable(struct fd_event *fde);
+void event_fd_set_not_readable(struct fd_event *fde);
+bool event_add_to_select_args(struct event_context *event_ctx,
+ const struct timeval *now,
+ fd_set *read_fds, fd_set *write_fds,
+ struct timeval *timeout, int *maxfd);
+bool run_events(struct event_context *event_ctx,
+ int selrtn, fd_set *read_fds, fd_set *write_fds);
+struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
+ struct timeval *to_ret);
+void event_context_reinit(struct event_context *ev);
+void dump_event_list(struct event_context *event_ctx);
+struct tevent_context *s3_tevent_context_init(TALLOC_CTX *mem_ctx);
diff --git a/source3/include/includes.h b/source3/include/includes.h
index 3f35602..cae627f 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -575,6 +575,8 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
#include "../talloc/talloc.h"
+#include "event.h"
+
#include "../lib/util/data_blob.h"
#include "../lib/util/time.h"
#include "../lib/util/asn1.h"
@@ -643,7 +645,6 @@ struct smb_iconv_convenience *lp_iconv_convenience(void *lp_ctx);
#include "nsswitch/winbind_client.h"
#include "spnego.h"
#include "rpc_client.h"
-#include "event.h"
#include "dbwrap.h"
#include "packet.h"
#include "ctdbd_conn.h"
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6238ba3..cfac164 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -501,46 +501,6 @@ void display_set_stderr(void);
NTSTATUS map_nt_error_from_unix(int unix_error);
int map_errno_from_nt_status(NTSTATUS status);
-/* The following definitions come from lib/events.c */
-
-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,
- void *private_data),
- void *private_data);
-struct fd_event *event_add_fd(struct event_context *event_ctx,
- TALLOC_CTX *mem_ctx,
- int fd, uint16_t flags,
- void (*handler)(struct event_context *event_ctx,
- struct fd_event *event,
- uint16 flags,
- void *private_data),
- void *private_data);
-void event_fd_set_writeable(struct fd_event *fde);
-void event_fd_set_not_writeable(struct fd_event *fde);
-void event_fd_set_readable(struct fd_event *fde);
-void event_fd_set_not_readable(struct fd_event *fde);
-bool event_add_to_select_args(struct event_context *event_ctx,
- const struct timeval *now,
- fd_set *read_fds, fd_set *write_fds,
- struct timeval *timeout, int *maxfd);
-bool events_pending(struct event_context *event_ctx);
-bool run_events(struct event_context *event_ctx,
- int selrtn, fd_set *read_fds, fd_set *write_fds);
-struct timeval *get_timed_events_timeout(struct event_context *event_ctx,
- struct timeval *to_ret);
-int event_loop_once(struct event_context *ev);
-struct event_context *event_context_init(TALLOC_CTX *mem_ctx);
-int set_event_dispatch_time(struct event_context *event_ctx,
- const char *event_name, struct timeval when);
-int cancel_named_event(struct event_context *event_ctx,
- const char *event_name);
-void dump_event_list(struct event_context *event_ctx);
-
/* The following definitions come from lib/fault.c */
void fault_setup(void (*fn)(void *));
void dump_core_setup(const char *progname);
@@ -1183,6 +1143,7 @@ int set_blocking(int fd, bool set);
void smb_msleep(unsigned int t);
void become_daemon(bool Fork, bool no_process_group);
bool reinit_after_fork(struct messaging_context *msg_ctx,
+ struct event_context *ev_ctx,
bool parent_longlived);
bool yesno(const char *p);
void *malloc_(size_t size);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 7fd4fbb..9f6a6f0 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -361,9 +361,6 @@ struct fd_handle {
unsigned long gen_id;
};
-struct event_context;
-struct fd_event;
-struct timed_event;
struct idle_event;
struct share_mode_entry;
struct uuid;
diff --git a/source3/lib/async_req.c b/source3/lib/async_req.c
index ac06df6..13b64ba 100644
--- a/source3/lib/async_req.c
+++ b/source3/lib/async_req.c
@@ -103,12 +103,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);
@@ -139,7 +139,7 @@ bool async_post_status(struct async_req *req, struct event_context *ev,
{
req->status = status;
- if (event_add_timed(ev, req, timeval_zero(), "async_trigger",
+ if (event_add_timed(ev, req, timeval_zero(),
async_trigger, req) == NULL) {
return false;
}
@@ -197,7 +197,7 @@ NTSTATUS async_req_simple_recv(struct async_req *req)
static void async_req_timedout(struct event_context *ev,
struct timed_event *te,
- const struct timeval *now,
+ struct timeval now,
void *priv)
{
struct async_req *req = talloc_get_type_abort(
@@ -211,7 +211,7 @@ bool async_req_set_timeout(struct async_req *req, struct event_context *ev,
{
return (event_add_timed(ev, req,
timeval_current_ofs(to.tv_sec, to.tv_usec),
- "async_req_timedout", async_req_timedout, req)
+ async_req_timedout, req)
!= NULL);
}
@@ -268,7 +268,7 @@ static int async_queue_entry_destructor(struct async_queue_entry *e)
static void async_req_immediate_trigger(struct event_context *ev,
struct timed_event *te,
- const struct timeval *now,
+ struct timeval now,
void *priv)
{
struct async_queue_entry *e = talloc_get_type_abort(
@@ -303,7 +303,6 @@ bool async_req_enqueue(struct async_req_queue *queue, struct event_context *ev,
struct timed_event *te;
te = event_add_timed(ev, e, timeval_zero(),
- "async_req_immediate_trigger",
async_req_immediate_trigger,
e);
if (te == NULL) {
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 75a5133..c94ef80 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/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(
@@ -383,7 +383,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/source3/lib/events.c b/source3/lib/events.c
index 8bbc949..be2fdcb 100644
--- a/source3/lib/events.c
+++ b/source3/lib/events.c
@@ -19,52 +19,19 @@
*/
#include "includes.h"
+#include <tevent_internal.h>
-struct timed_event {
- struct timed_event *next, *prev;
- struct event_context *event_ctx;
- struct timeval when;
- const char *event_name;
- void (*handler)(struct event_context *event_ctx,
- struct timed_event *te,
- const struct timeval *now,
- void *private_data);
- void *private_data;
+struct s3_event_context {
+ struct tevent_context *ev;
+ struct tevent_fd *fd_events;
};
-struct fd_event {
- struct fd_event *prev, *next;
- struct event_context *event_ctx;
- int fd;
- uint16_t flags; /* see EVENT_FD_* flags */
- void (*handler)(struct event_context *event_ctx,
- struct fd_event *event,
- uint16 flags,
- void *private_data);
- void *private_data;
-};
-
-#define EVENT_FD_WRITEABLE(fde) \
- event_set_fd_flags(fde, event_get_fd_flags(fde) | EVENT_FD_WRITE)
-#define EVENT_FD_READABLE(fde) \
- event_set_fd_flags(fde, event_get_fd_flags(fde) | EVENT_FD_READ)
-
-#define EVENT_FD_NOT_WRITEABLE(fde) \
- event_set_fd_flags(fde, event_get_fd_flags(fde) & ~EVENT_FD_WRITE)
-#define EVENT_FD_NOT_READABLE(fde) \
- event_set_fd_flags(fde, event_get_fd_flags(fde) & ~EVENT_FD_READ)
-
-struct event_context {
- struct timed_event *timed_events;
- struct fd_event *fd_events;
-};
-
-static int timed_event_destructor(struct timed_event *te)
+static int s3_event_timer_destructor(struct tevent_timer *te)
{
- DEBUG(10, ("Destroying timed event %lx \"%s\"\n", (unsigned long)te,
- te->event_name));
+ DEBUG(10, ("Destroying timer event %p \"%s\"\n",
+ te, te->handler_name));
if (te->event_ctx != NULL) {
- DLIST_REMOVE(te->event_ctx->timed_events, te);
+ DLIST_REMOVE(te->event_ctx->timer_events, te);
}
return 0;
}
@@ -73,23 +40,23 @@ static int timed_event_destructor(struct timed_event *te)
Add te by time.
****************************************************************************/
-static void add_event_by_time(struct timed_event *te)
+static void add_event_by_time(struct tevent_timer *te)
{
- struct event_context *ctx = te->event_ctx;
- struct timed_event *last_te, *cur_te;
+ struct tevent_context *ctx = te->event_ctx;
+ struct tevent_timer *last_te, *cur_te;
/* Keep the list ordered by time. We must preserve this. */
last_te = NULL;
- for (cur_te = ctx->timed_events; cur_te; cur_te = cur_te->next) {
+ for (cur_te = ctx->timer_events; cur_te; cur_te = cur_te->next) {
/* if the new event comes before the current one break */
- if (!timeval_is_zero(&cur_te->when) &&
- timeval_compare(&te->when, &cur_te->when) < 0) {
+ if (!timeval_is_zero(&cur_te->next_event) &&
+ timeval_compare(&te->next_event, &cur_te->next_event) < 0) {
break;
}
last_te = cur_te;
}
- DLIST_ADD_AFTER(ctx->timed_events, te, last_te);
+ DLIST_ADD_AFTER(ctx->timer_events, te, last_te);
}
/****************************************************************************
@@ -98,115 +65,128 @@ static void add_event_by_time(struct timed_event *te)
handed to it.
****************************************************************************/
-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,
- void *private_data),
- void *private_data)
+static struct tevent_timer *s3_event_add_timer(struct tevent_context *event_ctx,
+ TALLOC_CTX *mem_ctx,
+ struct timeval when,
+ tevent_timer_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- struct timed_event *te;
+ struct tevent_timer *te;
- te = TALLOC_P(mem_ctx, struct timed_event);
+ te = TALLOC_P(mem_ctx, struct tevent_timer);
if (te == NULL) {
DEBUG(0, ("talloc failed\n"));
return NULL;
}
te->event_ctx = event_ctx;
- te->when = when;
- te->event_name = event_name;
+ te->next_event = when;
te->handler = handler;
te->private_data = private_data;
+ te->handler_name = handler_name;
+ te->location = location;
+ te->additional_data = NULL;
add_event_by_time(te);
- talloc_set_destructor(te, timed_event_destructor);
+ talloc_set_destructor(te, s3_event_timer_destructor);
- DEBUG(10, ("Added timed event \"%s\": %lx\n", event_name,
- (unsigned long)te));
+ DEBUG(10, ("Added timed event \"%s\": %p\n", handler_name, te));
return te;
}
-static int fd_event_destructor(struct fd_event *fde)
+static int s3_event_fd_destructor(struct tevent_fd *fde)
{
if (fde->event_ctx != NULL) {
- DLIST_REMOVE(fde->event_ctx->fd_events, fde);
+ struct s3_event_context *ev3;
+ ev3 = talloc_get_type(fde->event_ctx->additional_data,
+ struct s3_event_context);
+ DLIST_REMOVE(ev3->fd_events, fde);
+ }
+ if (fde->close_fn) {
+ fde->close_fn(fde->event_ctx, fde, fde->fd, fde->private_data);
+ fde->fd = -1;
}
return 0;
}
-struct fd_event *event_add_fd(struct event_context *event_ctx,
- TALLOC_CTX *mem_ctx,
- int fd, uint16_t flags,
- void (*handler)(struct event_context *event_ctx,
- struct fd_event *event,
- uint16 flags,
- void *private_data),
- void *private_data)
+static struct tevent_fd *s3_event_add_fd(struct tevent_context *ev,
+ TALLOC_CTX *mem_ctx,
+ int fd,
+ uint16_t flags,
+ tevent_fd_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location)
{
- struct fd_event *fde;
+ struct s3_event_context *ev3 = talloc_get_type(ev->additional_data,
+ struct s3_event_context);
+ struct tevent_fd *fde;
- if (!(fde = TALLOC_P(mem_ctx, struct fd_event))) {
+ if (!(fde = TALLOC_P(mem_ctx, struct tevent_fd))) {
return NULL;
}
- fde->event_ctx = event_ctx;
+ fde->event_ctx = ev;
fde->fd = fd;
fde->flags = flags;
fde->handler = handler;
+ fde->close_fn = NULL;
fde->private_data = private_data;
+ fde->handler_name = handler_name;
+ fde->location = location;
- DLIST_ADD(event_ctx->fd_events, fde);
+ DLIST_ADD(ev3->fd_events, fde);
- talloc_set_destructor(fde, fd_event_destructor);
+ talloc_set_destructor(fde, s3_event_fd_destructor);
return fde;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list