qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kwolf@redhat.com, kraxel@redhat.com, qemu-devel@nongnu.org,
	stefanha@redhat.com, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/6] qemu-char: do not call chr_write directly
Date: Wed, 11 Jun 2014 14:30:40 +0800	[thread overview]
Message-ID: <20140611063040.GE5448@T430.nay.redhat.com> (raw)
In-Reply-To: <1401813551-6667-3-git-send-email-pbonzini@redhat.com>

On Tue, 06/03 18:39, Paolo Bonzini wrote:
> Make the mux always go through qemu_chr_fe_write, so that we'll get
> the mutex for the underlying chardev.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Fam Zheng <famz@redhat.com>

> ---
>  qemu-char.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 3df5db7..2bda2fb 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -279,7 +279,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
>      MuxDriver *d = chr->opaque;
>      int ret;
>      if (!d->timestamps) {
> -        ret = d->drv->chr_write(d->drv, buf, len);
> +        ret = qemu_chr_fe_write(d->drv, buf, len);
>      } else {
>          int i;
>  
> @@ -301,10 +301,10 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
>                           (secs / 60) % 60,
>                           secs % 60,
>                           (int)(ti % 1000));
> -                d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1));
> +                qemu_chr_fe_write(d->drv, (uint8_t *)buf1, strlen(buf1));
>                  d->linestart = 0;
>              }
> -            ret += d->drv->chr_write(d->drv, buf+i, 1);
> +            ret += qemu_chr_fe_write(d->drv, buf+i, 1);
>              if (buf[i] == '\n') {
>                  d->linestart = 1;
>              }
> @@ -339,13 +339,13 @@ static void mux_print_help(CharDriverState *chr)
>                   "\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r",
>                   term_escape_char);
>      }
> -    chr->chr_write(chr, (uint8_t *)cbuf, strlen(cbuf));
> +    qemu_chr_fe_write(chr, (uint8_t *)cbuf, strlen(cbuf));
>      for (i = 0; mux_help[i] != NULL; i++) {
>          for (j=0; mux_help[i][j] != '\0'; j++) {
>              if (mux_help[i][j] == '%')
> -                chr->chr_write(chr, (uint8_t *)ebuf, strlen(ebuf));
> +                qemu_chr_fe_write(chr, (uint8_t *)ebuf, strlen(ebuf));
>              else
> -                chr->chr_write(chr, (uint8_t *)&mux_help[i][j], 1);
> +                qemu_chr_fe_write(chr, (uint8_t *)&mux_help[i][j], 1);
>          }
>      }
>  }
> @@ -370,7 +370,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
>          case 'x':
>              {
>                   const char *term =  "QEMU: Terminated\n\r";
> -                 chr->chr_write(chr,(uint8_t *)term,strlen(term));
> +                 qemu_chr_fe_write(chr, (uint8_t *)term, strlen(term));
>                   exit(0);
>                   break;
>              }
> -- 
> 1.8.3.1
> 
> 

  reply	other threads:[~2014-06-11  6:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 16:39 [Qemu-devel] [PATCH 0/5] qemu-char/monitor: make monitor_puts thread safe Paolo Bonzini
2014-06-03 16:39 ` [Qemu-devel] [PATCH 1/6] qemu-char: introduce qemu_chr_alloc Paolo Bonzini
2014-06-11  6:28   ` Fam Zheng
2014-06-03 16:39 ` [Qemu-devel] [PATCH 2/6] qemu-char: do not call chr_write directly Paolo Bonzini
2014-06-11  6:30   ` Fam Zheng [this message]
2014-06-03 16:39 ` [Qemu-devel] [PATCH 3/6] qemu-char: move pty_chr_update_read_handler around Paolo Bonzini
2014-06-11  6:32   ` Fam Zheng
2014-06-03 16:39 ` [Qemu-devel] [PATCH 4/6] qemu-char: make writes thread-safe Paolo Bonzini
2014-06-11  6:59   ` Fam Zheng
2014-06-11  8:16     ` Paolo Bonzini
2014-06-03 16:39 ` [Qemu-devel] [PATCH 5/6] monitor: protect outbuf with mutex Paolo Bonzini
2014-06-10 14:10   ` Luiz Capitulino
2014-06-10 14:24     ` Paolo Bonzini
2014-06-10 14:28       ` Luiz Capitulino
2014-06-03 16:39 ` [Qemu-devel] [PATCH 6/6] monitor: protect event emission Paolo Bonzini
2014-06-10 13:33   ` Luiz Capitulino
2014-06-27  9:43 ` [Qemu-devel] [PATCH 0/5] qemu-char/monitor: make monitor_puts thread safe Stefan Hajnoczi
2014-06-27 12:33   ` Luiz Capitulino

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=20140611063040.GE5448@T430.nay.redhat.com \
    --to=famz@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).