Skip to contentSkip to conversation

: QMP: Commands doc

PATCH Superseded Luiz Capitulino 4 participants 13 messages May 19, 2010 – May 31, 2010 Kbuild

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover : QMP: Commands doc

This new version moves the documentation to qemu-monitor.hx and now QMP/qmp-commands.txt is generated from there (thanks Jan!).

I hope I've addressed all review comments in this version and now it should describe reality.

Next step is to fix glitches (after this series is merged, of course).

changelog
---------

v2 -> v3
--------

- Rebased
- Addressed review comments
- Move contents to qemu-monitor.hx (Jan)

v1 -> v2
--------

- Rebased
- Addressed Markus's comments
- Changed indentation style
- Minor fixes and clarifications

#1 lore raw

PATCH v3 1/3 monitor: Reorder info documentation

From: Jan Kiszka <[email protected]>

Push the doc fragments for the info command to the end of qemu-monitor.hx. This helps to establish a proper layout in the upcoming QMP documentation.

---
 qemu-monitor.hx |  166 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 86 insertions(+), 80 deletions(-)
qemu-monitor.hx +86 -80
index a8f194c..3709708 100644
@@ -38,86 +38,6 @@ Commit changes to the disk images (if -snapshot is used) or backing files.
 ETEXI
 
     {
-        .name       = "info",
-        .args_type  = "item:s?",
-        .params     = "[subcommand]",
-        .help       = "show various information about the system state",
-        .user_print = monitor_user_noop,
-        .mhandler.cmd_new = do_info,
-    },
-
-STEXI
-@item info @var{subcommand}
-@findex info
-Show various information about the system state.
-
-@table @option
-@item info version
-show the version of QEMU
-@item info network
-show the various VLANs and the associated devices
-@item info chardev
-show the character devices
-@item info block
-show the block devices
-@item info block
-show block device statistics
-@item info registers
-show the cpu registers
-@item info cpus
-show infos for each CPU
-@item info history
-show the command line history
-@item info irq
-show the interrupts statistics (if available)
-@item info pic
-show i8259 (PIC) state
-@item info pci
-show emulated PCI device info
-@item info tlb
-show virtual to physical memory mappings (i386 only)
-@item info mem
-show the active virtual memory mappings (i386 only)
-@item info hpet
-show state of HPET (i386 only)
-@item info kvm
-show KVM information
-@item info usb
-show USB devices plugged on the virtual USB hub
-@item info usbhost
-show all USB host devices
-@item info profile
-show profiling information
-@item info capture
-show information about active capturing
-@item info snapshots
-show list of VM snapshots
-@item info status
-show the current VM status (running|paused)
-@item info pcmcia
-show guest PCMCIA status
-@item info mice
-show which guest mouse is receiving events
-@item info vnc
-show the vnc server status
-@item info name
-show the current VM name
-@item info uuid
-show the current VM UUID
-@item info cpustats
-show CPU statistics
-@item info usernet
-show user network stack connection states
-@item info migrate
-show migration status
-@item info balloon
-show balloon information
-@item info qtree
-show device tree
-@end table
-ETEXI
-
-    {
         .name       = "q|quit",
         .args_type  = "",
         .params     = "",
@@ -1182,6 +1102,92 @@ STEXI
 Enable the specified QMP capabilities
 ETEXI
 
+
+HXCOMM Keep the 'info' command at the end!
+HXCOMM This is required for the QMP documentation layout.
+
+    {
+        .name       = "info",
+        .args_type  = "item:s?",
+        .params     = "[subcommand]",
+        .help       = "show various information about the system state",
+        .user_print = monitor_user_noop,
+        .mhandler.cmd_new = do_info,
+    },
+
+STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
+
+@table @option
+@item info version
+show the version of QEMU
+@item info network
+show the various VLANs and the associated devices
+@item info chardev
+show the character devices
+@item info block
+show the block devices
+@item info block
+show block device statistics
+@item info registers
+show the cpu registers
+@item info cpus
+show infos for each CPU
+@item info history
+show the command line history
+@item info irq
+show the interrupts statistics (if available)
+@item info pic
+show i8259 (PIC) state
+@item info pci
+show emulated PCI device info
+@item info tlb
+show virtual to physical memory mappings (i386 only)
+@item info mem
+show the active virtual memory mappings (i386 only)
+@item info hpet
+show state of HPET (i386 only)
+@item info kvm
+show KVM information
+@item info usb
+show USB devices plugged on the virtual USB hub
+@item info usbhost
+show all USB host devices
+@item info profile
+show profiling information
+@item info capture
+show information about active capturing
+@item info snapshots
+show list of VM snapshots
+@item info status
+show the current VM status (running|paused)
+@item info pcmcia
+show guest PCMCIA status
+@item info mice
+show which guest mouse is receiving events
+@item info vnc
+show the vnc server status
+@item info name
+show the current VM name
+@item info uuid
+show the current VM UUID
+@item info cpustats
+show CPU statistics
+@item info usernet
+show user network stack connection states
+@item info migrate
+show migration status
+@item info balloon
+show balloon information
+@item info qtree
+show device tree
+@end table
+ETEXI
+
+HXCOMM DO NOT add new commands after 'info', move your addition before it!
+
 STEXI
 @end table
 ETEXI
Signature · 1 line
1.7.1.86.g0e460
#2 lore raw

PATCH v3 2/3 QMP: Introduce commands documentation

In reply to Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 1367 insertions(+), 5 deletions(-)
Makefile +4 -1
index 306a1a4..110698e 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+	$(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
QMP/README +3 -2
index 9334c25..35a80c7 100644
@@ -15,8 +15,9 @@ QMP is JSON[1] based and has the following features:
 
 For more information, please, refer to the following files:
 
-o qmp-spec.txt    QEMU Monitor Protocol current specification
-o qmp-events.txt  List of available asynchronous events
+o qmp-spec.txt      QEMU Monitor Protocol current specification
+o qmp-commands.txt  QMP supported commands
+o qmp-events.txt    List of available asynchronous events
 
 There are also two simple Python scripts available:
 
configure +4 -0
index 36d028f..6738e0b 100755
@@ -2807,3 +2807,7 @@ ln -s $source_path/Makefile.user $d/Makefile
 if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
 fi
+
+if test "$docs" = "yes" ; then
+  mkdir -p QMP
+fi
hxtool +43 -1

65 lines not on this page · raw message

qemu-monitor.hx +1313 -1

1,544 lines not on this page · raw message

Signature · 1 line
1.7.1.86.g0e460
#3 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 142 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 1367 insertions(+), 5 deletions(-)
Makefile +4 -1
index 306a1a4..110698e 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
QMP/README +3 -2
index 9334c25..35a80c7 100644
@@ -15,8 +15,9 @@ QMP is JSON[1] based and has the following features:
 
 For more information, please, refer to the following files:
 
-o qmp-spec.txt    QEMU Monitor Protocol current specification
-o qmp-events.txt  List of available asynchronous events
+o qmp-spec.txt      QEMU Monitor Protocol current specification
+o qmp-commands.txt  QMP supported commands
+o qmp-events.txt    List of available asynchronous events
 
 There are also two simple Python scripts available:
 
configure +4 -0
index 36d028f..6738e0b 100755
@@ -2807,3 +2807,7 @@ ln -s $source_path/Makefile.user $d/Makefile
 if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
 fi
+
+if test "$docs" = "yes" ; then
+  mkdir -p QMP
+fi
hxtool +39 -1
index 8f65532..d499dc0 100644
@@ -7,7 +7,7 @@ hxtoh()
         case $str in
             HXCOMM*)
             ;;
-            STEXI*|ETEXI*) flag=$(($flag^1))
+            STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
             ;;
             *)
             test $flag -eq 1 && printf "%s\n" "$str"
