trivial patches for 2014-05-07

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJTambbAAoJEL7lnXSkw9fbEOcH/REFxjH3t1qbPUeA1woMpwBJ
 74dxEUa0/PXhbjk99O3At03+wrB9g6b6pT7VDqCiq+/HzCYdJukfu86Jiig6Zvo4
 3a9ktjZIuV0Nh8mkyiWv9heSO378xADfZfm1AaVx/NS07W6O6o4W8vzkgDT0nI/e
 01bTdMmpV/AgaVEjPMvW3clB5fq0J3LuccSZV5+xUPGR0iiPZHNLGRqlPUS09aSc
 lNglFcRpkTclKIf5sPUUyrbShMkFGTBqs+8lPHKE7eYby86YCGsZTtPohY/6PqIa
 spAtsTEamvLByeILlQkkh5ESP/Im/3+zSHsfnXaAzMyfwAyGI9xzsrD0Hi7CQdg=
 =Bfks
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mjt/tags/trivial-patches-2014-05-07' into staging

trivial patches for 2014-05-07

# gpg: Signature made Wed 07 May 2014 18:01:15 BST using RSA key ID A4C3D7DB
# gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>"
# gpg:                 aka "Michael Tokarev <mjt@corpit.ru>"
# gpg:                 aka "Michael Tokarev <mjt@debian.org>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
#      Subkey fingerprint: 6F67 E18E 7C91 C5B1 5514  66A7 BEE5 9D74 A4C3 D7DB

* remotes/mjt/tags/trivial-patches-2014-05-07: (21 commits)
  libcacard: remove unnecessary EOL from debug prints
  docs/memory.txt: Fix document on MMIO operations
  readline: Sort completions before printing them.
  readline: use g_strndup instead of open-coding it
  qmp: report path ambiguity error
  libcacard: replace pstrcpy() with memcpy()
  glib: move g_poll() replacement into glib-compat.h
  do not call g_thread_init() for glib >= 2.31
  hw/9pfs: Add include file for exported symbol
  xen: remove unused global, xen_xcg
  hw: Add missing 'static' attributes
  qemu-timer: Add missing 'static' attribute
  ui: Add missing 'static' attribute
  monitor: Add missing 'static' attribute
  hw/s390x: Add missing 'static' attribute
  hw/mips: Add missing 'static' and 'const' attributes
  hw/9pfs: Add missing 'static' attributes
  arch_init: Be sure of only one exit entry with DPRINTF() for ram_load()
  tests/tcg: Fix compilation of test_path
  qga: Fix typo (plural) in comment
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-05-07 18:38:39 +01:00
commit ff788b6fe6
30 changed files with 73 additions and 74 deletions

View File

@ -1036,7 +1036,8 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
seq_iter++;
if (version_id != 4) {
return -EINVAL;
ret = -EINVAL;
goto done;
}
do {
@ -1091,7 +1092,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);
@ -1101,14 +1103,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) {

2
configure vendored
View File

@ -2632,7 +2632,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

View File

@ -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();
}

View File

@ -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.

View File

@ -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>

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -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:

View File

@ -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

View File

@ -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,

View File

@ -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)
{

View File

@ -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,

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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);
}

View File

@ -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

View File

@ -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

View File

@ -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);
}

6
qmp.c
View File

@ -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;
}

View File

@ -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 $@ $<

View File

@ -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>

View File

@ -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;

View File

@ -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() */

View File

@ -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;
@ -279,9 +284,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);
@ -297,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;