trivial patches for 2017-05-10

-----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEe3O61ovnosKJMUsicBtPaxppPlkFAlkSvwIPHG1qdEB0bHMu
 bXNrLnJ1AAoJEHAbT2saaT5Zys4IAMZLWicv1c7O3m1ajmmg7iGfRbsajcx9FSBi
 NxdrqG3zgV10gz8/R7goMYGkeFs8MAoDfagbBkXgwFgA31M+ecOe93XyoOQLpe9/
 43fx2u8exVdruIb60F5yDEd51RLwK2C4Iz7SVNRoVWMqDcMOCuC+WBog+AbTB0V+
 19RjhKStMyXMXPYVO0bLhQIcH+ixFLUljbpwDvz5FKor5NqGG+FzHjmwYciiTbr3
 o7Z3OIMWT7rDr9V5/553miiNP9ufG3fJreMyXDrTkFRVmDZaqRBp+tvdrYcb77ed
 /DDxC5vafgCRzwsrmCIsIQXV0janFGDQiqbR+hzBMBG1RTRoBiM=
 =AAfU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'mjt/tags/trivial-patches-fetch' into staging

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 <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# 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 <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2017-05-10 12:31:13 -04:00
commit f465706e59
34 changed files with 112 additions and 114 deletions

View File

@ -1177,8 +1177,8 @@ M: Stefan Hajnoczi <stefanha@redhat.com>
M: Fam Zheng <famz@redhat.com> M: Fam Zheng <famz@redhat.com>
L: qemu-block@nongnu.org L: qemu-block@nongnu.org
S: Supported S: Supported
F: async.c F: util/async.c
F: aio-*.c F: util/aio-*.c
F: block/io.c F: block/io.c
F: migration/block* F: migration/block*
F: include/block/aio.h F: include/block/aio.h
@ -1307,8 +1307,8 @@ Main loop
M: Paolo Bonzini <pbonzini@redhat.com> M: Paolo Bonzini <pbonzini@redhat.com>
S: Maintained S: Maintained
F: cpus.c F: cpus.c
F: main-loop.c F: util/main-loop.c
F: qemu-timer.c F: util/qemu-timer.c
F: vl.c F: vl.c
Human Monitor (HMP) Human Monitor (HMP)

View File

