From 9420eaf44ec4067c3740b91b0be0fede08a0c515 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" <rjones@redhat.com> Date: Fri, 26 Aug 2011 20:28:20 +0100 Subject: Add GUESTFS_EVENT_ENTER event. This event is generated whenever a libguestfs function is called. --- src/events.c | 12 +++++++----- src/guestfs.pod | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/events.c b/src/events.c index aa30fd2e..f707e0be 100644 --- a/src/events.c +++ b/src/events.c @@ -111,12 +111,14 @@ guestfs___call_callbacks_message (guestfs_h *g, uint64_t event, count++; } - /* If nothing was registered and we're verbose or tracing, then we - * print the message on stderr. This essentially emulates the - * behaviour of the old-style handlers, while allowing callers to - * override print-on-stderr simply by registering a callback. + /* Emulate the old-style handlers. Callers can override + * print-on-stderr simply by registering a callback. */ - if (count == 0 && (g->verbose || event == GUESTFS_EVENT_TRACE)) { + if (count == 0 && + (event == GUESTFS_EVENT_APPLIANCE || + event == GUESTFS_EVENT_LIBRARY || + event == GUESTFS_EVENT_TRACE) && + (g->verbose || event == GUESTFS_EVENT_TRACE)) { int from_appliance = event == GUESTFS_EVENT_APPLIANCE; size_t i; char c; diff --git a/src/guestfs.pod b/src/guestfs.pod index 8cb1b867..6ccecedb 100644 --- a/src/guestfs.pod +++ b/src/guestfs.pod @@ -1833,6 +1833,21 @@ If no callback is registered: the messages are sent to stderr. You can override the printing of trace messages to stderr by setting up a callback. +=item GUESTFS_EVENT_ENTER +(payload type: function name) + +The callback function is called whenever a libguestfs function +is entered. + +The payload is a string which contains the name of the function +that we are entering (not including C<guestfs_> prefix). + +Note that libguestfs functions can call themselves, so you may +see many events from a single call. A few libguestfs functions +do not generate this event. + +If no callback is registered: the event is ignored. + =back =head3 guestfs_set_event_callback -- cgit