Skip to content

Commit

Permalink
Merge remote-tracking branch 'mjt/tags/trivial-patches-fetch' into st…
Browse files Browse the repository at this point in the history
…aging

trivial patches for 2017-05-10

# gpg: Signature made Wed 10 May 2017 03:19:30 AM EDT
# gpg:                using RSA key 0x701B4F6B1A693E59
# gpg: Good signature from "Michael Tokarev <[email protected]>"
# gpg:                 aka "Michael Tokarev <[email protected]>"
# gpg:                 aka "Michael Tokarev <[email protected]>"
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 7B73 BAD6 8BE7 A2C2 8931  4B22 701B 4F6B 1A69 3E59

* mjt/tags/trivial-patches-fetch: (23 commits)
  tests: Remove redundant assignment
  MAINTAINERS: Update paths for AioContext implementation
  MAINTAINERS: Update paths for main loop
  jazz_led: fix bad snprintf
  tests: Ignore another built executable (test-hmp)
  scripts: Switch to more portable Perl shebang
  scripts/qemu-binfmt-conf.sh: Fix shell portability issue
  virtfs: allow a device id to be specified in the -virtfs option
  hw/core/generic-loader: Fix crash when running without CPU
  virtio-blk: Remove useless condition around g_free()
  qemu-doc: Fix broken URLs of amnhltm.zip and dosidle210.zip
  use _Static_assert in QEMU_BUILD_BUG_ON
  channel-file: fix wrong parameter comments
  block: Make 'replication_state' an enum
  util: Use g_malloc/g_free in envlist.c
  qga: fix compiler warnings (clang 5)
  device_tree: fix compiler warnings (clang 5)
  usb-ccid: make ccid_write_data_block() cope with null buffers
  tests: Ignore more test executables
  Add 'none' as type for drive's if option
  ...

Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
stefanhaRH committed May 10, 2017
2 parents 1effe6a + e1ae9fb commit f465706
Show file tree
Hide file tree
Showing 34 changed files with 112 additions and 114 deletions.
8 changes: 4 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1177,8 +1177,8 @@ M: Stefan Hajnoczi <[email protected]>
M: Fam Zheng <[email protected]>
L: [email protected]
S: Supported
F: async.c
F: aio-*.c
F: util/async.c
F: util/aio-*.c
F: block/io.c
F: migration/block*
F: include/block/aio.h
Expand Down Expand Up @@ -1307,8 +1307,8 @@ Main loop
M: Paolo Bonzini <[email protected]>
S: Maintained
F: cpus.c
F: main-loop.c
F: qemu-timer.c
F: util/main-loop.c
F: util/qemu-timer.c
F: vl.c

Human Monitor (HMP)
Expand Down
44 changes: 22 additions & 22 deletions block/replication.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,17 @@
#include "qapi/error.h"
#include "replication.h"

typedef enum {
BLOCK_REPLICATION_NONE, /* block replication is not started */
BLOCK_REPLICATION_RUNNING, /* block replication is running */
BLOCK_REPLICATION_FAILOVER, /* failover is running in background */
BLOCK_REPLICATION_FAILOVER_FAILED, /* failover failed */
BLOCK_REPLICATION_DONE, /* block replication is done */
} ReplicationStage;