@@ -38,6 +38,12 @@ hxtotexi()
             fi
             flag=0
             ;;
+            SQMP*|EQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected ETEXI, found $str" >&2
+                exit 1
+            fi
+            ;;
             DEFHEADING*)
             echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
             ;;
@@ -49,9 +55,45 @@ hxtotexi()
     done
 }
 
+hxtoqmp()
+{
+    IFS=
+    flag=0
+    while read -r str; do
+        case "$str" in
+            HXCOMM*)
+            ;;
+            SQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            flag=1
+            ;;
+            EQMP*)
+            if test $flag -ne 1 ; then
+                echo "line $line: syntax error: expected SQMP, found $str" >&2
+                exit 1
+            fi
+            flag=0
+            ;;
+            STEXI*|ETEXI*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            ;;
+            *)
+            test $flag -eq 1 && echo "$str"
+            ;;
+        esac

hxtool hxtotexi() · line 99

Quoted 10 lines
hxtool +4 -0
+    done
+}
+
 case "$1" in
 "-h") hxtoh ;;
 "-t") hxtotexi ;;
+"-q") hxtoqmp ;;
 *) exit 1 ;;
 esac
 

Unfortunately, it looks like you mismerged my hxtool changes (the syntax checking bits and the extensions for S/EQMP.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#4 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 148 lines · On Wed, 19 May 2010 11:15:16 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 147 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 1367 insertions(+), 5 deletions(-)
Makefile +4 -1
index 306a1a4..110698e 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
QMP/README +3 -2
index 9334c25..35a80c7 100644
@@ -15,8 +15,9 @@ QMP is JSON[1] based and has the following features:
 
 For more information, please, refer to the following files:
 
-o qmp-spec.txt    QEMU Monitor Protocol current specification
-o qmp-events.txt  List of available asynchronous events
+o qmp-spec.txt      QEMU Monitor Protocol current specification
+o qmp-commands.txt  QMP supported commands
+o qmp-events.txt    List of available asynchronous events
 
 There are also two simple Python scripts available:
 
configure +4 -0
index 36d028f..6738e0b 100755
@@ -2807,3 +2807,7 @@ ln -s $source_path/Makefile.user $d/Makefile
 if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
 fi
+
+if test "$docs" = "yes" ; then
+  mkdir -p QMP
+fi
hxtool +42 -1
index 8f65532..d499dc0 100644
@@ -7,7 +7,7 @@ hxtoh()
         case $str in
             HXCOMM*)
             ;;