@ -22,9 +22,17 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "replication.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 { typedef struct BDRVReplicationState {
ReplicationMode mode; ReplicationMode mode;
int replication_state; ReplicationStage stage;
BdrvChild *active_disk; BdrvChild *active_disk;
BdrvChild *hidden_disk; BdrvChild *hidden_disk;
BdrvChild *secondary_disk; BdrvChild *secondary_disk;
@ -36,14 +44,6 @@ typedef struct BDRVReplicationState {
int error; int error;
} BDRVReplicationState; } 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, static void replication_start(ReplicationState *rs, ReplicationMode mode,
Error **errp); Error **errp);
static void replication_do_checkpoint(ReplicationState *rs, Error **errp); static void replication_do_checkpoint(ReplicationState *rs, Error **errp);
@ -141,10 +141,10 @@ static void replication_close(BlockDriverState *bs)
{ {
BDRVReplicationState *s = bs->opaque; BDRVReplicationState *s = bs->opaque;
if (s->replication_state == BLOCK_REPLICATION_RUNNING) { if (s->stage == BLOCK_REPLICATION_RUNNING) {
replication_stop(s->rs, false, NULL); 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); block_job_cancel_sync(s->active_disk->bs->job);
} }
@ -174,7 +174,7 @@ static int64_t replication_getlength(BlockDriverState *bs)
static int replication_get_io_status(BDRVReplicationState *s) static int replication_get_io_status(BDRVReplicationState *s)
{ {
switch (s->replication_state) { switch (s->stage) {
case BLOCK_REPLICATION_NONE: case BLOCK_REPLICATION_NONE:
return -EIO; return -EIO;
case BLOCK_REPLICATION_RUNNING: case BLOCK_REPLICATION_RUNNING:
@ -403,7 +403,7 @@ static void backup_job_completed(void *opaque, int ret)
BlockDriverState *bs = opaque; BlockDriverState *bs = opaque;
BDRVReplicationState *s = 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 */ /* The backup job is cancelled unexpectedly */
s->error = -EIO; s->error = -EIO;
} }
@ -445,7 +445,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
aio_context_acquire(aio_context); aio_context_acquire(aio_context);
s = bs->opaque; 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"); error_setg(errp, "Block replication is running or done");
aio_context_release(aio_context); aio_context_release(aio_context);
return; return;
@ -545,7 +545,7 @@ static void replication_start(ReplicationState *rs, ReplicationMode mode,
abort(); abort();
} }
s->replication_state = BLOCK_REPLICATION_RUNNING; s->stage = BLOCK_REPLICATION_RUNNING;
if (s->mode == REPLICATION_MODE_SECONDARY) { if (s->mode == REPLICATION_MODE_SECONDARY) {
secondary_do_checkpoint(s, errp); secondary_do_checkpoint(s, errp);
@ -581,7 +581,7 @@ static void replication_get_error(ReplicationState *rs, Error **errp)
aio_context_acquire(aio_context); aio_context_acquire(aio_context);
s = bs->opaque; s = bs->opaque;
if (s->replication_state != BLOCK_REPLICATION_RUNNING) { if (s->stage != BLOCK_REPLICATION_RUNNING) {
error_setg(errp, "Block replication is not running"); error_setg(errp, "Block replication is not running");
aio_context_release(aio_context); aio_context_release(aio_context);
return; return;
@ -601,7 +601,7 @@ static void replication_done(void *opaque, int ret)
BDRVReplicationState *s = bs->opaque; BDRVReplicationState *s = bs->opaque;
if (ret == 0) { if (ret == 0) {
s->replication_state = BLOCK_REPLICATION_DONE; s->stage = BLOCK_REPLICATION_DONE;
/* refresh top bs's filename */ /* refresh top bs's filename */
bdrv_refresh_filename(bs); bdrv_refresh_filename(bs);
@ -610,7 +610,7 @@ static void replication_done(void *opaque, int ret)
s->hidden_disk = NULL; s->hidden_disk = NULL;
s->error = 0; s->error = 0;
} else { } else {
s->replication_state = BLOCK_REPLICATION_FAILOVER_FAILED; s->stage = BLOCK_REPLICATION_FAILOVER_FAILED;
s->error = -EIO; s->error = -EIO;
} }
} }
@ -625,7 +625,7 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp)
aio_context_acquire(aio_context); aio_context_acquire(aio_context);
s = bs->opaque; s = bs->opaque;
if (s->replication_state != BLOCK_REPLICATION_RUNNING) { if (s->stage != BLOCK_REPLICATION_RUNNING) {
error_setg(errp, "Block replication is not running"); error_setg(errp, "Block replication is not running");
aio_context_release(aio_context); aio_context_release(aio_context);
return; return;
@ -633,7 +633,7 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp)
switch (s->mode) { switch (s->mode) {
case REPLICATION_MODE_PRIMARY: case REPLICATION_MODE_PRIMARY:
s->replication_state = BLOCK_REPLICATION_DONE; s->stage = BLOCK_REPLICATION_DONE;
s->error = 0; s->error = 0;
break; break;
case REPLICATION_MODE_SECONDARY: case REPLICATION_MODE_SECONDARY:
@ -648,12 +648,12 @@ static void replication_stop(ReplicationState *rs, bool failover, Error **errp)
if (!failover) { if (!failover) {
secondary_do_checkpoint(s, errp); secondary_do_checkpoint(s, errp);
s->replication_state = BLOCK_REPLICATION_DONE; s->stage = BLOCK_REPLICATION_DONE;
aio_context_release(aio_context); aio_context_release(aio_context);
return; return;
} }
s->replication_state = BLOCK_REPLICATION_FAILOVER; s->stage = BLOCK_REPLICATION_FAILOVER;
commit_active_start(NULL, s->active_disk->bs, s->secondary_disk->bs, commit_active_start(NULL, s->active_disk->bs, s->secondary_disk->bs,
BLOCK_JOB_INTERNAL, 0, BLOCKDEV_ON_ERROR_REPORT, BLOCK_JOB_INTERNAL, 0, BLOCKDEV_ON_ERROR_REPORT,
NULL, replication_done, bs, true, errp); NULL, replication_done, bs, true, errp);

View File

@ -744,10 +744,7 @@ int main(int argc, char **argv)
qemu_init_cpu_list(); qemu_init_cpu_list();
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
if ((envlist = envlist_create()) == NULL) { envlist = envlist_create();
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
}
/* add current environment into the list */ /* add current environment into the list */
for (wrk = environ; *wrk != NULL; wrk++) { for (wrk = environ; *wrk != NULL; wrk++) {
@ -785,10 +782,7 @@ int main(int argc, char **argv)
usage(); usage();
} else if (!strcmp(r, "ignore-environment")) { } else if (!strcmp(r, "ignore-environment")) {
envlist_free(envlist); envlist_free(envlist);
if ((envlist = envlist_create()) == NULL) { envlist = envlist_create();
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(1);
}
} else if (!strcmp(r, "U")) { } else if (!strcmp(r, "U")) {
r = argv[optind++]; r = argv[optind++];
if (envlist_unsetenv(envlist, r) != 0) if (envlist_unsetenv(envlist, r) != 0)
@ -956,10 +950,10 @@ int main(int argc, char **argv)
} }
for (wrk = target_environ; *wrk; wrk++) { 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)) { if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base); qemu_log("guest_base 0x%lx\n", guest_base);

View File

@ -148,6 +148,7 @@ static void read_fstree(void *fdt, const char *dirname)
d = opendir(dirname); d = opendir(dirname);
if (!d) { if (!d) {
error_setg(&error_fatal, "%s cannot open %s", __func__, dirname); error_setg(&error_fatal, "%s cannot open %s", __func__, dirname);
return;
} }
while ((de = readdir(d)) != NULL) { while ((de = readdir(d)) != NULL) {

View File

@ -42,9 +42,7 @@ static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq,
static void virtio_blk_free_request(VirtIOBlockReq *req) 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) static void virtio_blk_req_complete(VirtIOBlockReq *req, unsigned char status)

View File

@ -137,20 +137,21 @@ static void generic_loader_realize(DeviceState *dev, Error **errp)
#endif #endif
if (s->file) { if (s->file) {
AddressSpace *as = s->cpu ? s->cpu->as : NULL;
if (!s->force_raw) { if (!s->force_raw) {
size = load_elf_as(s->file, NULL, NULL, &entry, NULL, NULL, 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) { if (size < 0) {
size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL, size = load_uimage_as(s->file, &entry, NULL, NULL, NULL, NULL,
s->cpu->as); as);
} }
} }
if (size < 0 || s->force_raw) { if (size < 0 || s->force_raw) {
/* Default to the maximum size being the machine's ram size */ /* Default to the maximum size being the machine's ram size */
size = load_image_targphys_as(s->file, s->addr, ram_size, size = load_image_targphys_as(s->file, s->addr, ram_size, as);
s->cpu->as);
} else { } else {
s->addr = entry; s->addr = entry;
} }

View File

@ -227,13 +227,13 @@ static void jazz_led_invalidate_display(void *opaque)
static void jazz_led_text_update(void *opaque, console_ch_t *chardata) static void jazz_led_text_update(void *opaque, console_ch_t *chardata)
{ {
LedState *s = opaque; LedState *s = opaque;
char buf[2]; char buf[3];
dpy_text_cursor(s->con, -1, -1); dpy_text_cursor(s->con, -1, -1);
qemu_console_resize(s->con, 2, 1); qemu_console_resize(s->con, 2, 1);
/* TODO: draw the segments */ /* 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, console_write_ch(chardata++, ATTR2CHTYPE(buf[0], QEMU_COLOR_BLUE,
QEMU_COLOR_BLACK, 1)); QEMU_COLOR_BLACK, 1));
console_write_ch(chardata++, ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE, console_write_ch(chardata++, ATTR2CHTYPE(buf[1], QEMU_COLOR_BLUE,

View File

@ -189,7 +189,7 @@ void microblaze_load_kernel(MicroBlazeCPU *cpu, hwaddr ddr_base,
ram_size - initrd_offset); ram_size - initrd_offset);
} }
if (initrd_size < 0) { if (initrd_size < 0) {
error_report("qemu: could not load initrd '%s'", error_report("could not load initrd '%s'",
initrd_filename); initrd_filename);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -197,7 +197,7 @@ void nios2_load_kernel(Nios2CPU *cpu, hwaddr ddr_base,
ram_size - initrd_offset); ram_size - initrd_offset);
} }
if (initrd_size < 0) { if (initrd_size < 0) {
error_report("qemu: could not load initrd '%s'", error_report("could not load initrd '%s'",
initrd_filename); initrd_filename);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -610,7 +610,7 @@ static void ppc_powernv_init(MachineState *machine)
/* Create the processor chips */ /* Create the processor chips */
chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model); chip_typename = g_strdup_printf(TYPE_PNV_CHIP "-%s", machine->cpu_model);
if (!object_class_by_name(chip_typename)) { 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); machine->cpu_model, MACHINE_GET_CLASS(machine)->name);
exit(1); exit(1);
} }

View File

@ -282,7 +282,6 @@ void store_booke_tcr(CPUPPCState *env, target_ulong val)
ppc_tb_t *tb_env = env->tb_env; ppc_tb_t *tb_env = env->tb_env;
booke_timer_t *booke_timer = tb_env->opaque; booke_timer_t *booke_timer = tb_env->opaque;
tb_env = env->tb_env;
env->spr[SPR_BOOKE_TCR] = val; env->spr[SPR_BOOKE_TCR] = val;
kvmppc_set_tcr(cpu); kvmppc_set_tcr(cpu);

View File

@ -505,10 +505,10 @@ static void sclp_realize(DeviceState *dev, Error **errp)
ret = s390_set_memory_limit(machine->maxram_size, &hw_limit); ret = s390_set_memory_limit(machine->maxram_size, &hw_limit);
if (ret == -E2BIG) { 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); hw_limit >> 30);
} else if (ret) { } else if (ret) {
error_setg(&err, "qemu: setting the guest size failed"); error_setg(&err, "setting the guest size failed");
} }
out: out:

View File

@ -50,7 +50,7 @@ static void tricore_load_kernel(CPUTriCoreState *env)
NULL, 0, NULL, 0,
EM_TRICORE, 1, 0); EM_TRICORE, 1, 0);
if (kernel_size <= 0) { if (kernel_size <= 0) {
error_report("qemu: no kernel file '%s'", error_report("no kernel file '%s'",
tricoretb_binfo.kernel_filename); tricoretb_binfo.kernel_filename);
exit(1); exit(1);
} }

