Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/stefanha/tags/fix-buildbot-1208…
Browse files Browse the repository at this point in the history
…2014-pull-request' into staging

Pull request

# gpg: Signature made Thu 28 Aug 2014 13:43:00 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/fix-buildbot-12082014-pull-request:
  Revert "qemu-img: sort block formats in help message"
  block: sort formats alphabetically in bdrv_iterate_format()
  mirror: fix uninitialized variable delay_ns warnings
  trace: avoid Python 2.5 all() in tracetool
  libqtest: launch QEMU with QEMU_AUDIO_DRV=none
  qapi.py: avoid Python 2.5+ any() function

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Aug 28, 2014
2 parents 0265361 + 00c6d40 commit 795c050
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 31 deletions.
14 changes: 13 additions & 1 deletion block.c
Expand Up @@ -3744,11 +3744,17 @@ const char *bdrv_get_format_name(BlockDriverState *bs)
return bs->drv ? bs->drv->format_name : NULL;
}

static int qsort_strcmp(const void *a, const void *b)
{
return strcmp(a, b);
}

void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
void *opaque)
{
BlockDriver *drv;
int count = 0;
int i;
const char **formats = NULL;

QLIST_FOREACH(drv, &bdrv_drivers, list) {
Expand All @@ -3762,10 +3768,16 @@ void bdrv_iterate_format(void (*it)(void *opaque, const char *name),
if (!found) {
formats = g_renew(const char *, formats, count + 1);
formats[count++] = drv->format_name;
it(opaque, drv->format_name);
}
}
}

qsort(formats, count, sizeof(formats[0]), qsort_strcmp);

for (i = 0; i < count; i++) {
it(opaque, formats[i]);
}

g_free(formats);
}

Expand Down
4 changes: 1 addition & 3 deletions block/mirror.c
Expand Up @@ -157,7 +157,7 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
BlockDriverState *source = s->common.bs;
int nb_sectors, sectors_per_chunk, nb_chunks;
int64_t end, sector_num, next_chunk, next_sector, hbitmap_next_sector;
uint64_t delay_ns;
uint64_t delay_ns = 0;
MirrorOp *op;

s->sector_num = hbitmap_iter_next(&s->hbi);
Expand Down Expand Up @@ -247,8 +247,6 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
next_chunk += added_chunks;
if (!s->synced && s->common.speed) {
delay_ns = ratelimit_calculate_delay(&s->limit, added_sectors);
} else {
delay_ns = 0;
}
} while (delay_ns == 0 && next_sector < end);

Expand Down
25 changes: 3 additions & 22 deletions qemu-img.c
Expand Up @@ -32,7 +32,6 @@
#include "block/block_int.h"
#include "block/qapi.h"
#include <getopt.h>
#include <glib.h>

#define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION \
", Copyright (c) 2004-2008 Fabrice Bellard\n"
Expand All @@ -56,22 +55,9 @@ typedef enum OutputFormat {
#define BDRV_O_FLAGS BDRV_O_CACHE_WB
#define BDRV_DEFAULT_CACHE "writeback"

static gint compare_data(gconstpointer a, gconstpointer b, gpointer user)
static void format_print(void *opaque, const char *name)
{
return g_strcmp0(a, b);
}

static void print_format(gpointer data, gpointer user)
{
printf(" %s", (char *)data);
}

static void add_format_to_seq(void *opaque, const char *fmt_name)
{
GSequence *seq = opaque;

g_sequence_insert_sorted(seq, (gpointer)fmt_name,
compare_data, NULL);
printf(" %s", name);
}

static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)
Expand Down Expand Up @@ -157,15 +143,10 @@ static void QEMU_NORETURN help(void)
" '-f' first image format\n"
" '-F' second image format\n"
" '-s' run in Strict mode - fail on different image size or sector allocation\n";
GSequence *seq;

printf("%s\nSupported formats:", help_msg);
seq = g_sequence_new(NULL);
bdrv_iterate_format(add_format_to_seq, seq);
g_sequence_foreach(seq, print_format, NULL);
bdrv_iterate_format(format_print, NULL);
printf("\n");
g_sequence_free(seq);

exit(EXIT_SUCCESS);
}

Expand Down
8 changes: 4 additions & 4 deletions scripts/qapi.py
Expand Up @@ -107,10 +107,10 @@ def __init__(self, fp, input_relname=None, include_hist=[],
'Expected a file name (string), got: %s'
% include)
include_path = os.path.join(self.input_dir, include)
if any(include_path == elem[1]
for elem in self.include_hist):
raise QAPIExprError(expr_info, "Inclusion loop for %s"
% include)
for elem in self.include_hist:
if include_path == elem[1]:
raise QAPIExprError(expr_info, "Inclusion loop for %s"
% include)
# skip multiple include of the same file
if include_path in previously_included:
continue
Expand Down
3 changes: 2 additions & 1 deletion scripts/tracetool/backend/__init__.py
Expand Up @@ -102,7 +102,8 @@ class Wrapper:
def __init__(self, backends, format):
self._backends = [backend.replace("-", "_") for backend in backends]
self._format = format.replace("-", "_")
assert all(exists(backend) for backend in self._backends)
for backend in self._backends:
assert exists(backend)
assert tracetool.format.exists(self._format)

def _run_function(self, name, *args, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions tests/libqtest.c
Expand Up @@ -165,6 +165,7 @@ QTestState *qtest_init(const char *extra_args)

s->qemu_pid = fork();
if (s->qemu_pid == 0) {
setenv("QEMU_AUDIO_DRV", "none", true);
command = g_strdup_printf("exec %s "
"-qtest unix:%s,nowait "
"-qtest-log %s "
Expand Down

0 comments on commit 795c050

Please sign in to comment.