-            STEXI*|ETEXI*) flag=$(($flag^1))
+            STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
             ;;
             *)
             test $flag -eq 1 && printf "%s\n" "$str"
@@ -38,6 +38,12 @@ hxtotexi()
             fi
             flag=0
             ;;
+            SQMP*|EQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected ETEXI, found $str" >&2
+                exit 1
+            fi
+            ;;
             DEFHEADING*)
             echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
             ;;
@@ -49,9 +55,45 @@ hxtotexi()
     done
 }
 
+hxtoqmp()
+{
+    IFS=
+    flag=0
+    while read -r str; do
+        case "$str" in
+            HXCOMM*)
+            ;;
+            SQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            flag=1
+            ;;
+            EQMP*)
+            if test $flag -ne 1 ; then
+                echo "line $line: syntax error: expected SQMP, found $str" >&2
+                exit 1
+            fi
+            flag=0
+            ;;
+            STEXI*|ETEXI*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            ;;
+            *)
+            test $flag -eq 1 && echo "$str"
+            ;;
+        esac
+    done
+}
+
 case "$1" in
 "-h") hxtoh ;;
Quoted 8 lines

hxtool hxtotexi() · line 99

Quoted 5 lines
hxtool +1 -0
 "-t") hxtotexi ;;
+"-q") hxtoqmp ;;
 *) exit 1 ;;
 esac
 

