mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote branch 'qmp/for-anthony' into staging
This commit is contained in:
@@ -255,10 +255,10 @@ TEXIFLAG=$(if $(V),,--quiet)
|
||||
qemu-options.texi: $(SRC_PATH)/qemu-options.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
|
||||
|
||||
qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
|
||||
qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@," GEN $@")
|
||||
|
||||
QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
|
||||
QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@," GEN $@")
|
||||
|
||||
qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
|
||||
|
||||
+6
-3
@@ -309,7 +309,7 @@ obj-alpha-y = alpha_palcode.o
|
||||
|
||||
main.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
|
||||
|
||||
monitor.o: qemu-monitor.h
|
||||
monitor.o: hmp-commands.h qmp-commands.h
|
||||
|
||||
$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
|
||||
|
||||
@@ -330,13 +330,16 @@ $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
|
||||
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
|
||||
$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
|
||||
|
||||
qemu-monitor.h: $(SRC_PATH)/qemu-monitor.hx
|
||||
hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
|
||||
|
||||
qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
|
||||
$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@," GEN $(TARGET_DIR)$@")
|
||||
|
||||
clean:
|
||||
rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
|
||||
rm -f *.d */*.d tcg/*.o ide/*.o
|
||||
rm -f qemu-monitor.h gdbstub-xml.c
|
||||
rm -f hmp-commands.h qmp-commands.h gdbstub-xml.c
|
||||
|
||||
install: all
|
||||
ifneq ($(PROGS),)
|
||||
|
||||
+2
-2
@@ -82,10 +82,10 @@ doing any code change. This is so because:
|
||||
2. Review can improve your interface. Letting that happen before
|
||||
you implement it can save you work.
|
||||
|
||||
* The qmp-commands.txt file is generated from the qemu-monitor.hx one, which
|
||||
* The qmp-commands.txt file is generated from the qmp-commands.hx one, which
|
||||
is the file that should be edited.
|
||||
|
||||
Homepage
|
||||
--------
|
||||
|
||||
http://www.linux-kvm.org/page/MonitorProtocol
|
||||
http://wiki.qemu.org/QMP
|
||||
|
||||
+1216
File diff suppressed because it is too large
Load Diff
+7
-1
@@ -29,6 +29,10 @@
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
/* Disable guest-provided stats by now (https://bugzilla.redhat.com/show_bug.cgi?id=623903) */
|
||||
#define ENABLE_GUEST_STATS 0
|
||||
|
||||
|
||||
typedef struct VirtIOBalloon
|
||||
{
|
||||
VirtIODevice vdev;
|
||||
@@ -83,12 +87,14 @@ static QObject *get_stats_qobject(VirtIOBalloon *dev)
|
||||
VIRTIO_BALLOON_PFN_SHIFT);
|
||||
|
||||
stat_put(dict, "actual", actual);
|
||||
#if ENABLE_GUEST_STATS
|
||||
stat_put(dict, "mem_swapped_in", dev->stats[VIRTIO_BALLOON_S_SWAP_IN]);
|
||||
stat_put(dict, "mem_swapped_out", dev->stats[VIRTIO_BALLOON_S_SWAP_OUT]);
|
||||
stat_put(dict, "major_page_faults", dev->stats[VIRTIO_BALLOON_S_MAJFLT]);
|
||||
stat_put(dict, "minor_page_faults", dev->stats[VIRTIO_BALLOON_S_MINFLT]);
|
||||
stat_put(dict, "free_mem", dev->stats[VIRTIO_BALLOON_S_MEMFREE]);
|
||||
stat_put(dict, "total_mem", dev->stats[VIRTIO_BALLOON_S_MEMTOT]);
|
||||
#endif
|
||||
|
||||
return QOBJECT(dict);
|
||||
}
|
||||
@@ -214,7 +220,7 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target,
|
||||
}
|
||||
dev->stats_callback = cb;
|
||||
dev->stats_opaque_callback_data = cb_data;
|
||||
if (dev->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ)) {
|
||||
if (ENABLE_GUEST_STATS && (dev->vdev.guest_features & (1 << VIRTIO_BALLOON_F_STATS_VQ))) {
|
||||
virtqueue_push(dev->svq, &dev->stats_vq_elem, dev->stats_vq_offset);
|
||||
virtio_notify(&dev->vdev, dev->svq);
|
||||
} else {
|
||||
|
||||
@@ -14,10 +14,10 @@ extern Monitor *default_mon;
|
||||
#define MONITOR_IS_DEFAULT 0x01
|
||||
#define MONITOR_USE_READLINE 0x02
|
||||
#define MONITOR_USE_CONTROL 0x04
|
||||
#define MONITOR_USE_PRETTY 0x08
|
||||
|
||||
/* flags for monitor commands */
|
||||
#define MONITOR_CMD_ASYNC 0x0001
|
||||
#define MONITOR_CMD_USER_ONLY 0x0002
|
||||
|
||||
/* QMP events */
|
||||
typedef enum MonitorEvent {
|
||||
|
||||
@@ -283,6 +283,9 @@ static QemuOptsList qemu_mon_opts = {
|
||||
},{
|
||||
.name = "default",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
},{
|
||||
.name = "pretty",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
},
|
||||
{ /* end of list */ }
|
||||
},
|
||||
|
||||
@@ -72,43 +72,57 @@ QObject *qobject_from_jsonf(const char *string, ...)
|
||||
|
||||
typedef struct ToJsonIterState
|
||||
{
|
||||
int indent;
|
||||
int pretty;
|
||||
int count;
|
||||
QString *str;
|
||||
} ToJsonIterState;
|
||||
|
||||
static void to_json(const QObject *obj, QString *str);
|
||||
static void to_json(const QObject *obj, QString *str, int pretty, int indent);
|
||||
|
||||
static void to_json_dict_iter(const char *key, QObject *obj, void *opaque)
|
||||
{
|
||||
ToJsonIterState *s = opaque;
|
||||
QString *qkey;
|
||||
int j;
|
||||
|
||||
if (s->count) {
|
||||
if (s->count)
|
||||
qstring_append(s->str, ", ");
|
||||
|
||||
if (s->pretty) {
|
||||
qstring_append(s->str, "\n");
|
||||
for (j = 0 ; j < s->indent ; j++)
|
||||
qstring_append(s->str, " ");
|
||||
}
|
||||
|
||||
qkey = qstring_from_str(key);
|
||||
to_json(QOBJECT(qkey), s->str);
|
||||
to_json(QOBJECT(qkey), s->str, s->pretty, s->indent);
|
||||
QDECREF(qkey);
|
||||
|
||||
qstring_append(s->str, ": ");
|
||||
to_json(obj, s->str);
|
||||
to_json(obj, s->str, s->pretty, s->indent);
|
||||
s->count++;
|
||||
}
|
||||
|
||||
static void to_json_list_iter(QObject *obj, void *opaque)
|
||||
{
|
||||
ToJsonIterState *s = opaque;
|
||||
int j;
|
||||
|
||||
if (s->count) {
|
||||
if (s->count)
|
||||
qstring_append(s->str, ", ");
|
||||
|
||||
if (s->pretty) {
|
||||
qstring_append(s->str, "\n");
|
||||
for (j = 0 ; j < s->indent ; j++)
|
||||
qstring_append(s->str, " ");
|
||||
}
|
||||
|
||||
to_json(obj, s->str);
|
||||
to_json(obj, s->str, s->pretty, s->indent);
|
||||
s->count++;
|
||||
}
|
||||
|
||||
static void to_json(const QObject *obj, QString *str)
|
||||
static void to_json(const QObject *obj, QString *str, int pretty, int indent)
|
||||
{
|
||||
switch (qobject_type(obj)) {
|
||||
case QTYPE_QINT: {
|
||||
@@ -193,8 +207,16 @@ static void to_json(const QObject *obj, QString *str)
|
||||
|
||||
s.count = 0;
|
||||
s.str = str;
|
||||
s.indent = indent + 1;
|
||||
s.pretty = pretty;
|
||||
qstring_append(str, "{");
|
||||
qdict_iter(val, to_json_dict_iter, &s);
|
||||
if (pretty) {
|
||||
int j;
|
||||
qstring_append(str, "\n");
|
||||
for (j = 0 ; j < indent ; j++)
|
||||
qstring_append(str, " ");
|
||||
}
|
||||
qstring_append(str, "}");
|
||||
break;
|
||||
}
|
||||
@@ -204,8 +226,16 @@ static void to_json(const QObject *obj, QString *str)
|
||||
|
||||
s.count = 0;
|
||||
s.str = str;
|
||||
s.indent = indent + 1;
|
||||
s.pretty = pretty;
|
||||
qstring_append(str, "[");
|
||||
qlist_iter(val, (void *)to_json_list_iter, &s);
|
||||
if (pretty) {
|
||||
int j;
|
||||
qstring_append(str, "\n");
|
||||
for (j = 0 ; j < indent ; j++)
|
||||
qstring_append(str, " ");
|
||||
}
|
||||
qstring_append(str, "]");
|
||||
break;
|
||||
}
|
||||
@@ -249,7 +279,16 @@ QString *qobject_to_json(const QObject *obj)
|
||||
{
|
||||
QString *str = qstring_new();
|
||||
|
||||
to_json(obj, str);
|
||||
to_json(obj, str, 0, 0);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
QString *qobject_to_json_pretty(const QObject *obj)
|
||||
{
|
||||
QString *str = qstring_new();
|
||||
|
||||
to_json(obj, str, 1, 0);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -23,5 +23,6 @@ QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2);
|
||||
QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0);
|
||||
|
||||
QString *qobject_to_json(const QObject *obj);
|
||||
QString *qobject_to_json_pretty(const QObject *obj);
|
||||
|
||||
#endif /* QJSON_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user