qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Alon Levy <alevy@redhat.com>
Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 14/14] qapi: convert screendump
Date: Mon, 28 May 2012 10:12:07 -0300	[thread overview]
Message-ID: <20120528101207.033791d1@doriath.home> (raw)
In-Reply-To: <20120528085631.GA8353@garlic>

On Mon, 28 May 2012 11:56:31 +0300
Alon Levy <alevy@redhat.com> wrote:

> On Fri, May 25, 2012 at 04:41:19PM -0300, Luiz Capitulino wrote:
> 
> One small note below.
> 
> > Also activates error reporting from devices.
> > 
> > Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> > ---
> >  console.c        |  7 ++++---
> >  console.h        |  1 -
> >  hmp-commands.hx  |  5 ++---
> >  hmp.c            |  9 +++++++++
> >  hmp.h            |  1 +
> >  monitor.c        |  6 ------
> >  qapi-schema.json | 24 ++++++++++++++++++++++++
> >  qmp-commands.hx  |  5 +----
> >  8 files changed, 41 insertions(+), 17 deletions(-)
> > 
> > diff --git a/console.c b/console.c
> > index 4669e62..2bbf104 100644
> > --- a/console.c
> > +++ b/console.c
> > @@ -24,6 +24,7 @@
> >  #include "qemu-common.h"
> >  #include "console.h"
> >  #include "qemu-timer.h"
> > +#include "qmp-commands.h"
> >  
> >  //#define DEBUG_CONSOLE
> >  #define DEFAULT_BACKSCROLL 512
> > @@ -173,7 +174,7 @@ void vga_hw_invalidate(void)
> >          active_console->hw_invalidate(active_console->hw);
> >  }
> >  
> > -void vga_hw_screen_dump(const char *filename)
> > +void qmp_screendump(const char *filename, Error **errp)
> >  {
> >      TextConsole *previous_active_console;
> >      bool cswitch;
> > @@ -187,9 +188,9 @@ void vga_hw_screen_dump(const char *filename)
> >          console_select(0);
> >      }
> >      if (consoles[0] && consoles[0]->hw_screen_dump) {
> > -        consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch, NULL);
> > +        consoles[0]->hw_screen_dump(consoles[0]->hw, filename, cswitch, errp);
> >      } else {
> > -        error_report("screen dump not implemented");
> > +        error_set(errp, QERR_NOT_SUPPORTED);
> >      }
> >  
> >      if (cswitch) {
> > diff --git a/console.h b/console.h
> > index 9caeb43..d72c546 100644
> > --- a/console.h
> > +++ b/console.h
> > @@ -356,7 +356,6 @@ DisplayState *graphic_console_init(vga_hw_update_ptr update,
> >  
> >  void vga_hw_update(void);
> >  void vga_hw_invalidate(void);
> > -void vga_hw_screen_dump(const char *filename);
> >  void vga_hw_text_update(console_ch_t *chardata);
> >  
> >  int is_graphic_console(void);
> > diff --git a/hmp-commands.hx b/hmp-commands.hx
> > index 18cb415..74f61bc 100644
> > --- a/hmp-commands.hx
> > +++ b/hmp-commands.hx
> > @@ -193,9 +193,8 @@ ETEXI
> >          .name       = "screendump",
> >          .args_type  = "filename:F",
> >          .params     = "filename",
> > -        .help       = "save screen into PPM image 'filename'",
> > -        .user_print = monitor_user_noop,
> > -        .mhandler.cmd_new = do_screen_dump,
> > +        .help       = "save screen into PPM image 'filepath'",
> > +        .mhandler.cmd = hmp_screen_dump,
> >      },
> >  
> >  STEXI
> > diff --git a/hmp.c b/hmp.c
> > index bb0952e..7e8c0ab 100644
> > --- a/hmp.c
> > +++ b/hmp.c
> > @@ -947,3 +947,12 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
> >      qmp_device_del(id, &err);
> >      hmp_handle_error(mon, &err);
> >  }
> > +
> > +void hmp_screen_dump(Monitor *mon, const QDict *qdict)
> > +{
> > +    const char *filename = qdict_get_str(qdict, "filename");
> > +    Error *err = NULL;
> > +
> > +    qmp_screendump(filename, &err);
> > +    hmp_handle_error(mon, &err);
> > +}
> > diff --git a/hmp.h b/hmp.h
> > index 443b812..fa75ec0 100644
> > --- a/hmp.h
> > +++ b/hmp.h
> > @@ -61,5 +61,6 @@ void hmp_block_job_set_speed(Monitor *mon, const QDict *qdict);
> >  void hmp_block_job_cancel(Monitor *mon, const QDict *qdict);
> >  void hmp_migrate(Monitor *mon, const QDict *qdict);
> >  void hmp_device_del(Monitor *mon, const QDict *qdict);
> > +void hmp_screen_dump(Monitor *mon, const QDict *qdict);
> >  
> >  #endif
> > diff --git a/monitor.c b/monitor.c
> > index 12a6fe2..1160af7 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -897,12 +897,6 @@ static int client_migrate_info(Monitor *mon, const QDict *qdict,
> >      return -1;
> >  }
> >  
> > -static int do_screen_dump(Monitor *mon, const QDict *qdict, QObject **ret_data)
> > -{
> > -    vga_hw_screen_dump(qdict_get_str(qdict, "filename"));
> > -    return 0;
> > -}
> > -
> >  static void do_logfile(Monitor *mon, const QDict *qdict)
> >  {
> >      cpu_set_log_filename(qdict_get_str(qdict, "filename"));
> > diff --git a/qapi-schema.json b/qapi-schema.json
> > index 2ca7195..43d4acd 100644
> > --- a/qapi-schema.json
> > +++ b/qapi-schema.json
> > @@ -1755,3 +1755,27 @@
> >  # Since: 0.14.0
> >  ##
> >  { 'command': 'device_del', 'data': {'id': 'str'} }
> > +
> > +##
> > +# @screendump:
> > +#
> > +# Write a PPM of the VGA screen to a file.
> > +#
> > +# @filename: the path of a new PPM file to store the image
> > +#
> > +# Since: 0.14.0
> > +#
> > +# Returns: Nothing on success
> > +#   If the underlying device doesn't support screen dump, NotSupported
> > +#   If access to the file is not allowed, InvalidAccess
> > +#   If QEMU has too many open files, TooManyFilesByProcess
> > +#   If the system has too many open files, TooManyFilesInSystem
> > +#   If @filename is too long, NameTooLong
> > +#   If the system doesn't have enough space, NoSpace
> > +#   If the file-system to write the file to is read-only, ReadOnlyFileSystem
> > +#   If opening @filename fails for an uknown reason, OpenFileFailed
> > +#   If @filename becames too big, FileTooBig
> > +#   If an I/O happens while writing @filename, IOError
> 
> If an I/O _error_ happens ...

I'll fix it.

> Note: you expect this to be duplicated for other commands writing &
> creating files, i.e. commands that will have all of the above error
> conditions?

Yes. There could be small differences, for example, if O_EXCL is used. But
I expect most errors to be the same, yes.

> 
> > +#
> > +##
> > +{ 'command': 'screendump', 'data': {'filename': 'str'} }
> > diff --git a/qmp-commands.hx b/qmp-commands.hx
> > index db980fa..2a3e6d5 100644
> > --- a/qmp-commands.hx
> > +++ b/qmp-commands.hx
> > @@ -146,10 +146,7 @@ EQMP
> >      {
> >          .name       = "screendump",
> >          .args_type  = "filename:F",
> > -        .params     = "filename",
> > -        .help       = "save screen into PPM image 'filename'",
> > -        .user_print = monitor_user_noop,
> > -        .mhandler.cmd_new = do_screen_dump,
> > +        .mhandler.cmd_new = qmp_marshal_input_screendump,
> >      },
> >  
> >  SQMP
> > -- 
> > 1.7.10.2.565.gbd578b5
> > 
> > 
> 

  reply	other threads:[~2012-05-28 13:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25 19:41 [Qemu-devel] [PATCH qmp-next 00/14]: qapi: convert screendump Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 01/14] qerror: extend QERR_TOO_MANY_FILES Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 02/14] qerror: add new errors Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 03/14] cutils: introduce qemu_fopen_err() Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 04/14] cutils: introduce qemu_fprintf_err() Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 05/14] cutils: introduce qemu_fputc_err() Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 06/14] cutils: introduce qemu_fwrite_err() Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 07/14] omap_lcdc: rename ppm_save() to omap_ppm_save() Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 08/14] console: vga_hw_screen_dump_ptr: take an Error argument Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 09/14] vga: ppm_save(): add error handling Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 10/14] omap_lcdc: omap_ppm_save(): " Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 11/14] g364fb: g364fb_screen_dump(): " Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 12/14] tcx: tcx24_screen_dump(): " Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 13/14] tcx: tcx_screen_dump(): " Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 14/14] qapi: convert screendump Luiz Capitulino
2012-05-28  8:56   ` Alon Levy
2012-05-28 13:12     ` Luiz Capitulino [this message]
2012-05-28  8:57 ` [Qemu-devel] [PATCH qmp-next 00/14]: " Alon Levy

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=20120528101207.033791d1@doriath.home \
    --to=lcapitulino@redhat.com \
    --cc=alevy@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.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).