]> git.samba.org - samba.git/commitdiff
tevent: Flow: store callback function name in tevent_req
authorPavel Filipenský <pfilipensky@samba.org>
Mon, 24 Apr 2023 13:04:06 +0000 (15:04 +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: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Stefan Metzmacher <metze@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 557f2d3619dbe9b56be3b1d2c2036a340ac3501f..1dcb42517931fed63816d5fc3fbb523a0b9cc528 100644 (file)
@@ -19,6 +19,7 @@ _tevent_req_error: bool (struct tevent_req *, uint64_t, const char *)
 _tevent_req_nomem: bool (const void *, struct tevent_req *, const char *)
 _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_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 514e127cc3886eac323ed1448678e486e43a080c..7f442fe3904571227e763c5fadda876590ced0f7 100644 (file)
@@ -1019,6 +1019,13 @@ typedef void (*tevent_req_fn)(struct tevent_req *subreq);
  *                      callback.
  */
 void tevent_req_set_callback(struct tevent_req *req, tevent_req_fn fn, void *pvt);
+void _tevent_req_set_callback(struct tevent_req *req,
+                             tevent_req_fn fn,
+                             const char *fn_name,
+                             void *pvt);
+
+#define tevent_req_set_callback(req, fn, pvt) \
+       _tevent_req_set_callback(req, fn, #fn, pvt)
 
 #ifdef DOXYGEN
 /**
index e6853d148eec28b96f3dcf2d07899e7eb817940d..db0c4a9d96537fcb155b033cff633549f5a56296 100644 (file)
@@ -44,6 +44,10 @@ struct tevent_req {
                 * @brief Private data for the completion function
                 */
                void *private_data;
+               /**
+                * @brief  The completion function name, for flow tracing.
+                */
+               const char *fn_name;
        } async;
 
        /**
index 10e9812ad0fbe16c5b7e7131311b5bfc03ec35e5..a677f437cdd8932e342870739b5d722b82bda559 100644 (file)
@@ -27,6 +27,8 @@
 #include "tevent_internal.h"
 #include "tevent_util.h"
 
+#undef tevent_req_set_callback
+
 char *tevent_req_default_print(struct tevent_req *req, TALLOC_CTX *mem_ctx)
 {
        return talloc_asprintf(mem_ctx,
@@ -380,8 +382,17 @@ void tevent_req_reset_endtime(struct tevent_req *req)
 }
 
 void tevent_req_set_callback(struct tevent_req *req, tevent_req_fn fn, void *pvt)
+{
+       return _tevent_req_set_callback(req, fn, NULL, pvt);
+}
+
+void _tevent_req_set_callback(struct tevent_req *req,
+                             tevent_req_fn fn,
+                             const char *fn_name,
+                             void *pvt)
 {
        req->async.fn = fn;
+       req->async.fn_name = fn_name;
        req->async.private_data = pvt;
 }