View File

@ -813,7 +813,10 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
if (p->b.bError) { if (p->b.bError) {
DPRINTF(s, D_VERBOSE, "error %d\n", 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); ccid_reset_error_status(s);
usb_wakeup(s->bulk, 0); usb_wakeup(s->bulk, 0);
} }

View File

@ -71,7 +71,7 @@ qio_channel_file_new_fd(int fd);
/** /**
* qio_channel_file_new_path: * qio_channel_file_new_path:
* @fd: the file descriptor * @path: the file path
* @flags: the open flags (O_RDONLY|O_WRONLY|O_RDWR, etc) * @flags: the open flags (O_RDONLY|O_WRONLY|O_RDWR, etc)
* @mode: the file creation mode if O_WRONLY is set in @flags * @mode: the file creation mode if O_WRONLY is set in @flags
* @errp: pointer to initialized error object * @errp: pointer to initialized error object

View File

@ -315,7 +315,7 @@ ssize_t qio_channel_read(QIOChannel *ioc,
Error **errp); Error **errp);
/** /**
* qio_channel_writev: * qio_channel_write:
* @ioc: the channel object * @ioc: the channel object
* @buf: the memory regions to send data from * @buf: the memory regions to send data from
* @buflen: the length of @buf * @buflen: the length of @buf

View File

@ -4229,10 +4229,7 @@ int main(int argc, char **argv, char **envp)
qemu_init_cpu_list(); qemu_init_cpu_list();
module_call_init(MODULE_INIT_QOM); module_call_init(MODULE_INIT_QOM);
if ((envlist = envlist_create()) == NULL) { envlist = envlist_create();
(void) fprintf(stderr, "Unable to allocate envlist\n");
exit(EXIT_FAILURE);
}
/* add current environment into the list */ /* add current environment into the list */
for (wrk = environ; *wrk != NULL; wrk++) { for (wrk = environ; *wrk != NULL; wrk++) {
@ -4429,10 +4426,10 @@ int main(int argc, char **argv, char **envp)
} }
for (wrk = target_environ; *wrk; wrk++) { 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)) { if (qemu_loglevel_mask(CPU_LOG_PAGE)) {
qemu_log("guest_base 0x%lx\n", guest_base); qemu_log("guest_base 0x%lx\n", guest_base);

4
numa.c
View File

@ -174,7 +174,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
} }
if (node->has_mem && node->has_memdev) { 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; return;
} }
@ -182,7 +182,7 @@ static void numa_node_parse(NumaNodeOptions *node, QemuOpts *opts, Error **errp)
have_memdevs = node->has_memdev; have_memdevs = node->has_memdev;
} }
if (node->has_memdev != have_memdevs) { 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"); "all or no nodes");
return; return;
} }

