summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-02 13:39:56 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-02 18:16:53 +0100
commit4f04b06ac2cfceddaabcbf661f9878ff69a6f01b (patch)
tree96788f8f0e71b9e517b63ba53f9e31ac8133626e
parentd79fc2ffcd9802d927f82f014c2b13c7eb8cc873 (diff)
downloadsamba-4f04b06ac2cfceddaabcbf661f9878ff69a6f01b.tar.gz
samba-4f04b06ac2cfceddaabcbf661f9878ff69a6f01b.tar.bz2
samba-4f04b06ac2cfceddaabcbf661f9878ff69a6f01b.zip
tevent: rename ev_debug_ops => tevent_debug_ops
And related changes, but we keep compat macros metze
-rw-r--r--lib/tevent/tevent.h28
-rw-r--r--lib/tevent/tevent_aio.c3
-rw-r--r--lib/tevent/tevent_debug.c32
-rw-r--r--lib/tevent/tevent_epoll.c12
-rw-r--r--lib/tevent/tevent_internal.h18
-rw-r--r--lib/tevent/tevent_select.c4
-rw-r--r--lib/tevent/tevent_standard.c14
7 files changed, 69 insertions, 42 deletions
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index fd6b613b9d..f4e04355e6 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -119,6 +119,22 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
#define TEVENT_FD_NOT_READABLE(fde) \
tevent_fd_set_flags(fde, tevent_fd_get_flags(fde) & ~TEVENT_FD_READ)
+/* DEBUG */
+enum tevent_debug_level {
+ TEVENT_DEBUG_FATAL,
+ TEVENT_DEBUG_ERROR,
+ TEVENT_DEBUG_WARNING,
+ TEVENT_DEBUG_TRACE
+};
+
+int tevent_set_debug(struct tevent_context *ev,
+ void (*debug)(void *context,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0),
+ void *context);
+int tevent_set_debug_stderr(struct tevent_context *ev);
+
/* for now always define the compat symbols */
#ifndef TEVENT_COMPAT_DEFINES
#define TEVENT_COMPAT_DEFINES 1
@@ -190,6 +206,18 @@ void tevent_fd_set_flags(struct tevent_fd *fde, uint16_t flags);
#define EVENT_FD_NOT_READABLE(fde) \
TEVENT_FD_NOT_READABLE(fde)
+#define ev_debug_level tevent_debug_level
+
+#define EV_DEBUG_FATAL TEVENT_DEBUG_FATAL
+#define EV_DEBUG_ERROR TEVENT_DEBUG_ERROR
+#define EV_DEBUG_WARNING TEVENT_DEBUG_WARNING
+#define EV_DEBUG_TRACE TEVENT_DEBUG_TRACE
+
+#define ev_set_debug(ev, debug, context) \
+ tevent_set_debug(ev, debug, context)
+
+#define ev_set_debug_stderr(_ev) tevent_set_debug_stderr(ev)
+
#endif /* TEVENT_COMPAT_DEFINES */
#endif /* __TEVENT_H__ */
diff --git a/lib/tevent/tevent_aio.c b/lib/tevent/tevent_aio.c
index f3045fbf97..f59a7505ab 100644
--- a/lib/tevent/tevent_aio.c
+++ b/lib/tevent/tevent_aio.c
@@ -114,7 +114,8 @@ static void epoll_check_reopen(struct aio_event_context *aio_ev)
close(aio_ev->epoll_fd);
aio_ev->epoll_fd = epoll_create(MAX_AIO_QUEUE_DEPTH);
if (aio_ev->epoll_fd == -1) {
- ev_debug(aio_ev->ev, EV_DEBUG_FATAL, "Failed to recreate epoll handle after fork\n");
+ tevent_debug(aio_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
aio_ev->pid = getpid();
diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c
index 4fa58534b4..841446bf6c 100644
--- a/lib/tevent/tevent_debug.c
+++ b/lib/tevent/tevent_debug.c
@@ -30,10 +30,12 @@
/*
this allows the user to choose their own debug function
*/
-int ev_set_debug(struct tevent_context *ev,
- void (*debug)(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap),
- void *context)
+int tevent_set_debug(struct tevent_context *ev,
+ void (*debug)(void *context,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0),
+ void *context)
{
ev->debug_ops.debug = debug;
ev->debug_ops.context = context;
@@ -43,23 +45,26 @@ int ev_set_debug(struct tevent_context *ev,
/*
debug function for ev_set_debug_stderr
*/
-void ev_debug_stderr(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
-void ev_debug_stderr(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap)
+static void tevent_debug_stderr(void *private_data,
+ enum tevent_debug_level level,
+ const char *fmt,
+ va_list ap) PRINTF_ATTRIBUTE(3,0);
+static void tevent_debug_stderr(void *private_data,
+ enum tevent_debug_level level,
+ const char *fmt, va_list ap)
{
- if (level <= EV_DEBUG_WARNING) {
+ if (level <= TEVENT_DEBUG_WARNING) {
vfprintf(stderr, fmt, ap);
}
}
/*
convenience function to setup debug messages on stderr
- messages of level EV_DEBUG_WARNING and higher are printed
+ messages of level TEVENT_DEBUG_WARNING and higher are printed
*/
-int ev_set_debug_stderr(struct tevent_context *ev)
+int tevent_set_debug_stderr(struct tevent_context *ev)
{
- return ev_set_debug(ev, ev_debug_stderr, ev);
+ return tevent_set_debug(ev, tevent_debug_stderr, ev);
}
/*
@@ -70,7 +75,8 @@ int ev_set_debug_stderr(struct tevent_context *ev)
* Applications using the library must decide where to
* redirect debugging messages
*/
-void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...)
+void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level,
+ const char *fmt, ...)
{
va_list ap;
if (ev->debug_ops.debug == NULL) {
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index d2703eda6c..8e93004ff3 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -58,7 +58,7 @@ struct epoll_event_context {
*/
static void epoll_panic(struct epoll_event_context *epoll_ev, const char *reason)
{
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
"%s (%s) - calling abort()\n", reason, strerror(errno));
abort();
}
@@ -116,8 +116,8 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev)
close(epoll_ev->epoll_fd);
epoll_ev->epoll_fd = epoll_create(64);
if (epoll_ev->epoll_fd == -1) {
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
- "Failed to recreate epoll handle after fork\n");
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
epoll_ev->pid = getpid();
@@ -176,9 +176,9 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_
event.events = epoll_map_flags(fde->flags);
event.data.ptr = fde;
if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event) != 0) {
- ev_debug(epoll_ev->ev, EV_DEBUG_FATAL,
- "epoll_del_event failed! probable early close bug (%s)\n",
- strerror(errno));
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
+ "epoll_del_event failed! probable early close bug (%s)\n",
+ strerror(errno));
}
fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
}
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 408136dc71..46ba1b1655 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -111,22 +111,14 @@ struct tevent_signal {
void *additional_data;
};
-/* DEBUG */
-enum ev_debug_level {EV_DEBUG_FATAL, EV_DEBUG_ERROR,
- EV_DEBUG_WARNING, EV_DEBUG_TRACE};
-
-struct ev_debug_ops {
- void (*debug)(void *context, enum ev_debug_level level,
+struct tevent_debug_ops {
+ void (*debug)(void *context, enum tevent_debug_level level,
const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0);
void *context;
};
-int ev_set_debug(struct tevent_context *ev,
- void (*debug)(void *context, enum ev_debug_level level,
- const char *fmt, va_list ap) PRINTF_ATTRIBUTE(3,0),
- void *context);
-int ev_set_debug_stderr(struct tevent_context *ev);
-void ev_debug(struct tevent_context *ev, enum ev_debug_level level, const char *fmt, ...);
+void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level,
+ const char *fmt, ...) PRINTF_ATTRIBUTE(3,4);
/* aio event is private to the aio backend */
struct tevent_aio;
@@ -148,7 +140,7 @@ struct tevent_context {
struct tevent_fd *pipe_fde;
/* debugging operations */
- struct ev_debug_ops debug_ops;
+ struct tevent_debug_ops debug_ops;
};
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index b082400a8e..06bc1aa0c9 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -220,8 +220,8 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
made readable and that should have removed
the event, so this must be a bug. This is a
fatal error. */
- ev_debug(select_ev->ev, EV_DEBUG_FATAL,
- "ERROR: EBADF on select_event_loop_once\n");
+ tevent_debug(select_ev->ev, TEVENT_DEBUG_FATAL,
+ "ERROR: EBADF on select_event_loop_once\n");
select_ev->exit_code = EBADF;
return -1;
}
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 05310a5864..762b834952 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -71,9 +71,9 @@ struct std_event_context {
*/
static void epoll_fallback_to_select(struct std_event_context *std_ev, const char *reason)
{
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "%s (%s) - falling back to select()\n",
- reason, strerror(errno));
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "%s (%s) - falling back to select()\n",
+ reason, strerror(errno));
close(std_ev->epoll_fd);
std_ev->epoll_fd = -1;
talloc_set_destructor(std_ev, NULL);
@@ -130,8 +130,8 @@ static void epoll_check_reopen(struct std_event_context *std_ev)
close(std_ev->epoll_fd);
std_ev->epoll_fd = epoll_create(64);
if (std_ev->epoll_fd == -1) {
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "Failed to recreate epoll handle after fork\n");
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "Failed to recreate epoll handle after fork\n");
return;
}
std_ev->pid = getpid();
@@ -516,8 +516,8 @@ static int std_event_loop_select(struct std_event_context *std_ev, struct timeva
made readable and that should have removed
the event, so this must be a bug. This is a
fatal error. */
- ev_debug(std_ev->ev, EV_DEBUG_FATAL,
- "ERROR: EBADF on std_event_loop_once\n");
+ tevent_debug(std_ev->ev, TEVENT_DEBUG_FATAL,
+ "ERROR: EBADF on std_event_loop_once\n");
std_ev->exit_code = EBADF;
return -1;
}