Unfortunately, it looks like you mismerged my hxtool changes (the syntax checking bits and the extensions for S/EQMP.

Isn't the extensions for S/EQMP in the hunk right above us?

I didn't submit the syntax checking bits on purpose, there's something
failing there and I didn't want to check it now.

This series seems to work as expected, anyway.

#5 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 159 lines · Luiz Capitulino
Quoted 147 lines · On Wed, 19 May 2010 11:15:16 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 146 lines · Luiz Capitulino

From: Jan Kiszka <[email protected]>

One of the most important missing feature in QMP today is its supported commands documentation.

The plan is to make it part of self-description support, however self-description is a big task we have been postponing for a long time now and still don't know when it's going to be done.

In order not to compromise QMP adoption and make users' life easier, this commit adds a simple text documentation which fully describes all QMP supported commands.

This is not ideal for a number of reasons (harder to maintain, text-only, etc) but does improve the current situation. To avoid at least divering from the user monitor help and texi snippets, QMP bits are also maintained inside qemu-monitor.hx, and hxtool is extended to generate a single text file from them.

---
 Makefile        |    5 +-
 QMP/README      |    5 +-
 configure       |    4 +
 hxtool          |   44 ++-
 qemu-monitor.hx | 1314 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 1367 insertions(+), 5 deletions(-)
Makefile +4 -1
index 306a1a4..110698e 100644
@@ -29,7 +29,7 @@ $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw)
 LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
-DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
+DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8 QMP/qmp-commands.txt
 else
 DOCS=
 endif
@@ -259,6 +259,9 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/qemu-monitor.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
+QMP/qmp-commands.txt: $(SRC_PATH)/qemu-monitor.hx
+       $(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
+
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
 
QMP/README +3 -2
index 9334c25..35a80c7 100644
@@ -15,8 +15,9 @@ QMP is JSON[1] based and has the following features:
 
 For more information, please, refer to the following files:
 
-o qmp-spec.txt    QEMU Monitor Protocol current specification
-o qmp-events.txt  List of available asynchronous events
+o qmp-spec.txt      QEMU Monitor Protocol current specification
+o qmp-commands.txt  QMP supported commands
+o qmp-events.txt    List of available asynchronous events
 
 There are also two simple Python scripts available:
 
configure +4 -0
index 36d028f..6738e0b 100755
@@ -2807,3 +2807,7 @@ ln -s $source_path/Makefile.user $d/Makefile
 if test "$static" = "no" -a "$user_pie" = "yes" ; then
   echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
 fi
+
+if test "$docs" = "yes" ; then
+  mkdir -p QMP
+fi
hxtool +42 -1
index 8f65532..d499dc0 100644
@@ -7,7 +7,7 @@ hxtoh()
         case $str in
             HXCOMM*)
             ;;
-            STEXI*|ETEXI*) flag=$(($flag^1))
+            STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
             ;;
             *)
             test $flag -eq 1 && printf "%s\n" "$str"
@@ -38,6 +38,12 @@ hxtotexi()
             fi
             flag=0
             ;;
+            SQMP*|EQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected ETEXI, found $str" >&2
+                exit 1
+            fi
+            ;;
             DEFHEADING*)
             echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
             ;;
@@ -49,9 +55,45 @@ hxtotexi()
     done
 }
 
+hxtoqmp()
+{
+    IFS=
+    flag=0
+    while read -r str; do
+        case "$str" in
+            HXCOMM*)
+            ;;
+            SQMP*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            flag=1
+            ;;
+            EQMP*)
+            if test $flag -ne 1 ; then
+                echo "line $line: syntax error: expected SQMP, found $str" >&2
+                exit 1
+            fi
+            flag=0
+            ;;
+            STEXI*|ETEXI*)
+            if test $flag -eq 1 ; then
+                echo "line $line: syntax error: expected EQMP, found $str" >&2
+                exit 1
+            fi
+            ;;
+            *)
+            test $flag -eq 1 && echo "$str"
+            ;;
+        esac
+    done
+}
+
 case "$1" in
Quoted 8 lines

hxtool hxtotexi() · line 99

Quoted 6 lines
hxtool +1 -0
 "-h") hxtoh ;;
 "-t") hxtotexi ;;
+"-q") hxtoqmp ;;
 *) exit 1 ;;
 esac
 

