qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: aliguori@us.ibm.com
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 11/15] hmp: dump-guest-memory: hardcode protocol argument to "file:"
Date: Thu, 27 Sep 2012 10:28:25 -0300	[thread overview]
Message-ID: <1348752509-1142-12-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1348752509-1142-1-git-send-email-lcapitulino@redhat.com>

Today, it's necessary to specify the protocol you want to use
when dumping the guest memory, for example:

 (qemu) dump-guest-memory file:/tmp/guest-memory

This has a few issues:

 1. It's cumbersome to type
 2. We loose file path autocompletion
 3. Being able to specify fd:X in HMP makes little sense for humans

Because of these reasons, hardcode the 'protocol' argument to
'file:' in HMP.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
 hmp-commands.hx | 8 +++-----
 hmp.c           | 8 ++++++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index ed67e99..0302458 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -914,12 +914,11 @@ ETEXI
 #if defined(CONFIG_HAVE_CORE_DUMP)
     {
         .name       = "dump-guest-memory",
-        .args_type  = "paging:-p,protocol:s,begin:i?,length:i?",
-        .params     = "[-p] protocol [begin] [length]",
+        .args_type  = "paging:-p,filename:F,begin:i?,length:i?",
+        .params     = "[-p] filename [begin] [length]",
         .help       = "dump guest memory to file"
                       "\n\t\t\t begin(optional): the starting physical address"
                       "\n\t\t\t length(optional): the memory size, in bytes",
-        .user_print = monitor_user_noop,
         .mhandler.cmd = hmp_dump_guest_memory,
     },
 
@@ -929,8 +928,7 @@ STEXI
 @findex dump-guest-memory
 Dump guest memory to @var{protocol}. The file can be processed with crash or
 gdb.
-  protocol: destination file(started with "file:") or destination file
-            descriptor (started with "fd:")
+  filename: dump file name
     paging: do paging to get guest's memory mapping
      begin: the starting physical address. It's optional, and should be
             specified with length together.
diff --git a/hmp.c b/hmp.c
index ba6fbd3..2de3140 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1042,11 +1042,12 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
 {
     Error *errp = NULL;
     int paging = qdict_get_try_bool(qdict, "paging", 0);
-    const char *file = qdict_get_str(qdict, "protocol");
+    const char *file = qdict_get_str(qdict, "filename");
     bool has_begin = qdict_haskey(qdict, "begin");
     bool has_length = qdict_haskey(qdict, "length");
     int64_t begin = 0;
     int64_t length = 0;
+    char *prot;
 
     if (has_begin) {
         begin = qdict_get_int(qdict, "begin");
@@ -1055,9 +1056,12 @@ void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
         length = qdict_get_int(qdict, "length");
     }
 
-    qmp_dump_guest_memory(paging, file, has_begin, begin, has_length, length,
+    prot = g_strconcat("file:", file, NULL);
+
+    qmp_dump_guest_memory(paging, prot, has_begin, begin, has_length, length,
                           &errp);
     hmp_handle_error(mon, &errp);
+    g_free(prot);
 }
 
 void hmp_netdev_add(Monitor *mon, const QDict *qdict)
-- 
1.7.12.315.g682ce8b

  parent reply	other threads:[~2012-09-27 13:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27 13:28 [Qemu-devel] [PULL 00/15]: QMP queue Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 01/15] Make negotiation optional in QEMUMonitorProtocol Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 02/15] Support settimeout " Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 03/15] Add qemu-ga-client script Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 04/15] qapi: do not protect enum values from namespace pollution Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 05/15] qapi: add "unix" to the set of reserved words Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 06/15] pci-assign: use monitor_handle_fd_param Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 07/15] monitor: add Error * argument to monitor_get_fd Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 08/15] qapi: convert add_client Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 09/15] qmp: dump-guest-memory: improve schema doc (again) Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 10/15] qmp: dump-guest-memory: don't spin if non-blocking fd would block Luiz Capitulino
2012-09-27 13:28 ` Luiz Capitulino [this message]
2012-09-28 17:17   ` [Qemu-devel] [PULL 11/15] hmp: dump-guest-memory: hardcode protocol argument to "file:" Eric Blake
2012-09-27 13:28 ` [Qemu-devel] [PULL 12/15] input: qmp_send_key(): simplify Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 13/15] qmp: qmp_send_key(): accept key codes in hex Luiz Capitulino
2012-09-28 10:36   ` Amos Kong
2012-09-28 13:01     ` Eric Blake
2012-09-28 13:30       ` Luiz Capitulino
2012-09-28 13:24     ` Luiz Capitulino
2012-09-28 13:30       ` Amos Kong
2012-09-27 13:28 ` [Qemu-devel] [PULL 14/15] input: index_from_key(): drop unused code Luiz Capitulino
2012-09-27 13:28 ` [Qemu-devel] [PULL 15/15] block: live snapshot documentation tweaks Luiz Capitulino
2012-10-05  2:12 ` [Qemu-devel] [PULL 00/15]: QMP queue Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348752509-1142-12-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).