Trivial patches for 2014-05-05
Here's another pull request for trival patches.
This time, it includes:
- many cleanups from Stefan Weil, mostly adding `static' attrs
- some more trivial patches from glib cleanups, by me and Stefan Hajnoczi
- some more trivial changes for libcacard, from me and Alon Levy
- small fixes from Chen Gang (debug) and Peter Maydell (tests)
- little makefile cleanups and configure fix from me
- documentation fixes from Fam Zheng
- and some more random things
All are little things here and there, just how -trivial tree should really be.
Please consider pulling.
Thanks,
/mjt
The following changes since commit fdaad4715ae9e998fd0595bedfb16fdaf0c68ccc:
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20140501' into staging (2014-05-02 11:32:00 +0100)
are available in the git repository at:
git://git.corpit.ru/qemu.git tags/trivial-patches-2014-05-05
for you to fetch changes up to bbaa4cda7e0f6da97d46cb80ef83d2eb65b3eaf4:
libcacard: remove unnecessary EOL from debug prints (2014-05-05 21:56:36 +0400)
----------------------------------------------------------------
trivial patches for 2014-05-05
----------------------------------------------------------------
Alon Levy (1):
libcacard: remove unnecessary EOL from debug prints
Chen Gang (1):
arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()
Fam Zheng (1):
docs/memory.txt: Fix document on MMIO operations
Hani Benhabiles (1):
readline: Sort completions before printing them.
Jim Meyering (1):
xen: remove unused global, xen_xcg
Michael Tokarev (6):
Makefiles: convert some obj-specific CFLAGS to use new foo.o-cflags syntax
configure: remove bashism
do not call g_thread_init() for glib >= 2.31
libcacard: replace pstrcpy() with memcpy()
qmp: report path ambiguity error
readline: use g_strndup instead of open-coding it
Peter Maydell (1):
tests/tcg: Fix compilation of test_path
Stefan Hajnoczi (1):
glib: move g_poll() replacement into glib-compat.h
Stefan Weil (9):
qga: Fix typo (plural) in comment
hw/9pfs: Add missing 'static' attributes hw/mips: Add missing 'static' and 'const' attributes hw/s390x: Add missing 'static' attribute
monitor: Add missing 'static' attribute
ui: Add missing 'static' attribute
qemu-timer: Add missing 'static' attribute
hw: Add missing 'static' attributes hw/9pfs: Add include file for exported symbol
Makefile | 6 ------ Makefile.objs | 2 ++ arch_init.c | 12 ++++++++---- audio/Makefile.objs | 2 +- backends/Makefile.objs | 2 +- configure | 2 +- coroutine-gthread.c | 7 ++----- disas/Makefile.objs | 2 +- docs/memory.txt | 10 +++++----- hw/9pfs/virtio-9p-local.c | 1 + hw/9pfs/virtio-9p-synth.c | 2 +- hw/core/qdev.c | 4 ++-- hw/mips/mips_fulong2e.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/vmxnet3.c | 6 +++--- hw/net/xgmac.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_rtas.c | 2 +- hw/s390x/event-facility.c | 2 +- hw/scsi/scsi-bus.c | 2 +- hw/xen/xen_backend.c | 1 - include/exec/memory.h | 2 +- include/glib-compat.h | 12 ++++++++++++ include/qemu-common.h | 12 ------------ libcacard/vcard_emul_nss.c | 3 ++- libcacard/vreader.c | 4 ++-- monitor.c | 2 +- qemu-timer.c | 2 +- qga/main.c | 2 +- qmp.c | 6 +++++- tests/tcg/Makefile | 2 -- tests/tcg/test_path.c | 7 ------- ui/Makefile.objs | 2 +- ui/console.c | 2 +- util/osdep.c | 21 +++++++++------------ util/readline.c | 11 ++++++++--- 36 files changed, 79 insertions(+), 84 deletions(-)
[Qemu-devel] [PULL 03/22] qga: Fix typo (plural) in comment
From: Stefan Weil <[email protected]>
--- qga/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qga/main.c +1 -1
@@ -1110,7 +1110,7 @@ int main(int argc, char **argv)if (ga_is_frozen (s)) {if (daemonize) { -/* delay opening/locking of pidfile till filesystem are unfrozen */ +/* delay opening/locking of pidfile till filesystems are unfrozen */ s->deferred_options.pid_filepath = pid_filepath;become_daemon (NULL ); }
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 01/22] Makefiles: convert some obj-specific CFLAGS to use new foo.o-cflags syntax
In reply to Michael TokarevCurrent Makefile system allows using foo.o-cflags variables to store object-specific CFLAGS. Convert some usages of old syntax (using QEMU_CFLAGS += construct) to the new syntax.
Do not touch multifile modules for now, as build system isn't ready for this.
--- Makefile | 6 ------ Makefile.objs | 2 ++ audio/Makefile.objs | 2 +- backends/Makefile.objs | 2 +- disas/Makefile.objs | 2 +- ui/Makefile.objs | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-)
Makefile +0 -6
@@ -148,10 +148,6 @@ endif all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules -vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) - -vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) - config-host.h: config-host.h-timestamp config-host.h-timestamp: config-host.mak qemu-options.def: $(SRC_PATH)/qemu-options.hx
@@ -195,8 +191,6 @@ ALL_SUBDIRS=$(TARGET_DIRS) $(patsubst %,pc-bios/%, $(ROMS)) recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES) -bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS) - $(BUILD_DIR)/version.o: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h | $(BUILD_DIR)/version.lo $(call quiet-command,$(WINDRES) -I$(BUILD_DIR) -o $@ $<," RC version.o") $(BUILD_DIR)/version.lo: $(SRC_PATH)/version.rc $(BUILD_DIR)/config-host.h
Makefile.objs +2 -0
@@ -64,9 +64,11 @@ common-obj-y += hw/ common-obj-y += ui/ common-obj-y += bt-host.o bt-vhci.o +bt-host.o-cflags := $(BLUEZ_CFLAGS) common-obj-y += dma-helpers.o common-obj-y += vl.o +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) common-obj-y += tpm.o common-obj-$(CONFIG_SLIRP) += slirp/
audio/Makefile.objs +1 -1
@@ -14,4 +14,4 @@ common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o common-obj-y += wavcapture.o $(obj)/audio.o $(obj)/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS) -$(obj)/sdlaudio.o: QEMU_CFLAGS += $(SDL_CFLAGS) +sdlaudio.o-cflags := $(SDL_CFLAGS)
backends/Makefile.objs +1 -1
@@ -3,6 +3,6 @@ common-obj-$(CONFIG_POSIX) += rng-random.o common-obj-y += msmouse.o common-obj-$(CONFIG_BRLAPI) += baum.o -$(obj)/baum.o: QEMU_CFLAGS += $(SDL_CFLAGS) +baum.o-cflags := $(SDL_CFLAGS) common-obj-$(CONFIG_TPM) += tpm.o
disas/Makefile.objs +1 -1
@@ -4,7 +4,7 @@ common-obj-$(CONFIG_ARM_DIS) += arm.o common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/ libvixldir = $(SRC_PATH)/disas/libvixl -$(obj)/arm-a64.o: QEMU_CFLAGS += -I$(libvixldir) +arm-a64.o-cflags := -I$(libvixldir) common-obj-$(CONFIG_CRIS_DIS) += cris.o common-obj-$(CONFIG_HPPA_DIS) += hppa.o common-obj-$(CONFIG_I386_DIS) += i386.o
ui/Makefile.objs +1 -1
@@ -17,4 +17,4 @@ common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o $(obj)/sdl.o $(obj)/sdl_zoom.o $(obj)/sdl2.o: QEMU_CFLAGS += $(SDL_CFLAGS) -$(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS) +gtk.o-cflags := $(GTK_CFLAGS) $(VTE_CFLAGS)
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 04/22] tests/tcg: Fix compilation of test_path
In reply to Michael TokarevFrom: Peter Maydell <[email protected]>
The test_path binary is (unlike the other test binaries in tests/tcg) actually intended to be compiled with the same compiler used to build the main QEMU executables. It actually #includes a number of the QEMU source files in an attempt to unit-test the util/path.c functions, and so if it is not compiled with the same compiler used by configure to set CONFIG_ settings then it is liable to fail to build. Fix the makefile to build it with the default C compiler rules, not CC_I386, and fix the test itself not to include a lot of unnecessary trace related source files which cause the build to fail if the trace backend is anything other than 'simple'.
--- tests/tcg/Makefile | 2 -- tests/tcg/test_path.c | 7 ------- 2 files changed, 9 deletions(-)
tests/tcg/Makefile +0 -2
@@ -81,10 +81,8 @@ run-test_path: test_path # rules to compile tests test_path: test_path.o - $(CC_I386) $(LDFLAGS) -o $@ $^ $(LIBS) test_path.o: test_path.c - $(CC_I386) $(QEMU_INCLUDES) $(GLIB_CFLAGS) $(CFLAGS) -c -o $@ $^ hello-i386: hello-i386.c $(CC_I386) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
tests/tcg/test_path.c +0 -7
@@ -1,17 +1,10 @@/* Test path override code */ -#define _GNU_SOURCE#include "config-host.h" #include "util/cutils.c" #include "util/hexdump.c" #include "util/iov.c" #include "util/path.c" #include "util/qemu-timer-common.c" -#include "trace/control.c" -#include "../trace/generated-events.c" -#ifdef CONFIG_TRACE_SIMPLE -#include "trace/simple.c" -#endif -#include <stdarg.h> #include <sys/stat.h> #include <fcntl.h>
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 02/22] configure: remove bashism
In reply to Michael TokarevCommit e26110cfc67d48 added a check for shacmd to create a hash for modules. This check in configure is using bash construct &> to redirect both stdout and stderr, which does fun things on some shells. Get rid of it, use standard redirection instead.
--- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
@@ -2628,7 +2628,7 @@ done if test "$modules" = yes; then shacmd_probe="sha1sum sha1 shasum" for c in $shacmd_probe; do - if which $c &>/dev/null; then + if which $c >/dev/null 2>&1; then shacmd="$c" break fi
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 05/22] arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()
In reply to Michael TokarevFrom: Chen Gang <[email protected]>
When DPRINTF() has effect, the original author wants to print all ram_load() calling results. So need use 'goto' instead of 'return' within ram_load(), just like other areas have done.
--- arch_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch_init.c +8 -4
@@ -998,7 +998,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) seq_iter++;if (version_id <4 || version_id >4 ) { -return -EINVAL ; + ret = -EINVAL ; + goto done; } do {
@@ -1055,7 +1056,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) host =host_from_stream_offset (f, addr, flags);if (!host) { -return -EINVAL ; + ret = -EINVAL ; + goto done; } ch =qemu_get_byte (f);
@@ -1065,14 +1067,16 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id) host =host_from_stream_offset (f, addr, flags);if (!host) { -return -EINVAL ; + ret = -EINVAL ; + goto done; }qemu_get_buffer (f, host,TARGET_PAGE_SIZE ); }else if (flags &RAM_SAVE_FLAG_XBZRLE ) {void *host =host_from_stream_offset (f, addr, flags);if (!host) { -return -EINVAL ; + ret = -EINVAL ; + goto done; }if (load_xbzrle (f, addr, host) <0 ) {
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 22/22] libcacard: remove unnecessary EOL from debug prints
In reply to Michael TokarevFrom: Alon Levy <[email protected]>
--- libcacard/vreader.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libcacard/vreader.c +2 -2
@@ -273,12 +273,12 @@ vreader_xfr_bytes(VReader *reader, response =vcard_make_response (status); card_status =VCARD_DONE ; }else { -g_debug ("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s\n" , +g_debug ("%s: CLS=0x%x,INS=0x%x,P1=0x%x,P2=0x%x,Lc=%d,Le=%d %s" , __func__, apdu->a_cla, apdu->a_ins, apdu->a_p1, apdu->a_p2, apdu->a_Lc, apdu->a_Le,apdu_ins_to_string (apdu->a_ins)); card_status =vcard_process_apdu (card, apdu, &response);if (response) { -g_debug ("%s: status=%d sw1=0x%x sw2=0x%x len=%d (total=%d)\n" , +g_debug ("%s: status=%d sw1=0x%x sw2=0x%x len=%d (total=%d)" , __func__, response->b_status, response->b_sw1, response->b_sw2, response->b_len, response->b_total_len); }
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 11/22] qemu-timer: Add missing 'static' attribute
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
This fixes a warning from the static code analysis (smatch).
--- qemu-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qemu-timer.c +1 -1
@@ -56,7 +56,7 @@ typedef struct QEMUClock { } QEMUClock;QEMUTimerListGroup main_loop_tlg; -QEMUClock qemu_clocks[QEMU_CLOCK_MAX ]; +static QEMUClock qemu_clocks[QEMU_CLOCK_MAX ];/* A QEMUTimerList is a list of timers attached to a clock. More * than one QEMUTimerList can be attached to each clock, for instance
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 07/22] hw/mips: Add missing 'static' and 'const' attributes
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
This fixes a warning from the static code analysis (smatch).
--- hw/mips/mips_fulong2e.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/mips/mips_fulong2e.c +1 -1
@@ -211,7 +211,7 @@ static void main_cpu_reset(void *opaque) } } -uint8_t eeprom_spd[0x80 ] = { +static const uint8_t eeprom_spd[0x80 ] = {0x80 ,0x08 ,0x07 ,0x0d ,0x09 ,0x02 ,0x40 ,0x00 ,0x04 ,0x70 ,0x70 ,0x00 ,0x82 ,0x10 ,0x00 ,0x01 ,0x0e ,0x04 ,0x0c ,0x01 ,0x02 ,0x20 ,0x80 ,0x75 ,0x70 ,0x00 ,0x00 ,0x50 ,0x3c ,0x50 ,
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 06/22] hw/9pfs: Add missing 'static' attributes
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
--- hw/9pfs/virtio-9p-synth.c | 2 +- hw/core/qdev.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/9pfs/virtio-9p-synth.c +1 -1
@@ -21,7 +21,7 @@#include <sys/stat.h> /* Root node for synth file system */ -V9fsSynthNode v9fs_synth_root = { +static V9fsSynthNode v9fs_synth_root = { .name ="/" , .actual_attr = { .mode =0555 |S_IFDIR ,
hw/core/qdev.c +2 -2
@@ -660,8 +660,8 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,* Legacy properties are string versions of other OOM properties. The format * of the string depends on the property type. */ -void qdev_property_add_legacy (DeviceState *dev,Property *prop, -Error **errp) +static void qdev_property_add_legacy (DeviceState *dev,Property *prop, +Error **errp) {gchar *name;
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 18/22] qmp: report path ambiguity error
In reply to Michael TokarevWithout this, ambiguous path is reported to the user as "not found", which is confusing at least.
--- qmp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
qmp.c +5 -1
@@ -200,7 +200,11 @@ ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp) obj =object_resolve_path (path, &ambiguous);if (obj ==NULL ) { -error_set (errp,QERR_DEVICE_NOT_FOUND , path); +if (ambiguous) { +error_setg (errp,"Path '%s' is ambiguous" , path); + }else { +error_set (errp,QERR_DEVICE_NOT_FOUND , path); + }return NULL ; }
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 21/22] docs/memory.txt: Fix document on MMIO operations
In reply to Michael TokarevFrom: Fam Zheng <[email protected]>
.impl.valid should be .impl.unaligned and the description needs some fixes.
.old_portio is removed since commit b40acf99b (ioport: Switch dispatching to memory core layer).
--- docs/memory.txt | 10 +++++----- include/exec/memory.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
docs/memory.txt +5 -5
@@ -232,8 +232,8 @@ various constraints can be supplied to control how these callbacks are called: (in bytes) supported by the *implementation*; other access sizes will be emulated using the ones available. For example a 4-byte write will be emulated using four 1-byte writes, if .impl.max_access_size = 1. - - .impl.valid specifies that the *implementation* only supports unaligned - accesses; unaligned accesses will be emulated by two aligned accesses. - - .old_portio and .old_mmio can be used to ease porting from code using - cpu_register_io_memory() and register_ioport(). They should not be used - in new code. + - .impl.unaligned specifies that the *implementation* supports unaligned + accesses; if false, unaligned accesses will be emulated by two aligned + accesses. + - .old_mmio can be used to ease porting from code using + cpu_register_io_memory(). It should not be used in new code.
include/exec/memory.h +1 -1
@@ -110,7 +110,7 @@ struct MemoryRegionOps {/* If true, unaligned accesses are supported. Otherwise all accesses * are converted to (possibly multiple) naturally aligned accesses. */ -bool unaligned; +bool unaligned; } impl;/* If .read and .write are not present, old_mmio may be used for
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 14/22] hw/9pfs: Add include file for exported symbol
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
--- hw/9pfs/virtio-9p-local.c | 1 + 1 file changed, 1 insertion(+)
hw/9pfs/virtio-9p-local.c +1 -0
@@ -14,6 +14,7 @@#include "hw/virtio/virtio.h" #include "virtio-9p.h" #include "virtio-9p-xattr.h" +#include "fsdev/qemu-fsdev.h" /* local_ops */ #include <arpa/inet.h> #include <pwd.h> #include <grp.h>
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 10/22] ui: Add missing 'static' attribute
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
There was already a forward declaration using 'static', but the attribute was missing in the implementation.
This fixes a warning from the static code analysis (smatch).
--- ui/console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ui/console.c +1 -1
@@ -1407,7 +1407,7 @@ void dpy_gfx_replace_surface(QemuConsole *con,qemu_free_displaysurface (old_surface); } -void dpy_refresh (DisplayState *s) +static void dpy_refresh (DisplayState *s) {DisplayChangeListener *dcl;
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 16/22] glib: move g_poll() replacement into glib-compat.h
In reply to Michael TokarevFrom: Stefan Hajnoczi <[email protected]>
We have a dedicated header file for wrappers to smooth over glib version differences. Move the g_poll() definition into glib-compat.h for consistency.
--- include/glib-compat.h | 12 ++++++++++++ include/qemu-common.h | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-)
include/glib-compat.h +12 -0
@@ -24,4 +24,16 @@ static inline guint g_timeout_add_seconds(guint interval, GSourceFunc function, }#endif +#if !GLIB_CHECK_VERSION (2 ,20 ,0 ) +/* +* Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly +* on older systems. +*/ +static inline gint g_poll (GPollFD *fds,guint nfds,gint timeout) +{ +GMainContext *ctx =g_main_context_default (); +return g_main_context_get_poll_func (ctx)(fds, nfds, timeout); +} +#endif +#endif
include/qemu-common.h +0 -12
@@ -124,18 +124,6 @@ int qemu_main(int argc, char **argv, char **envp);void qemu_get_timedate (struct tm *tm,int offset);int qemu_timedate_diff (struct tm *tm); -#if !GLIB_CHECK_VERSION (2 ,20 ,0 ) -/* -* Glib before 2.20.0 doesn't implement g_poll, so wrap it to compile properly -* on older systems. -*/ -static inline gint g_poll (GPollFD *fds,guint nfds,gint timeout) -{ -GMainContext *ctx =g_main_context_default (); -return g_main_context_get_poll_func (ctx)(fds, nfds, timeout); -} -#endif -/** * is_help_option: * @s: string to test
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 09/22] monitor: Add missing 'static' attribute
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
This fixes a warning from the static code analysis (smatch).
--- monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
monitor.c +1 -1
@@ -488,7 +488,7 @@ static const char *monitor_event_names[] = { }; QEMU_BUILD_BUG_ON(ARRAY_SIZE(monitor_event_names) != QEVENT_MAX) -MonitorEventState monitor_event_state[QEVENT_MAX ]; +static MonitorEventState monitor_event_state[QEVENT_MAX ];/* * Emits the event to every monitor instance
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 17/22] libcacard: replace pstrcpy() with memcpy()
In reply to Michael TokarevCommit 2e679780ae86c6ca8 replaced strncpy() with pstrcpy() in one place in libcacard. This is a qemu-specific function, while libcacard is a stand-alone library (or tries to be). But since we know the exact length of the string to copy, and know that it definitely will fit in the destination buffer, use memcpy() instead, and null-terminate the string after that.
An alternative is to use g_strlcpy() or strncpy(), but memcpy() is more than adequate in this place.
--- libcacard/vcard_emul_nss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
libcacard/vcard_emul_nss.c +2 -1
@@ -1162,7 +1162,8 @@ vcard_emul_options(const char *args)NEXT_TOKEN (vname)NEXT_TOKEN (type_params ) type_params_length =MIN (type_params_length,sizeof (type_str)-1 ); -pstrcpy (type_str, type_params_length, type_params); +memcpy (type_str, type_params, type_params_length); + type_str[type_params_length] ='\0' ; type =vcard_emul_type_from_string (type_str);NEXT_TOKEN (type_params)
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 20/22] readline: Sort completions before printing them.
In reply to Michael TokarevFrom: Hani Benhabiles <[email protected]>
--- util/readline.c | 7 +++++++ 1 file changed, 7 insertions(+)
util/readline.c +7 -0
@@ -272,6 +272,11 @@ void readline_set_completion_index(ReadLineState *rs, int index) rs->completion_index = index; } +static int completion_comp (const void *a,const void *b) +{ +return strcmp (*(const char **) a, *(const char **) b); +} +static void readline_completion (ReadLineState *rs) {int len, i, j, max_width, nb_cols, max_prefix;
@@ -295,6 +300,8 @@ static void readline_completion(ReadLineState *rs)if (len >0 && rs->completions[0 ][len -1 ] !='/' )readline_insert_char (rs,' ' ); }else { +qsort (rs->completions, rs->nb_completions,sizeof (char *), + completion_comp); rs->printf_func (rs->opaque,"\n" ); max_width =0 ; max_prefix =0 ;
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 13/22] xen: remove unused global, xen_xcg
In reply to Michael TokarevFrom: Jim Meyering <[email protected]>
--- hw/xen/xen_backend.c | 1 - 1 file changed, 1 deletion(-)
hw/xen/xen_backend.c +0 -1
@@ -45,7 +45,6 @@/* public */ XenXC xen_xc =XC_HANDLER_INITIAL_VALUE ; -XenGnttab xen_xcg =XC_HANDLER_INITIAL_VALUE ;struct xs_handle *xenstore =NULL ;const char *xen_protocol;
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 19/22] readline: use g_strndup instead of open-coding it
In reply to Michael Tokarev--- util/readline.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
util/readline.c +1 -3
@@ -279,9 +279,7 @@ static void readline_completion(ReadLineState *rs) rs->nb_completions =0 ; - cmdline =g_malloc (rs->cmd_buf_index +1 ); -memcpy (cmdline, rs->cmd_buf, rs->cmd_buf_index); - cmdline[rs->cmd_buf_index] ='\0' ; + cmdline =g_strndup (rs->cmd_buf, rs->cmd_buf_index); rs->completion_finder (rs->opaque, cmdline);g_free (cmdline);
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 12/22] hw: Add missing 'static' attributes
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
This fixes warnings from the static code analysis (smatch).
--- hw/net/cadence_gem.c | 2 +- hw/net/vmxnet3.c | 6 +++--- hw/net/xgmac.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/ppc/spapr_rtas.c | 2 +- hw/scsi/scsi-bus.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
hw/net/cadence_gem.c +1 -1
@@ -388,7 +388,7 @@ typedef struct GemState { } GemState;/* The broadcast MAC address: 0xFFFFFFFFFFFF */ -const uint8_t broadcast_addr[] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF }; +static const uint8_t broadcast_addr[] = {0xFF ,0xFF ,0xFF ,0xFF ,0xFF ,0xFF };/* * gem_init_register_masks:
hw/net/vmxnet3.c +3 -3
@@ -2305,7 +2305,7 @@ static void vmxnet3_put_txq_descr(QEMUFile *f, void *pv, size_t size)vmxnet3_put_tx_stats_to_file (f, &r->txq_stats); } -const VMStateInfo txq_descr_info = { +static const VMStateInfo txq_descr_info = { .name ="txq_descr" , .get = vmxnet3_get_txq_descr, .put = vmxnet3_put_txq_descr
@@ -2397,7 +2397,7 @@ static int vmxnet3_post_load(void *opaque, int version_id)return 0 ; } -const VMStateInfo rxq_descr_info = { +static const VMStateInfo rxq_descr_info = { .name ="rxq_descr" , .get = vmxnet3_get_rxq_descr, .put = vmxnet3_put_rxq_descr
@@ -2423,7 +2423,7 @@ static void vmxnet3_put_int_state(QEMUFile *f, void *pv, size_t size)qemu_put_byte (f, r->is_asserted); } -const VMStateInfo int_state_info = { +static const VMStateInfo int_state_info = { .name ="int_state" , .get = vmxnet3_get_int_state, .put = vmxnet3_put_int_state
hw/net/xgmac.c +1 -1
@@ -152,7 +152,7 @@ typedef struct XgmacState {uint32_t regs[R_MAX ]; } XgmacState; -const VMStateDescription vmstate_rxtx_stats = { +static const VMStateDescription vmstate_rxtx_stats = { .name ="xgmac_stats" , .version_id =1 , .minimum_version_id =1 ,
hw/ppc/spapr_iommu.c +1 -1
@@ -35,7 +35,7 @@ enum sPAPRTCEAccess { SPAPR_TCE_RW = 3, }; -QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; +static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables;static sPAPRTCETable *spapr_tce_find_by_liobn (uint32_t liobn) {
hw/ppc/spapr_rtas.c +1 -1
@@ -272,7 +272,7 @@ static struct rtas_call {spapr_rtas_fn fn; } rtas_table[TOKEN_MAX ]; -struct rtas_call *rtas_next = rtas_table; +static struct rtas_call *rtas_next = rtas_table; target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args,
hw/scsi/scsi-bus.c +1 -1
@@ -1179,7 +1179,7 @@ static uint64_t scsi_cmd_lba(SCSICommand *cmd)return lba; } -int scsi_req_parse (SCSICommand *cmd,SCSIDevice *dev,uint8_t *buf) +static int scsi_req_parse (SCSICommand *cmd,SCSIDevice *dev,uint8_t *buf) {int rc;
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 15/22] do not call g_thread_init() for glib >= 2.31
In reply to Michael Tokarevglib >= 2.31 always enables thread support and g_thread_supported() is #defined to 1, there's no need to call g_thread_init() anymore, and it definitely does not need to report error which never happens. Keep code for old < 2.31 glibc anyway for now, just #ifdef it differently.
--- coroutine-gthread.c | 7 ++----- util/osdep.c | 21 +++++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-)
coroutine-gthread.c +2 -5
@@ -115,14 +115,11 @@ static inline GThread *create_thread(GThreadFunc func, gpointer data)static void __attribute__((constructor))coroutine_init (void ) { -if (!g_thread_supported ()) {#if !GLIB_CHECK_VERSION (2 ,31 ,0 ) +if (!g_thread_supported ()) {g_thread_init (NULL ); -#else -fprintf (stderr,"glib threading failed to initialize.\n" ); -exit (1 ); -#endif } +#endif init_coroutine_cond (); }
util/osdep.c +9 -12
@@ -436,23 +436,20 @@ int socket_init(void)return 0 ; } -/* Ensure that glib is running in multi-threaded mode */ +#if !GLIB_CHECK_VERSION (2 ,31 ,0 ) +/* Ensure that glib is running in multi-threaded mode +* Old versions of glib require explicit initialization. Failure to do +* this results in the single-threaded code paths being taken inside +* glib. For example, the g_slice allocator will not be thread-safe +* and cause crashes. +*/ static void __attribute__((constructor))thread_init (void ) {if (!g_thread_supported ()) { -#if !GLIB_CHECK_VERSION (2 ,31 ,0 ) -/* Old versions of glib require explicit initialization. Failure to do -* this results in the single-threaded code paths being taken inside -* glib. For example, the g_slice allocator will not be thread-safe -* and cause crashes. -*/ -g_thread_init (NULL ); -#else -fprintf (stderr,"glib threading failed to initialize.\n" ); -exit (1 ); -#endif +g_thread_init (NULL ); } } +#endif #ifndef CONFIG_IOVEC /* helper function for iov_send_recv() */
Signature · 1 line
1.7.10.4
[Qemu-devel] [PULL 08/22] hw/s390x: Add missing 'static' attribute
In reply to Michael TokarevFrom: Stefan Weil <[email protected]>
--- hw/s390x/event-facility.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/event-facility.c +1 -1
@@ -32,7 +32,7 @@ struct SCLPEventFacility {unsigned int receive_mask; }; -SCLPEvent cpu_hotplug; +static SCLPEvent cpu_hotplug;/* return true if any child has event pending set */ static bool event_pending (SCLPEventFacility *ef)
Signature · 1 line
1.7.10.4
Quoted 11 lines · Michael Tokarev
Here's another pull request for trival patches.
This time, it includes:- many cleanups from Stefan Weil, mostly adding `static' attrs
- some more trivial patches from glib cleanups, by me and Stefan Hajnoczi
- some more trivial changes for libcacard, from me and Alon Levy
- small fixes from Chen Gang (debug) and Peter Maydell (tests)
- little makefile cleanups and configure fix from me
- documentation fixes from Fam Zheng
- and some more random things
Quoted 1 line
All are little things here and there, just how -trivial tree should really be.
Hi; I'm afraid this pull breaks the build of the A64 disassembler:
c++ -I/home/petmay01/linaro/qemu-for-merges/tcg -I/home/petmay01/linaro/qemu-for-merges/tcg/i386 -I/home/petmay01/linaro/qemu-for-merges/linux-headers -I/home/petmay01/linaro/qemu-for-merges/build/alldbg/linux-headers -I. -I/home/petmay01/linaro/qemu-for-merges -I/home/petmay01/linaro/qemu-for-merges/include -I/home/petmay01/linaro/qemu-for-merges/libcacard -I/home/petmay01/linaro/qemu-for-merges/disas -Idisas -D__STDC_LIMIT_MACROS -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wundef -Wwrite-strings -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wtype-limits -fstack-protector-all -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I/usr/include/nss -I/usr/include/nspr -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/home/petmay01/linaro/qemu-for-merges/tests -MMD -MP -MT disas/arm-a64.o -MF disas/arm-a64.d -pthread -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -c -odisas/arm-a64.o /home/petmay01/linaro/qemu-for-merges/disas/arm-a64.cc /home/petmay01/linaro/qemu-for-merges/disas/arm-a64.cc:20:28: fatal
error: a64/disasm-a64.h: No such file or directory compilation terminated.
make: *** [disas/arm-a64.o] Error 1
Quoted 1 line
Makefiles: convert some obj-specific CFLAGS to use new foo.o-cflags syntax
git bisect says it's this makefile change.
I think the problem here is that the rune for applying obj-specific CFLAGS is only in the Rules.make line for %.o: %.c, and not in the lines for building a .o file from a .cc, .cpp or .m file. That should probably be fixed.
thanks
-- PMM
Quoted 27 lines · Peter Maydell
Hi; I'm afraid this pull breaks the build of the A64 disassembler:
c++ -I/home/petmay01/linaro/qemu-for-merges/tcg
(quoted diff) +0
-16-I/home/petmay01/linaro/qemu-for-merges/tcg/i386 -I/home/petmay01/linaro/qemu-for-merges/linux-headers -I/home/petmay01/linaro/qemu-for-merges/build/alldbg/linux-headers -I. -I/home/petmay01/linaro/qemu-for-merges -I/home/petmay01/linaro/qemu-for-merges/include -I/home/petmay01/linaro/qemu-for-merges/libcacard -I/home/petmay01/linaro/qemu-for-merges/disas -Idisas -D__STDC_LIMIT_MACROS -Werror -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wall -Wundef -Wwrite-strings -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wtype-limits -fstack-protector-all -I/usr/include/p11-kit-1 -I/usr/include/libpng12 -I/usr/include/nss -I/usr/include/nspr -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/home/petmay01/linaro/qemu-for-merges/tests -MMD -MP -MT
disas/arm-a64.o-MF disas/arm-a64.d -pthread -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -c -odisas/arm-a64.o/home/petmay01/linaro/qemu-for-merges/disas/arm-a64.cc/home/petmay01/linaro/qemu-for-merges/disas/arm-a64.cc:20:28: fatal
error:a64/disasm-a64.h: No such file or directory compilation terminated.
make: *** [disas/arm-a64.o] Error 1
Quoted 8 lines
Quoted 1 line
Makefiles: convert some obj-specific CFLAGS to use new foo.o-cflags syntax
git bisect says it's this makefile change.
I think the problem here is that the rune for applying obj-specific CFLAGS is only in the Rules.make line for %.o: %.c, and not in the lines for building a .o file from a .cc, .cpp or .m file. That should probably be fixed.
Interesting. It looks like I should add C++ compiler to my test environment, because I really verified the change and it builds here just fine, but it does not detect C++ so does not try to build C++ files.
Lovely.
I'm resending the patchset without this patch, will work on it more.
Thank you, and sorry for the noize.
/mjt
Quoted 3 lines · Michael Tokarev
Interesting. It looks like I should add C++ compiler to my test environment, because I really verified the change and it builds here just fine, but it does not detect C++ so does not try to build C++ files.
Yep; we didn't want to require everybody to have a C++ compiler (especially for cross-compilation that could be tricky), so the A64 disassembler only builds if there's a C++ compiler detected.
thanks
-- PMM
Il 07/05/2014 14:50, Peter Maydell ha scritto:
Quoted 6 lines
git bisect says it's this makefile change.
I think the problem here is that the rune for applying obj-specific CFLAGS is only in the Rules.make line for %.o: %.c, and not in the lines for building a .o file from a .cc, .cpp or .m file. That should probably be fixed.
I thought I had said I would include it together with other build patches... Michael, can you remove it from qemu-trivial? It's not like soft freeze is tomorrow.
Paolo
Quoted 9 lines · Paolo Bonzini
Il 07/05/2014 14:50, Peter Maydell ha scritto:
Quoted 6 lines
git bisect says it's this makefile change.
I think the problem here is that the rune for applying obj-specific CFLAGS is only in the Rules.make line for %.o: %.c, and not in the lines for building a .o file from a .cc, .cpp or .m file. That should probably be fixed.
I thought I had said I would include it together with other build patches...
I don't think you mentioned this patch in particular, and I haven't seen you commented on it, either.
Quoted 1 line
Michael, can you remove it from qemu-trivial?
That's exactly what I did, to have some time to rework it so it wont cause more issues.
Thanks,
/mjt