Unfortunately, it looks like you mismerged my hxtool changes (the syntax checking bits and the extensions for S/EQMP.

Quoted 1 line

Isn't the extensions for S/EQMP in the hunk right above us?

The conversion should work, and there is even the check for proper SQMP/EQMP balancing in place. I just realized that already my version was lacking "line=1" and "line=$((line+1))" for the loop above. Hmpf, will send an add-on fix later.

Quoted 3 lines

I didn't submit the syntax checking bits on purpose, there's something
failing there and I didn't want to check it now.

You already did for QMP, just skipped the STEXI/ETEXI balancing checks. And if that reports an error for TEXI, better have a closer look. It worked fine with my tree, so something may have regressed.

Quoted 2 lines

This series seems to work as expected, anyway.

Yes, no problem, we can still fix small fallouts on top of it.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#6 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 1 line · On Wed, 19 May 2010 15:30:43 +0200 Jan Kiszka <[email protected]> wrote:

Luiz Capitulino wrote:

[...]

Quoted 6 lines
Quoted 2 lines

I didn't submit the syntax checking bits on purpose, there's something
failing there and I didn't want to check it now.

You already did for QMP, just skipped the STEXI/ETEXI balancing checks. And if that reports an error for TEXI, better have a closer look. It worked fine with my tree, so something may have regressed.

Here you go:

"""
GEN qemu-img-cmds.texi
line 10: syntax error: expected ETEXI, found STEXI
make: *** [qemu-img-cmds.texi] Error 1
make: *** Deleting file `qemu-img-cmds.texi' """

Indeed, looks like a bug in qemu-img-cmds.hx:

"""
STEXI
@table @option
STEXI
"""

#7 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 22 lines · Luiz Capitulino
Quoted 1 line · On Wed, 19 May 2010 15:30:43 +0200 Jan Kiszka <[email protected]> wrote:

Luiz Capitulino wrote:

[...]

Quoted 5 lines
Quoted 2 lines

I didn't submit the syntax checking bits on purpose, there's something
failing there and I didn't want to check it now.

You already did for QMP, just skipped the STEXI/ETEXI balancing checks. And if that reports an error for TEXI, better have a closer look. It worked fine with my tree, so something may have regressed.

Here you go:

"""
GEN qemu-img-cmds.texi
line 10: syntax error: expected ETEXI, found STEXI
make: *** [qemu-img-cmds.texi] Error 1
make: *** Deleting file `qemu-img-cmds.texi' """

Quoted 7 lines

Indeed, looks like a bug in qemu-img-cmds.hx:

"""
STEXI
@table @option
STEXI
"""

Oh, then I also did no "make clean all" run with my patch applied that night... :] Still, good to know that it works. I can handle this if you don't want to.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
#8 lore raw

[Qemu-devel] Re: [PATCH 2/3] QMP: Introduce commands documentation

Quoted 31 lines · On Wed, 19 May 2010 15:50:56 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 22 lines · Luiz Capitulino
Quoted 1 line · On Wed, 19 May 2010 15:30:43 +0200 Jan Kiszka <[email protected]> wrote:

Luiz Capitulino wrote:

[...]

Quoted 5 lines
Quoted 2 lines

I didn't submit the syntax checking bits on purpose, there's something
failing there and I didn't want to check it now.

You already did for QMP, just skipped the STEXI/ETEXI balancing checks. And if that reports an error for TEXI, better have a closer look. It worked fine with my tree, so something may have regressed.

Here you go:

"""
GEN qemu-img-cmds.texi
line 10: syntax error: expected ETEXI, found STEXI
make: *** [qemu-img-cmds.texi] Error 1
make: *** Deleting file `qemu-img-cmds.texi' """

Quoted 7 lines

Indeed, looks like a bug in qemu-img-cmds.hx:

"""
STEXI
@table @option
STEXI
"""

Quoted 3 lines

Oh, then I also did no "make clean all" run with my patch applied that night... :] Still, good to know that it works. I can handle this if you don't want to.

Please do, you could send both patches in the same series (ie. fix and
feature), so that we don't break the build.

#9 lore raw

PATCH v3 3/3 Monitor: Drop QMP documentation from code