typedef struct BDRVReplicationState {
ReplicationMode mode;
int replication_state;
ReplicationStage stage;
BdrvChild *active_disk;
BdrvChild *hidden_disk;
BdrvChild *secondary_disk;
Expand All @@ -36,14 +44,6 @@ typedef struct BDRVReplicationState {
int error;
} BDRVReplicationState;

enum {
BLOCK_REPLICATION_NONE, /* block replication is not started */
BLOCK_REPLICATION_RUNNING, /* block replication is running */
BLOCK_REPLICATION_FAILOVER, /* failover is running in background */
BLOCK_REPLICATION_FAILOVER_FAILED, /* failover failed */
BLOCK_REPLICATION_DONE, /* block replication is done */
};

static void replication_start(ReplicationState *rs, ReplicationMode mode,
Error **errp);
static void replication_do_checkpoint(ReplicationState *rs, Error **errp);
Expand Down Expand Up @@ -141,10 +141,10 @@ static void replication_close(BlockDriverState *bs)
{
BDRVReplicationState *s = bs->opaque;

if (s->replication_state == BLOCK_REPLICATION_RUNNING) {
if (s->stage == BLOCK_REPLICATION_RUNNING) {
replication_stop(s->rs, false, NULL);
}
if (s->replication_state == BLOCK_REPLICATION_FAILOVER) {
if (s->stage == BLOCK_REPLICATION_FAILOVER) {
block_job_cancel_sync(s->active_disk->bs->job);
}

Expand Down Expand Up @@ -174,7 +174,7 @@ static int64_t replication_getlength(BlockDriverState *bs)

static int replication_get_io_status(BDRVReplicationState *s)
{
switch (s->replication_state) {
switch (s->stage) {
case BLOCK_REPLICATION_NONE:
return -EIO;
case BLOCK_REPLICATION_RUNNING:
Expand Down Expand Up @@ -403,7 +403,7 @@ static void backup_job_completed(void *opaque, int ret)
BlockDriverState *bs = opaque;
BDRVReplicationState *s = bs->opaque;

if (s->replication_state != BLOCK_REPLICATION_FAILOVER) {
if (s->stage != BLOCK_REPLICATION_FAILOVER) {
/* The backup job is cancelled unexpectedly */
s->error = -EIO;
}
Expand Down Expand Up @@ -445,7 +445,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
aio_context_acquire(aio_context);
s = bs->opaque;

if (s->replication_state != BLOCK_REPLICATION_NONE) {
if (s->stage != BLOCK_REPLICATION_NONE) {
error_setg(errp, "Block replication is running or done");
aio_context_release(aio_context);
return;
Expand Down Expand Up @@ -545,7 +545,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
abort();
}

s->replication_state = BLOCK_REPLICATION_RUNNING;
s->stage = BLOCK_REPLICATION_RUNNING;

if (s->mode == REPLICATION_MODE_SECONDARY) {
secondary_do_checkpoint(s, errp);
Expand Down Expand Up @@ -581,7 +581,7 @@ static void replication_get_error(ReplicationState *rs, Error **errp)
aio_context_acquire(aio_context);
s = bs->opaque;

if (s->replication_state != BLOCK_REPLICATION_RUNNING) {
if (s->stage != BLOCK_REPLICATION_RUNNING) {
error_setg(errp, "Block replication is not running");
aio_context_release(aio_context);
return;
Expand All @@ -601,7 +601,7 @@ static void replication_done(void *opaque, int ret)
BDRVReplicationState *s = bs->opaque;

if (ret == 0) {
s->replication_state = BLOCK_REPLICATION_DONE;
s->stage = BLOCK_REPLICATION_DONE;

/* refresh top bs's filename */
bdrv_refresh_filename(bs);
Expand All @@ -610,7 +610,7 @@ static void replication_done(void *opaque, int ret)
s->hidden_disk = NULL;
s->error = 0;
} else {
s->replication_state = BLOCK_REPLICATION_FAILOVER_FAILED;
s->stage = BLOCK_REPLICATION_FAILOVER_FAILED;
s->error = -EIO;
}
}
Expand All @@ -625,15 +625,15 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp)
aio_context_acquire(aio_context);
s = bs->opaque;

if (s->replication_state != BLOCK_REPLICATION_RUNNING) {
if (s->stage != BLOCK_REPLICATION_RUNNING) {
error_setg(errp, "Block replication is not running");
aio_context_release(aio_context);
return;
}

switch (s->mode) {
case REPLICATION_MODE_PRIMARY:
s->replication_state = BLOCK_REPLICATION_DONE;
s->stage = BLOCK_REPLICATION_DONE;
s->error = 0;
break;
case REPLICATION_MODE_SECONDARY:
Expand All @@ -648,12 +648,12 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp)

if (!failover) {
secondary_do_checkpoint(s, errp);
s->replication_state = BLOCK_REPLICATION_DONE;
s->stage = BLOCK_REPLICATION_DONE;
aio_context_release(aio_context);
return;
}

s->replication_state = BLOCK_REPLICATION_FAILOVER;
s->stage = BLOCK_REPLICATION_FAILOVER;
commit_active_start(NULL, s->active_disk->bs, s->secondary_disk->bs,
BLOCK_JOB_INTERNAL, 0, BLOCKDEV_ON_ERROR_REPORT,
NULL, replication_done, bs, true, errp);
Expand Down
14 changes: 4 additions & 10 deletions bsd-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,10 +744,7 @@ int main(int argc, char **argv)
qemu_init_cpu_list();
module_call_init(MODULE_INIT_QOM);

if ((envlist = envlist_create()) == NULL) {
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
}
envlist = envlist_create();

/* add current environment into the list */
for (wrk = environ; *wrk != NULL; wrk++) {
Expand Down Expand Up @@ -785,10 +782,7 @@ int main(int argc, char **argv)
usage();
} else if (!strcmp(r, "ignore-environment")) {
envlist_free(envlist);
if ((envlist = envlist_create()) == NULL) {
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
}
envlist = envlist_create();
} else if (!strcmp(r, "U")) {
r = argv[optind++];
if (envlist_unsetenv(envlist, r) != 0)
Expand Down Expand Up @@ -956,10 +950,10 @@ int main(int argc, char **argv)
}

for (wrk = target_environ; *wrk; wrk++) {
free(*wrk);
g_free(*wrk);
}

free(target_environ);
g_free(target_environ);

if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base);
Expand Down
1 change: 1 addition & 0 deletions device_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ static void read_fstree(void *fdt, const char *dirname)
d = opendir(dirname);
if (!d) {
error_setg(&error_fatal, "%s cannot open %s", __func__, dirname);
return;
}

while ((de = readdir(d)) != NULL) {
Expand Down
4 changes: 1 addition & 3 deletions hw/block/virtio-blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,

static void virtio_blk_free_request(VirtIOBlockReq *req)
{
if (req) {
g_free(req);
}
g_free(req);
}

static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)
Expand Down
9 changes: 5 additions & 4 deletions hw/core/generic-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,21 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
#endif

if (s->file) {
AddressSpace *as = s->cpu ? s->cpu->as : NULL;

if (!s->force_raw) {
size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL,
big_endian, 0, 0, 0, s->cpu->as);
big_endian, 0, 0, 0, as);

if (size < 0) {
size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL,
s->cpu->as);
as);
}
}

if (size < 0 || s->force_raw) {
/* Default to the maximum size being the machine's ram size */
size = load_image_targphys_as(s->file, s->addr, ram_size,
s->cpu->as);
size = load_image_targphys_as(s->file, s->addr, ram_size, as);
} else {
s->addr = entry;
}
Expand Down
4 changes: 2 additions & 2 deletions hw/display/jazz_led.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ static void jazz_led_invalidate_display(void *opaque)
static void jazz_led_text_update(void *opaque, console_ch_t *chardata)
{
LedState *s = opaque;
char buf[2];
char buf[3];

dpy_text_cursor(s->con, -1, -1);
qemu_console_resize(s->con, 2, 1);

/* TODO: draw the segments */
snprintf(buf, 2, "%02hhx\n", s->segments);
snprintf(buf, 3, "%02hhx", s->segments);
console_write_ch(chardata++, ATTR2CHTYPE(buf[0], QEMU_COLOR_BLUE,
QEMU_COLOR_BLACK, 1));
console_write_ch(chardata++, ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE,
Expand Down
2 changes: 1 addition & 1 deletion hw/microblaze/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
ram_size - initrd_offset);
}
if (initrd_size < 0) {
error_report("qemu: could not load initrd '%s'",
error_report("could not load initrd '%s'",
initrd_filename);
exit(EXIT_FAILURE);
}
Expand Down
2 changes: 1 addition & 1 deletion hw/nios2/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
ram_size - initrd_offset);
}
if (initrd_size < 0) {
error_report("qemu: could not load initrd '%s'",
error_report("could not load initrd '%s'",
initrd_filename);
exit(EXIT_FAILURE);
}
Expand Down
2 changes: 1 addition & 1 deletion hw/ppc/pnv.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static void ppc_powernv_init(MachineState *machine)
/* Create the processor chips */
chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model);
if (!object_class_by_name(chip_typename)) {
error_report("qemu: invalid CPU model '%s' for %s machine",
error_report("invalid CPU model '%s' for %s machine",
machine->cpu_model, MACHINE_GET_CLASS(machine)->name);
exit(1);
}
Expand Down
1 change: 0 additions & 1 deletion hw/ppc/ppc_booke.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ void store_booke_tcr(CPUPPCState *env, target_ulong val)
ppc_tb_t *tb_env = env->tb_env;
booke_timer_t *booke_timer = tb_env->opaque;

tb_env = env->tb_env;
env->spr[SPR_BOOKE_TCR] = val;
kvmppc_set_tcr(cpu);

Expand Down
4 changes: 2 additions & 2 deletions hw/s390x/sclp.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ static void sclp_realize(DeviceState *dev, Error **errp)

ret = s390_set_memory_limit(machine->maxram_size, &hw_limit);
if (ret == -E2BIG) {
error_setg(&err, "qemu: host supports a maximum of %" PRIu64 " GB",
error_setg(&err, "host supports a maximum of %" PRIu64 " GB",
hw_limit >> 30);
} else if (ret) {
error_setg(&err, "qemu: setting the guest size failed");
error_setg(&err, "setting the guest size failed");
}

out:
Expand Down
2 changes: 1 addition & 1 deletion hw/tricore/tricore_testboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static void tricore_load_kernel(CPUTriCoreState *env)
NULL, 0,
EM_TRICORE, 1, 0);
if (kernel_size <= 0) {
error_report("qemu: no kernel file '%s'",
error_report("no kernel file '%s'",
tricoretb_binfo.kernel_filename);
exit(1);
}
Expand Down
5 changes: 4 additions & 1 deletion hw/usb/dev-smartcard-reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
if (p->b.bError) {
DPRINTF(s, D_VERBOSE, "error %d\n", p->b.bError);
}
memcpy(p->abData, data, len);
if (len) {
g_assert_nonnull(data);
memcpy(p->abData, data, len);
}
ccid_reset_error_status(s);
usb_wakeup(s->bulk, 0);
}
Expand Down
2 changes: 1 addition & 1 deletion include/io/channel-file.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ qio_channel_file_new_fd(int fd);

/**
* qio_channel_file_new_path:
* @fd: the file descriptor
* @path: the file path
* @flags: the open flags (O_RDONLY|O_WRONLY|O_RDWR, etc)
* @mode: the file creation mode if O_WRONLY is set in @flags
* @errp: pointer to initialized error object
Expand Down
2 changes: 1 addition & 1 deletion include/io/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ ssize_t qio_channel_read(QIOChannel *ioc,
Error **errp);

/**
* qio_channel_writev:
* qio_channel_write:
* @ioc: the channel object
* @buf: the memory regions to send data from
* @buflen: the length of @buf
Expand Down
9 changes: 3 additions & 6 deletions linux-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4229,10 +4229,7 @@ int main(int argc, char **argv, char **envp)
qemu_init_cpu_list();
module_call_init(MODULE_INIT_QOM);

if ((envlist = envlist_create()) == NULL) {
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(EXIT_FAILURE);
}
envlist = envlist_create();

/* add current environment into the list */
for (wrk = environ; *wrk != NULL; wrk++) {
Expand Down Expand Up @@ -4429,10 +4426,10 @@ int main(int argc, char **argv, char **envp)
}

for (wrk = target_environ; *wrk; wrk++) {
free(*wrk);
g_free(*wrk);
}

free(target_environ);
g_free(target_environ);

if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base);
Expand Down
4 changes: 2 additions & 2 deletions numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
}

if (node->has_mem && node->has_memdev) {
error_setg(errp, "qemu: cannot specify both mem= and memdev=");
error_setg(errp, "cannot specify both mem= and memdev=");
return;
}

if (have_memdevs == -1) {
have_memdevs = node->has_memdev;
}
if (node->has_memdev != have_memdevs) {
error_setg(errp, "qemu: memdev option must be specified for either "
error_setg(errp, "memdev option must be specified for either "
"all or no nodes");
return;
}
Expand Down
Loading

0 comments on commit f465706

Please sign in to comment.