From 077030d11e27811749020af744e67e4267ee90e1 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 15 May 2011 09:51:59 +0200 Subject: w32: Fix missing declaration of ffs() target-ppc/cpu.h now needs ffs(), too, so ffs() must be declared before this file is included. Moving the declaration from qemu-common.h to qemu-os-win32.h (which is included in qemu-common.h early) fixes the compiler warning for w32. Cc: Aurelien Jarno Signed-off-by: Stefan Weil Signed-off-by: Aurelien Jarno --- qemu-common.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'qemu-common.h') diff --git a/qemu-common.h b/qemu-common.h index f9f705da85..bba8dfec5e 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -201,11 +201,6 @@ const char *path(const char *pathname); #define qemu_isascii(c) isascii((unsigned char)(c)) #define qemu_toascii(c) toascii((unsigned char)(c)) -#ifdef _WIN32 -/* ffs() in oslib-win32.c for WIN32, strings.h for the rest of the world */ -int ffs(int i); -#endif - void *qemu_oom_check(void *ptr); void *qemu_malloc(size_t size); void *qemu_realloc(void *ptr, size_t size); -- cgit v1.2.3-55-g7522 From 3bfe4dbf92d98d8c119b74f6c90b42fd8f289b58 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Mon, 9 May 2011 17:32:20 +0200 Subject: Add documentation for qemu_progress_{init,print}() Signed-off-by: Jes Sorensen Signed-off-by: Kevin Wolf --- qemu-common.h | 2 +- qemu-progress.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'qemu-common.h') diff --git a/qemu-common.h b/qemu-common.h index bba8dfec5e..b851b20c51 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -341,7 +341,7 @@ void qemu_iovec_memset_skip(QEMUIOVector *qiov, int c, size_t count, void qemu_progress_init(int enabled, float min_skip); void qemu_progress_end(void); -void qemu_progress_print(float percent, int max); +void qemu_progress_print(float delta, int max); #define QEMU_FILE_TYPE_BIOS 0 #define QEMU_FILE_TYPE_KEYMAP 1 diff --git a/qemu-progress.c b/qemu-progress.c index a4894c0dfc..8ebe8efa99 100644 --- a/qemu-progress.c +++ b/qemu-progress.c @@ -96,6 +96,13 @@ static void progress_dummy_init(void) state.end = progress_dummy_end; } +/* + * Initialize progress reporting. + * If @enabled is false, actual reporting is suppressed. The user can + * still trigger a report by sending a SIGUSR1. + * Reports are also suppressed unless we've had at least @min_skip + * percent progress since the last report. + */ void qemu_progress_init(int enabled, float min_skip) { state.min_skip = min_skip; @@ -111,14 +118,25 @@ void qemu_progress_end(void) state.end(); } -void qemu_progress_print(float percent, int max) +/* + * Report progress. + * @delta is how much progress we made. + * If @max is zero, @delta is an absolut value of the total job done. + * Else, @delta is a progress delta since the last call, as a fraction + * of @max. I.e. the delta is @delta * @max / 100. This allows + * relative accounting of functions which may be a different fraction of + * the full job, depending on the context they are called in. I.e. + * a function might be considered 40% of the full job if used from + * bdrv_img_create() but only 20% if called from img_convert(). + */ +void qemu_progress_print(float delta, int max) { float current; if (max == 0) { - current = percent; + current = delta; } else { - current = state.current + percent / 100 * max; + current = state.current + delta / 100 * max; } if (current > 100) { current = 100; -- cgit v1.2.3-55-g7522 From 86f69a92b163dac5ee230c8a109c3e8f37f13d38 Mon Sep 17 00:00:00 2001 From: Alexandre Raymond Date: Wed, 1 Jun 2011 22:21:30 -0400 Subject: Fix compilation warning due to missing header for sigaction Fix the following warning by including signal.h directly in qemu-common.h ----8<---- iohandler.c: In function ‘qemu_init_child_watch’: iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<---- Signed-off-by: Alexandre Raymond Signed-off-by: Stefan Hajnoczi --- qemu-common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'qemu-common.h') diff --git a/qemu-common.h b/qemu-common.h index b851b20c51..39fabc9e0f 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -39,6 +39,7 @@ typedef struct Monitor Monitor; #include #include #include +#include #ifdef _WIN32 #include "qemu-os-win32.h" -- cgit v1.2.3-55-g7522