View File

@ -1886,8 +1886,8 @@ resolution modes which the Cirrus Logic BIOS does not support (i.e. >=
Windows 9x does not correctly use the CPU HLT Windows 9x does not correctly use the CPU HLT
instruction. The result is that it takes host CPU cycles even when instruction. The result is that it takes host CPU cycles even when
idle. You can install the utility from idle. You can install the utility from
@url{http://www.user.cityline.ru/~maxamn/amnhltm.zip} to solve this @url{http://web.archive.org/web/20060212132151/http://www.user.cityline.ru/~maxamn/amnhltm.zip}
problem. Note that no such tool is needed for NT, 2000 or XP. to solve this problem. Note that no such tool is needed for NT, 2000 or XP.
@subsubsection Windows 2000 disk full problem @subsubsection Windows 2000 disk full problem
@ -1935,9 +1935,9 @@ vvfat block device ("-hdb fat:directory_which_holds_the_SP").
@subsubsection CPU usage reduction @subsubsection CPU usage reduction
DOS does not correctly use the CPU HLT instruction. The result is that DOS does not correctly use the CPU HLT instruction. The result is that
it takes host CPU cycles even when idle. You can install the utility it takes host CPU cycles even when idle. You can install the utility from
from @url{http://www.vmware.com/software/dosidle210.zip} to solve this @url{http://web.archive.org/web/20051222085335/http://www.vmware.com/software/dosidle210.zip}
problem. to solve this problem.
@node QEMU System emulator for non PC targets @node QEMU System emulator for non PC targets
@chapter QEMU System emulator for non PC targets @chapter QEMU System emulator for non PC targets

View File

@ -604,7 +604,7 @@ Special files such as iSCSI devices can be specified using protocol
specific URLs. See the section for "Device URL Syntax" for more information. specific URLs. See the section for "Device URL Syntax" for more information.
@item if=@var{interface} @item if=@var{interface}
This option defines on which type on interface the drive is connected. This option defines on which type on interface the drive is connected.
Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio. Available types are: ide, scsi, sd, mtd, floppy, pflash, virtio, none.
@item bus=@var{bus},unit=@var{unit} @item bus=@var{bus},unit=@var{unit}
These options define where is connected the drive by defining the bus number and These options define where is connected the drive by defining the bus number and
the unit id. the unit id.
@ -876,7 +876,7 @@ ETEXI
DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs, DEF("virtfs", HAS_ARG, QEMU_OPTION_virtfs,
"-virtfs local,path=path,mount_tag=tag,security_model=[mapped-xattr|mapped-file|passthrough|none]\n" "-virtfs local,path=path,mount_tag=tag,security_model=[mapped-xattr|mapped-file|passthrough|none]\n"
" [,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n", " [,id=id][,writeout=immediate][,readonly][,socket=socket|sock_fd=sock_fd]\n",
QEMU_ARCH_ALL) QEMU_ARCH_ALL)
STEXI STEXI

View File

@ -2125,9 +2125,11 @@ static void transfer_memory_block(GuestMemoryBlock *mem_blk, bool sys2memblk,
* we think this VM does not support online/offline memory block, * we think this VM does not support online/offline memory block,
* any other solution? * any other solution?
*/ */
if (!dp && errno == ENOENT) { if (!dp) {
result->response = if (errno == ENOENT) {
GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED; result->response =
GUEST_MEMORY_BLOCK_RESPONSE_TYPE_OPERATION_NOT_SUPPORTED;
}
goto out1; goto out1;
} }
closedir(dp); closedir(dp);

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/bin/env perl
# (c) 2001, Dave Jones. (the file handling bit) # (c) 2001, Dave Jones. (the file handling bit)
# (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit) # (c) 2005, Joel Schopp <jschopp@austin.ibm.com> (the ugly bit)
# (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite) # (c) 2007,2008, Andy Whitcroft <apw@uk.ibm.com> (new conditions, test suite)
@ -6,6 +6,7 @@
# Licensed under the terms of the GNU GPL License version 2 # Licensed under the terms of the GNU GPL License version 2
use strict; use strict;
use warnings;
my $P = $0; my $P = $0;
$P =~ s@.*/@@g; $P =~ s@.*/@@g;

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/bin/env perl
# #
# Clean up include guards in headers # Clean up include guards in headers
# #
@ -28,6 +28,7 @@
# "cc -E -DGUARD_H -c -P -", and fed the test program on stdin. # "cc -E -DGUARD_H -c -P -", and fed the test program on stdin.
use strict; use strict;
use warnings;
use Getopt::Std; use Getopt::Std;
# Stuff we don't want to clean because we import it into our tree: # Stuff we don't want to clean because we import it into our tree:

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl #!/usr/bin/env perl
# Copyright (C) 2013 Red Hat, Inc. # Copyright (C) 2013 Red Hat, Inc.
# #
# Authors: # Authors:

View File

@ -1,4 +1,6 @@
#!/usr/bin/perl -w #!/usr/bin/env perl
use warnings;
use File::Temp qw/ tempfile /; use File::Temp qw/ tempfile /;
use Getopt::Long; use Getopt::Long;

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w #!/usr/bin/env perl
# (c) 2007, Joe Perches <joe@perches.com> # (c) 2007, Joe Perches <joe@perches.com>
# created from checkpatch.pl # created from checkpatch.pl
# #
@ -11,6 +11,7 @@
# Licensed under the terms of the GNU GPL License version 2 # Licensed under the terms of the GNU GPL License version 2
use strict; use strict;
use warnings;
my $P = $0; my $P = $0;
my $V = '0.26'; my $V = '0.26';

View File

@ -284,12 +284,12 @@ while true ; do
shift shift
# check given cpu is in the supported CPU list # check given cpu is in the supported CPU list
for cpu in ${qemu_target_list} ; do for cpu in ${qemu_target_list} ; do
if [ "$cpu" == "$1" ] ; then if [ "$cpu" = "$1" ] ; then
break break
fi fi
done done
if [ "$cpu" == "$1" ] ; then if [ "$cpu" = "$1" ] ; then
qemu_target_list="$1" qemu_target_list="$1"
else else
echo "ERROR: unknown CPU \"$1\"" 1>&2 echo "ERROR: unknown CPU \"$1\"" 1>&2

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl #!/usr/bin/env perl
use strict; use strict;
use warnings; use warnings;

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl #!/usr/bin/env perl
use strict; use strict;
use warnings; use warnings;

View File

@ -1,4 +1,4 @@
#! /usr/bin/perl -w #! /usr/bin/env perl
# Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. # Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
@ -22,6 +22,8 @@
# markup to Perl POD format. It's intended to be used to extract # markup to Perl POD format. It's intended to be used to extract
# something suitable for a manpage from a Texinfo document. # something suitable for a manpage from a Texinfo document.
use warnings;
$output = 0; $output = 0;
$skipping = 0; $skipping = 0;
%sects = (); %sects = ();

4
tests/.gitignore vendored
View File

@ -11,6 +11,8 @@ check-qom-proplist
qht-bench qht-bench
rcutorture rcutorture
test-aio test-aio
test-aio-multithread
test-arm-mptimer
test-base64 test-base64
test-bitops test-bitops
test-bitcnt test-bitcnt
@ -24,6 +26,7 @@ test-crypto-afsplit
test-crypto-block test-crypto-block
test-crypto-cipher test-crypto-cipher
test-crypto-hash test-crypto-hash
test-crypto-hmac
test-crypto-ivgen test-crypto-ivgen
test-crypto-pbkdf test-crypto-pbkdf
test-crypto-secret test-crypto-secret
@ -37,6 +40,7 @@ test-crypto-tlssession-server/
test-crypto-xts test-crypto-xts
test-cutils test-cutils
test-hbitmap test-hbitmap
test-hmp
test-int128 test-int128
test-iov test-iov
test-io-channel-buffer test-io-channel-buffer

View File

@ -41,7 +41,7 @@ static bool ufd_version_check(void)
struct uffdio_api api_struct; struct uffdio_api api_struct;
uint64_t ioctl_mask; uint64_t ioctl_mask;
int ufd = ufd = syscall(__NR_userfaultfd, O_CLOEXEC); int ufd = syscall(__NR_userfaultfd, O_CLOEXEC);
if (ufd == -1) { if (ufd == -1) {
g_test_message("Skipping test: userfaultfd not available"); g_test_message("Skipping test: userfaultfd not available");

View File

@ -17,16 +17,14 @@ static int envlist_parse(envlist_t *envlist,
const char *env, int (*)(envlist_t *, const char *)); const char *env, int (*)(envlist_t *, const char *));
/* /*
* Allocates new envlist and returns pointer to that or * Allocates new envlist and returns pointer to it.
* NULL in case of error.
*/ */
envlist_t * envlist_t *
envlist_create(void) envlist_create(void)
{ {
envlist_t *envlist; envlist_t *envlist;
if ((envlist = malloc(sizeof (*envlist))) == NULL) envlist = g_malloc(sizeof(*envlist));
return (NULL);
QLIST_INIT(&envlist->el_entries); QLIST_INIT(&envlist->el_entries);
envlist->el_count = 0; envlist->el_count = 0;
@ -48,10 +46,10 @@ envlist_free(envlist_t *envlist)
entry = envlist->el_entries.lh_first; entry = envlist->el_entries.lh_first;
QLIST_REMOVE(entry, ev_link); QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var); g_free((char *)entry->ev_var);
free(entry); g_free(entry);
} }
free(envlist); g_free(envlist);
} }
/* /*
@ -101,8 +99,7 @@ envlist_parse(envlist_t *envlist, const char *env,
if ((envlist == NULL) || (env == NULL)) if ((envlist == NULL) || (env == NULL))
return (EINVAL); return (EINVAL);
if ((tmpenv = strdup(env)) == NULL) tmpenv = g_strdup(env);
return (errno);
envsave = tmpenv; envsave = tmpenv;
do { do {
@ -117,7 +114,7 @@ envlist_parse(envlist_t *envlist, const char *env,
tmpenv = envvar + 1; tmpenv = envvar + 1;
} while (envvar != NULL); } while (envvar != NULL);
free(envsave); g_free(envsave);
return ret; return ret;
} }
@ -155,18 +152,14 @@ envlist_setenv(envlist_t *envlist, const char *env)
if (entry != NULL) { if (entry != NULL) {
QLIST_REMOVE(entry, ev_link); QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var); g_free((char *)entry->ev_var);
free(entry); g_free(entry);
} else { } else {
envlist->el_count++; envlist->el_count++;
} }
if ((entry = malloc(sizeof (*entry))) == NULL) entry = g_malloc(sizeof(*entry));
return (errno); entry->ev_var = g_strdup(env);
if ((entry->ev_var = strdup(env)) == NULL) {
free(entry);
return (errno);
}
QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link); QLIST_INSERT_HEAD(&envlist->el_entries, entry, ev_link);
return (0); return (0);
@ -201,8 +194,8 @@ envlist_unsetenv(envlist_t *envlist, const char *env)
} }
if (entry != NULL) { if (entry != NULL) {
QLIST_REMOVE(entry, ev_link); QLIST_REMOVE(entry, ev_link);
free((char *)entry->ev_var); g_free((char *)entry->ev_var);
free(entry); g_free(entry);
envlist->el_count--; envlist->el_count--;
} }
@ -212,12 +205,12 @@ envlist_unsetenv(envlist_t *envlist, const char *env)
/* /*
* Returns given envlist as array of strings (in same form that * Returns given envlist as array of strings (in same form that
* global variable environ is). Caller must free returned memory * global variable environ is). Caller must free returned memory
* by calling free(3) for each element and for the array. Returned * by calling g_free for each element and the array.
* array and given envlist are not related (no common references). * Returned array and given envlist are not related (no common
* references).
* *
* If caller provides count pointer, number of items in array is * If caller provides count pointer, number of items in array is
* stored there. In case of error, NULL is returned and no memory * stored there.
* is allocated.
*/ */
char ** char **
envlist_to_environ(const envlist_t *envlist, size_t *count) envlist_to_environ(const envlist_t *envlist, size_t *count)
@ -225,13 +218,11 @@ envlist_to_environ(const envlist_t *envlist, size_t *count)
struct envlist_entry *entry; struct envlist_entry *entry;
char **env, **penv; char **env, **penv;
penv = env = malloc((envlist->el_count + 1) * sizeof (char *)); penv = env = g_malloc((envlist->el_count + 1) * sizeof(char *));
if (env == NULL)
return (NULL);
for (entry = envlist->el_entries.lh_first; entry != NULL; for (entry = envlist->el_entries.lh_first; entry != NULL;
entry = entry->ev_link.le_next) { entry = entry->ev_link.le_next) {
*(penv++) = strdup(entry->ev_var); *(penv++) = g_strdup(entry->ev_var);
} }
*penv = NULL; /* NULL terminate the list */ *penv = NULL; /* NULL terminate the list */

5
vl.c
View File

@ -3524,10 +3524,11 @@ int main(int argc, char **argv, char **envp)
exit(1); exit(1);
} }
fsdev = qemu_opts_create(qemu_find_opts("fsdev"), fsdev = qemu_opts_create(qemu_find_opts("fsdev"),
qemu_opts_id(opts) ?:
qemu_opt_get(opts, "mount_tag"), qemu_opt_get(opts, "mount_tag"),
1, NULL); 1, NULL);
if (!fsdev) { if (!fsdev) {
error_report("duplicate fsdev id: %s", error_report("duplicate or invalid fsdev id: %s",
qemu_opt_get(opts, "mount_tag")); qemu_opt_get(opts, "mount_tag"));
exit(1); exit(1);
} }
@ -3565,7 +3566,7 @@ int main(int argc, char **argv, char **envp)
&error_abort); &error_abort);
qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort); qemu_opt_set(device, "driver", "virtio-9p-pci", &error_abort);
qemu_opt_set(device, "fsdev", qemu_opt_set(device, "fsdev",
qemu_opt_get(opts, "mount_tag"), &error_abort); qemu_opts_id(fsdev), &error_abort);
qemu_opt_set(device, "mount_tag", qemu_opt_set(device, "mount_tag",
qemu_opt_get(opts, "mount_tag"), &error_abort); qemu_opt_get(opts, "mount_tag"), &error_abort);
break; break;