summaryrefslogtreecommitdiffstats
path: root/fish/progress.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-03-10 12:32:22 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-03-15 12:16:50 +0000
commit4e0cf4dbf8a8a96288f70114fdc3939da0aa7ad1 (patch)
tree2418e32479a965eb392d08f2e648c53714118a91 /fish/progress.c
parent6d6b7edd1102f8383643866bf358e494e0d518ef (diff)
downloadlibguestfs-4e0cf4dbf8a8a96288f70114fdc3939da0aa7ad1.tar.gz
libguestfs-4e0cf4dbf8a8a96288f70114fdc3939da0aa7ad1.tar.xz
libguestfs-4e0cf4dbf8a8a96288f70114fdc3939da0aa7ad1.zip
New event API (RHBZ#664558).
This API allows more than one callback to be registered for each event, makes it possible to call the API from other languages, and allows [nearly all] log, debug and trace messages to be rerouted from stderr. An older version of this API was discussed on the mailing list here: https://www.redhat.com/archives/libguestfs/2010-December/msg00081.html https://www.redhat.com/archives/libguestfs/2011-January/msg00012.html This also updates guestfish to use the new API for its progress bars.
Diffstat (limited to 'fish/progress.c')
-rw-r--r--fish/progress.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fish/progress.c b/fish/progress.c
index 27dfbece..6a89ae00 100644
--- a/fish/progress.c
+++ b/fish/progress.c
@@ -167,9 +167,18 @@ estimate_remaining_time (double ratio)
/* Callback which displays a progress bar. */
void
progress_callback (guestfs_h *g, void *data,
- int proc_nr, int serial,
- uint64_t position, uint64_t total)
+ uint64_t event, int event_handle, int flags,
+ const char *buf, size_t buf_len,
+ const uint64_t *array, size_t array_len)
{
+ if (array_len < 4)
+ return;
+
+ /*uint64_t proc_nr = array[0];*/
+ /*uint64_t serial = array[1];*/
+ uint64_t position = array[2];
+ uint64_t total = array[3];
+
if (have_terminfo == 0) {
dumb:
printf ("%" PRIu64 "/%" PRIu64 "\n", position, total);