]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tevent: Flow: store cleanup function name in tevent_req
authorStefan Metzmacher <metze@samba.org>
Tue, 23 May 2023 04:39:06 +0000 (06:39 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 19 Jul 2023 08:02:33 +0000 (08:02 +0000)
Note the tevent-0.14.1.sigs changes will be reverted in
the 'tevent 0.15.0' commit.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
lib/tevent/ABI/tevent-0.14.1.sigs
lib/tevent/tevent.h
lib/tevent/tevent_internal.h
lib/tevent/tevent_req.c

index 9be4dafcd1e8b72cc8edd901a5ac553b1e29e018..bdc29800dc58135fb038bdeafeeee388b060dff1 100644 (file)
@@ -24,6 +24,7 @@ _tevent_req_notify_callback: void (struct tevent_req *, const char *)
 _tevent_req_oom: void (struct tevent_req *, const char *)
 _tevent_req_set_callback: void (struct tevent_req *, tevent_req_fn, const char *, void *)
 _tevent_req_set_cancel_fn: void (struct tevent_req *, tevent_req_cancel_fn, const char *)
+_tevent_req_set_cleanup_fn: void (struct tevent_req *, tevent_req_cleanup_fn, const char *)
 _tevent_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *)
 _tevent_threaded_schedule_immediate: void (struct tevent_threaded_context *, struct tevent_immediate *, tevent_immediate_handler_t, void *, const char *, const char *)
 tevent_abort: void (struct tevent_context *, const char *)
index b59c5792606863a511daa6e739e9330d6a0137bc..93c0983489221e68112cf43668d5cef4fcf8a07a 100644 (file)
@@ -1248,6 +1248,11 @@ typedef void (*tevent_req_cleanup_fn)(struct tevent_req *req,
  * @param[in]  fn       A pointer to the cancel function.
  */
 void tevent_req_set_cleanup_fn(struct tevent_req *req, tevent_req_cleanup_fn fn);
+void _tevent_req_set_cleanup_fn(struct tevent_req *req,
+                               tevent_req_cleanup_fn fn,
+                               const char *fn_name);
+#define tevent_req_set_cleanup_fn(req, fn) \
+       _tevent_req_set_cleanup_fn(req, fn, #fn)
 
 #ifdef DOXYGEN
 /**
index d8b07eba26dd4db905aef3ead3e2d21e979fcdf5..9c159c3d4097e9a721c7a0a8e64466f334a1af3f 100644 (file)
@@ -89,6 +89,7 @@ struct tevent_req {
         */
        struct {
                tevent_req_cleanup_fn fn;
+               const char *fn_name;
                enum tevent_req_state state;
        } private_cleanup;
 
index 0681f3c46d21f38edc34ea8161d74643fd2f3979..02f3dc8ebe095efcf6930f21ad5fe0c0a21249d2 100644 (file)
@@ -29,6 +29,7 @@
 
 #undef tevent_req_set_callback
 #undef tevent_req_set_cancel_fn
+#undef tevent_req_set_cleanup_fn
 
 char *tevent_req_default_print(struct tevent_req *req, TALLOC_CTX *mem_ctx)
 {
@@ -436,9 +437,17 @@ bool _tevent_req_cancel(struct tevent_req *req, const char *location)
 }
 
 void tevent_req_set_cleanup_fn(struct tevent_req *req, tevent_req_cleanup_fn fn)
+{
+       _tevent_req_set_cleanup_fn(req, fn, NULL);
+}
+
+void _tevent_req_set_cleanup_fn(struct tevent_req *req,
+                               tevent_req_cleanup_fn fn,
+                               const char *fn_name)
 {
        req->private_cleanup.state = req->internal.state;
        req->private_cleanup.fn = fn;
+       req->private_cleanup.fn_name = fn != NULL ? fn_name : NULL;
 }
 
 static int tevent_req_profile_destructor(struct tevent_req_profile *p);