From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAcou-0003l5-78 for qemu-devel@nongnu.org; Thu, 11 Oct 2018 11:24:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAcoq-0001nc-W8 for qemu-devel@nongnu.org; Thu, 11 Oct 2018 11:24:12 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46833) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAcoq-0001my-NT for qemu-devel@nongnu.org; Thu, 11 Oct 2018 11:24:08 -0400 Received: by mail-wr1-f67.google.com with SMTP id n11-v6so10068423wru.13 for ; Thu, 11 Oct 2018 08:24:08 -0700 (PDT) References: <20181011131413.22208-1-philmd@redhat.com> <7762db82-6044-df69-a1b7-c05100a0e938@redhat.com> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <4b664769-9830-e186-05c4-132a8cfc423b@redhat.com> Date: Thu, 11 Oct 2018 17:24:01 +0200 MIME-Version: 1.0 In-Reply-To: <7762db82-6044-df69-a1b7-c05100a0e938@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] chardev: Convert IOReadHandler to read an unsigned number of bytes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Prasad J Pandit Cc: Peter Maydell , Sagar Karandikar , "Michael S. Tsirkin" , Jan Kiszka , Jason Wang , Palmer Dabbelt , qemu-devel@nongnu.org, Markus Armbruster , Max Filippov , Michael Clark , Gerd Hoffmann , "Edgar E. Iglesias" , Stefano Stabellini , Alberto Garcia , Li Zhijian , Alexander Graf , Christian Borntraeger , Antony Pavlov , Anthony Perard , =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Laurent Vivier , Corey Minyard , Amit Shah , Alistair Francis , "Dr. David Alan Gilbert" , Fabien Chouteau , Zhang Chen , "open list:PXA2XX" , Peter Chubb , Samuel Thibault , "open list:X86" , David Gibson , Igor Mitsyanko , Cornelia Huck , "open list:S390 Virtio-ccw" , Thomas Huth , Michael Walle , "open list:sPAPR" , Bastian Koppelmann On 11/10/2018 17:14, Paolo Bonzini wrote: > On 11/10/2018 15:14, Philippe Mathieu-Daudé wrote: >> The number of bytes can not be negative nor zero. >> >> Fixed 2 format string: >> - hw/char/spapr_vty.c >> - hw/usb/ccid-card-passthru.c >> >> Signed-off-by: Philippe Mathieu-Daudé >> --- >> See: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg02212.html > > Not that easy; you need to adjust qemu_chr_be_can_write, > qemu_chr_be_write_impl, qemu_chr_be_write (which is where the callbacks > are invoked). OK. > On the other hand, fd_chr_read_poll is not an IOCanReadHandler, and this > patch therefore probably doesn't compile? It does compile. fd_chr_update_read_handler() uses fd_chr_read_poll with io_add_watch_poll(): GSource *io_add_watch_poll(Chardev *chr, QIOChannel *ioc, IOCanReadHandler *fd_can_read, QIOChannelFunc fd_read, gpointer user_data, GMainContext *context);