summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-11 15:19:55 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-08 19:00:05 +0200
commitba65400c6ee710b8b5857af5825a784b5c2d0d47 (patch)
treea8c19c0b5b490e63b35027813964dfe79d2b3277 /lib/tevent/tevent.c
parent796acbd9ffd20f13f320641b8a27f86624f3d701 (diff)
downloadsamba-ba65400c6ee710b8b5857af5825a784b5c2d0d47.tar.gz
samba-ba65400c6ee710b8b5857af5825a784b5c2d0d47.tar.bz2
samba-ba65400c6ee710b8b5857af5825a784b5c2d0d47.zip
tevent: expose tevent_context_init_ops
This can be used to implement wrapper backends, while passing a private pointer to the backens init function via ev->additional_data. metze
Diffstat (limited to 'lib/tevent/tevent.c')
-rw-r--r--lib/tevent/tevent.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 5247b5ec1c..61ffc7edaa 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -210,8 +210,9 @@ int tevent_common_context_destructor(struct tevent_context *ev)
NOTE: use tevent_context_init() inside of samba!
*/
-static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
- const struct tevent_ops *ops)
+struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
+ const struct tevent_ops *ops,
+ void *additional_data)
{
struct tevent_context *ev;
int ret;
@@ -222,6 +223,7 @@ static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
talloc_set_destructor(ev, tevent_common_context_destructor);
ev->ops = ops;
+ ev->additional_data = additional_data;
ret = ev->ops->context_init(ev);
if (ret != 0) {
@@ -253,7 +255,7 @@ struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx,
for (e=tevent_backends;e;e=e->next) {
if (strcmp(name, e->name) == 0) {
- return tevent_context_init_ops(mem_ctx, e->ops);
+ return tevent_context_init_ops(mem_ctx, e->ops, NULL);
}
}
return NULL;