In reply to Luiz Capitulino

Previous commit added the QMP/qmp-commands.txt file, which is a copy of this information.

While it's good to keep it near code, maintaining two copies of the same information is too hard and has little benefit as we don't expect client writers to consult the code to find how to use a QMP command.

---
 block.c     |   69 ----------------------------------------
 hw/pci.c    |   61 -----------------------------------
 hw/qdev.c   |   13 -------
 input.c     |   18 ----------
 migration.c |   38 ----------------------
 monitor.c   |  102 -----------------------------------------------------------
 net.c       |   22 -------------
 qemu-char.c |   16 ---------
 vnc.c       |   29 -----------------
 9 files changed, 0 insertions(+), 368 deletions(-)
block.c +0 -69
index bfe46e3..73a8182 100644
@@ -1429,33 +1429,6 @@ void bdrv_info_print(Monitor *mon, const QObject *data)
     qlist_iter(qobject_to_qlist(data), bdrv_print_dict, mon);
 }
 
-/**
- * bdrv_info(): Block devices information
- *
- * Each block device information is stored in a QDict and the
- * returned QObject is a QList of all devices.
- *
- * The QDict contains the following:
- *
- * - "device": device name
- * - "type": device type
- * - "removable": true if the device is removable, false otherwise
- * - "locked": true if the device is locked, false otherwise
- * - "inserted": only present if the device is inserted, it is a QDict
- *    containing the following:
- *          - "file": device file name
- *          - "ro": true if read-only, false otherwise
- *          - "drv": driver format name
- *          - "backing_file": backing file name if one is used
- *          - "encrypted": true if encrypted, false otherwise
- *
- * Example:
- *
- * [ { "device": "ide0-hd0", "type": "hd", "removable": false, "locked": false,
- *     "inserted": { "file": "/tmp/foobar", "ro": false, "drv": "qcow2" } },
- *   { "device": "floppy0", "type": "floppy", "removable": true,
- *     "locked": false } ]
- */
 void bdrv_info(Monitor *mon, QObject **ret_data)
 {
     QList *bs_list;
@@ -1561,48 +1534,6 @@ static QObject* bdrv_info_stats_bs(BlockDriverState *bs)
     return res;
 }
 
-/**
- * bdrv_info_stats(): show block device statistics
- *
- * Each device statistic information is stored in a QDict and
- * the returned QObject is a QList of all devices.
- *
- * The QDict contains the following:
- *
- * - "device": device name
- * - "stats": A QDict with the statistics information, it contains:
- *     - "rd_bytes": bytes read
- *     - "wr_bytes": bytes written
- *     - "rd_operations": read operations
- *     - "wr_operations": write operations
- *     - "wr_highest_offset": Highest offset of a sector written since the
- *       BlockDriverState has been opened
- * - "parent": A QDict recursively holding the statistics of the underlying
- *    protocol (e.g. the host file for a qcow2 image). If there is no
- *    underlying protocol, this field is omitted.
- *
- * Example:
- *
- * [ { "device": "ide0-hd0",
- *               "stats": { "rd_bytes": 512,
- *                          "wr_bytes": 0,
- *                          "rd_operations": 1,
- *                          "wr_operations": 0,
- *                          "wr_highest_offset": 0 },
- *               "parent": {
- *                      "stats": { "rd_bytes": 1024,
- *                                 "wr_bytes": 0,
- *                                 "rd_operations": 2,
- *                                 "wr_operations": 0,
- *                                 "wr_highest_offset": 0,
- *                      } } },
- *   { "device": "ide1-cd0",
- *               "stats": { "rd_bytes": 0,
- *                          "wr_bytes": 0,
- *                          "rd_operations": 0,
- *                          "wr_operations": 0,
- *                          "wr_highest_offset": 0 } },
- */
 void bdrv_info_stats(Monitor *mon, QObject **ret_data)
 {
     QObject *obj;
hw/pci.c +0 -61

67 lines not on this page · raw message

hw/qdev.c +0 -13
index af17486..aa2ce01 100644
@@ -779,19 +779,6 @@ void do_info_qdm(Monitor *mon)
     }
 }
 
