qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2.1 32/36] qemu-char: do not call chr_write dire


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 2.1 32/36] qemu-char: do not call chr_write directly
Date: Thu, 19 Jun 2014 08:47:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 06/18/2014 12:43 AM, Paolo Bonzini wrote:
> Make the mux always go through qemu_chr_fe_write, so that we'll get
> the mutex for the underlying chardev.
> 
> Reviewed-by: Fam Zheng <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  qemu-char.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Eric Blake <address@hidden>

> @@ -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);

Worth fixing the spacing around + while at it?

> @@ -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;

The break is dead code; you could clean it up while in the area.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]