-/**
- * do_device_add(): Add a device
- *
- * Argument qdict contains
- * - "driver": the name of the new device's driver
- * - "bus": the device's parent bus (device tree path)
- * - "id": the device's ID (must be unique)
- * - device properties
- *
- * Example:
- *
- * { "driver": "usb-net", "id": "eth1", "netdev": "netdev1" }
- */
 int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     QemuOpts *opts;
input.c +0 -18
index 8f0941e..651442d 100644
@@ -214,24 +214,6 @@ void do_info_mice_print(Monitor *mon, const QObject *data)
     qlist_iter(mice_list, info_mice_iter, mon);
 }
 
-/**
- * do_info_mice(): Show VM mice information
- *
- * Each mouse is represented by a QDict, the returned QObject is a QList of
- * all mice.
- *
- * The mouse QDict contains the following:
- *
- * - "name": mouse's name
- * - "index": mouse's index
- * - "current": true if this mouse is receiving events, false otherwise
- * - "absolute": true if the mouse generates absolute input events
- *
- * Example:
- *
- * [ { "name": "QEMU Microsoft Mouse", "index": 0, "current": false, "absolute": false },
- *   { "name": "QEMU PS/2 Mouse", "index": 1, "current": true, "absolute": true } ]
- */
 void do_info_mice(Monitor *mon, QObject **ret_data)
 {
     QEMUPutMouseEntry *cursor;
migration.c +0 -38
index 05f6cc5..706fe55 100644
@@ -197,44 +197,6 @@ static void migrate_put_status(QDict *qdict, const char *name,
     qdict_put_obj(qdict, name, obj);
 }
 
-/**
- * do_info_migrate(): Migration status
- *
- * Return a QDict. If migration is active there will be another
- * QDict with RAM migration status and if block migration is active
- * another one with block migration status.
- *
- * The main QDict contains the following:
- *
- * - "status": migration status
- * - "ram": only present if "status" is "active", it is a QDict with the
- *   following RAM information (in bytes):
- *          - "transferred": amount transferred
- *          - "remaining": amount remaining
- *          - "total": total
- * - "disk": only present if "status" is "active" and it is a block migration,
- *   it is a QDict with the following disk information (in bytes):
- *          - "transferred": amount transferred
- *          - "remaining": amount remaining
- *          - "total": total
- *
- * Examples:
- *
- * 1. Migration is "completed":
- *
- * { "status": "completed" }
- *
- * 2. Migration is "active" and it is not a block migration:
- *
- * { "status": "active",
- *            "ram": { "transferred": 123, "remaining": 123, "total": 246 } }
- *
- * 3. Migration is "active" and it is a block migration:
- *
- * { "status": "active",
- *   "ram": { "total": 1057024, "remaining": 1053304, "transferred": 3720 },
- *   "disk": { "total": 20971520, "remaining": 20880384, "transferred": 91136 }}
- */
 void do_info_migrate(Monitor *mon, QObject **ret_data)
 {
     QDict *qdict;
monitor.c +0 -102

150 lines not on this page · raw message

net.c +0 -22
index 378edfc..efa8b3d 100644
@@ -1194,18 +1194,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
     qemu_del_vlan_client(vc);
 }
 
-/**
- * do_netdev_add(): Add a host network device
- *
- * Argument qdict contains
- * - "type": the device type, "tap", "user", ...
- * - "id": the device's ID (must be unique)
- * - device options
- *
- * Example:
- *
- * { "type": "user", "id": "netdev1", "hostname": "a-guest" }
- */
 int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     QemuOpts *opts;
@@ -1220,16 +1208,6 @@ int do_netdev_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
     return res;
 }
 
-/**
- * do_netdev_del(): Delete a host network device
- *
- * Argument qdict contains
- * - "id": the device's ID
- *
- * Example:
- *
- * { "id": "netdev1" }
- */
 int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
 {
     const char *id = qdict_get_str(qdict, "id");
qemu-char.c +0 -16
index ac65a1c..faaf624 100644
@@ -2528,22 +2528,6 @@ void qemu_chr_info_print(Monitor *mon, const QObject *ret_data)
     qlist_iter(qobject_to_qlist(ret_data), qemu_chr_qlist_iter, mon);
 }
 
-/**
- * qemu_chr_info(): Character devices information
- *
- * Each device is represented by a QDict. The returned QObject is a QList
- * of all devices.
- *
- * The QDict contains the following:
- *
- * - "label": device's label
- * - "filename": device's file
- *
- * Example:
- *
- * [ { "label": "monitor", "filename", "stdio" },
- *   { "label": "serial0", "filename": "vc" } ]
- */
 void qemu_chr_info(Monitor *mon, QObject **ret_data)
 {
     QList *chr_list;
vnc.c +0 -29
index 1f7ad73..d4189ea 100644
@@ -321,35 +321,6 @@ void do_info_vnc_print(Monitor *mon, const QObject *data)
     }
 }
 
-/**
- * do_info_vnc(): Show VNC server information
- *
- * Return a QDict with server information. Connected clients are returned
- * as a QList of QDicts.
- *
- * The main QDict contains the following:
- *
- * - "enabled": true or false
- * - "host": server's IP address
- * - "family": address family ("ipv4" or "ipv6")
- * - "service": server's port number
- * - "auth": authentication method
- * - "clients": a QList of all connected clients
- *
- * Clients are described by a QDict, with the following information:
- *
- * - "host": client's IP address
- * - "family": address family ("ipv4" or "ipv6")
- * - "service": client's port number
- * - "x509_dname": TLS dname (optional)
- * - "sasl_username": SASL username (optional)
- *
- * Example:
- *
- * { "enabled": true, "host": "0.0.0.0", "service": "50402", "auth": "vnc",
- *   "family": "ipv4",
- *   "clients": [{ "host": "127.0.0.1", "service": "50401", "family": "ipv4" }]}
- */
 void do_info_vnc(Monitor *mon, QObject **ret_data)
 {
     if (vnc_display == NULL || vnc_display->display == NULL) {
Signature · 1 line
1.7.1.86.g0e460
#10 lore raw

Re: [Qemu-devel] [PATCH 3/3] Monitor: Drop QMP documentation from code

Quoted 2 lines · Luiz Capitulino

Previous commit added the QMP/qmp-commands.txt file, which is a copy of this information.

This is no longer true.

Quoted 6 lines

While it's good to keep it near code, maintaining two copies of the same information is too hard and has little benefit as we don't expect client writers to consult the code to find how to use a QMP command.

[...]

#11 lore raw
In reply to Luiz Capitulino
Quoted 7 lines · Luiz Capitulino

This new version moves the documentation to qemu-monitor.hx and now QMP/qmp-commands.txt is generated from there (thanks Jan!).

I hope I've addressed all review comments in this version and now it should describe reality.

Next step is to fix glitches (after this series is merged, of course).

This is a fragile series, breaking quickly when something changes in qemu-monitor.hx (as just happened). Can we get this rebased and merged ASAP?

Thanks,
Jan

Quoted 20 lines

changelog
---------

v2 -> v3
--------

- Rebased
- Addressed review comments
- Move contents to qemu-monitor.hx (Jan)

v1 -> v2
--------

- Rebased
- Addressed Markus's comments
- Changed indentation style
- Minor fixes and clarifications

#12 lore raw
Quoted 11 lines · On Sat, 29 May 2010 10:50:55 +0200 Jan Kiszka <[email protected]> wrote:
Quoted 7 lines · Luiz Capitulino

This new version moves the documentation to qemu-monitor.hx and now QMP/qmp-commands.txt is generated from there (thanks Jan!).

I hope I've addressed all review comments in this version and now it should describe reality.

Next step is to fix glitches (after this series is merged, of course).

This is a fragile series, breaking quickly when something changes in qemu-monitor.hx (as just happened). Can we get this rebased and merged ASAP?

Will rebase and resend later today.