All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Prasad J Pandit" <pjp@fedoraproject.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Corey Minyard" <minyard@acm.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Li Zhijian" <lizhijian@cn.fujitsu.com>,
	"Amit Shah" <amit@kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org, "Paul Durrant" <paul.durrant@citrix.com>,
	qemu-ppc@nongnu.org, "Gerd Hoffmann" <kraxel@redhat.com>,
	"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
	"Zhang Chen" <zhangckid@gmail.com>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Stefan Berger" <stefanb@linux.ibm.com>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v3 25/25] chardev: Let qemu_chr_write[_all] use size_t
Date: Wed, 20 Feb 2019 11:42:02 +0100	[thread overview]
Message-ID: <CAMxuvayMF+3Y-cMkvBW8KqfuBy_AQCg771wyV660nnsmeG-q2g@mail.gmail.com> (raw)
In-Reply-To: <20190220103836.GC21870@redhat.com>

Hi

On Wed, Feb 20, 2019 at 11:39 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Wed, Feb 20, 2019 at 02:02:32AM +0100, Philippe Mathieu-Daudé wrote:
>
> > diff --git a/include/chardev/char.h b/include/chardev/char.h
> > index 0341dd1ba2..2e3b5a15ca 100644
> > --- a/include/chardev/char.h
> > +++ b/include/chardev/char.h
> > @@ -221,7 +221,7 @@ void qemu_chr_set_feature(Chardev *chr,
> >                            ChardevFeature feature);
> >  QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename,
> >                                  bool permit_mux_mon);
> > -int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all);
> > +int qemu_chr_write(Chardev *s, const uint8_t *buf, size_t len, bool write_all);
>
> Seeing this cleanup reminds me that I think we ought to change
> the chardev read & write functions to take "void *buf" instead.
> as is done for regular libc  read/write functions. This would
> avoid casts in the callers between char */uint8_t *
>
> Something to think about for a future cleanup job....same applies
> for the QIOChannel APIs which take a 'char *buf', annoyingly
> different from the chardev APIs :-( Both ought to have void *buf

I fully agree, and I started that conversion some time ago, and lost
it somewhere. That should be easier than changing the sign of return
values though!

>
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

WARNING: multiple messages have this Message-ID (diff)
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Li Zhijian" <lizhijian@cn.fujitsu.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org,
	"Halil Pasic" <pasic@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Corey Minyard" <minyard@acm.org>, "Amit Shah" <amit@kernel.org>,
	qemu-s390x@nongnu.org, "Paul Durrant" <paul.durrant@citrix.com>,
	"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
	"Zhang Chen" <zhangckid@gmail.com>,
	"David Gibson" <david@gibson.dropbear.id.au>,
	"Prasad J Pandit" <pjp@fedoraproject.org>,
	"Cornelia Huck" <cohuck@redhat.com>,
	qemu-ppc@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 25/25] chardev: Let qemu_chr_write[_all] use size_t
Date: Wed, 20 Feb 2019 11:42:02 +0100	[thread overview]
Message-ID: <CAMxuvayMF+3Y-cMkvBW8KqfuBy_AQCg771wyV660nnsmeG-q2g@mail.gmail.com> (raw)
In-Reply-To: <20190220103836.GC21870@redhat.com>

Hi

On Wed, Feb 20, 2019 at 11:39 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
>
> On Wed, Feb 20, 2019 at 02:02:32AM +0100, Philippe Mathieu-Daudé wrote:
>
> > diff --git a/include/chardev/char.h b/include/chardev/char.h
> > index 0341dd1ba2..2e3b5a15ca 100644
> > --- a/include/chardev/char.h
> > +++ b/include/chardev/char.h
> > @@ -221,7 +221,7 @@ void qemu_chr_set_feature(Chardev *chr,
> >                            ChardevFeature feature);
> >  QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename,
> >                                  bool permit_mux_mon);
> > -int qemu_chr_write(Chardev *s, const uint8_t *buf, int len, bool write_all);
> > +int qemu_chr_write(Chardev *s, const uint8_t *buf, size_t len, bool write_all);
>
> Seeing this cleanup reminds me that I think we ought to change
> the chardev read & write functions to take "void *buf" instead.
> as is done for regular libc  read/write functions. This would
> avoid casts in the callers between char */uint8_t *
>
> Something to think about for a future cleanup job....same applies
> for the QIOChannel APIs which take a 'char *buf', annoyingly
> different from the chardev APIs :-( Both ought to have void *buf

I fully agree, and I started that conversion some time ago, and lost
it somewhere. That should be easier than changing the sign of return
values though!

>
>
> Regards,
> Daniel
> --
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-02-20 10:42 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-20  1:02 [Qemu-devel] [PATCH v3 00/25] chardev: Convert qemu_chr_write() to take a size_t argument Philippe Mathieu-Daudé
2019-02-20  1:02 ` Philippe Mathieu-Daudé
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 01/25] chardev: Simplify IOWatchPoll::fd_can_read as a GSourceFunc Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  9:45   ` [Qemu-devel] " Marc-André Lureau
2019-02-20  9:45     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 02/25] chardev: Assert IOCanReadHandler can not be negative Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:03   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:13     ` Philippe Mathieu-Daudé
2019-02-20 11:13       ` Philippe Mathieu-Daudé
2019-02-22  0:39       ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-02-22  0:39       ` Philippe Mathieu-Daudé
2019-02-20 10:03   ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 03/25] chardev/wctablet: Use unsigned type to hold unsigned value Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  7:32   ` [Qemu-devel] " Gerd Hoffmann
2019-02-20  7:32   ` Gerd Hoffmann
2019-02-20 10:17   ` Marc-André Lureau
2019-02-20 10:17   ` [Qemu-devel] " Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 04/25] chardev: Let qemu_chr_be_can_write() return a size_t types Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:40   ` Marc-André Lureau
2019-02-20 10:40   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:26     ` Philippe Mathieu-Daudé
2019-02-20 11:26       ` Philippe Mathieu-Daudé
2019-02-20 13:28       ` [Qemu-devel] " Marc-André Lureau
2019-02-20 13:28         ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 05/25] gdbstub: Use size_t for strlen() return value Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:57   ` Marc-André Lureau
2019-02-20 10:57   ` [Qemu-devel] " Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 06/25] gdbstub: Use size_t to hold GDBState::last_packet_len Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:59   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 10:59     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 07/25] gdbstub: Let put_buffer() use size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:02   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:02     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 08/25] ui/gtk: Remove pointless cast Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  7:32   ` [Qemu-devel] " Gerd Hoffmann
2019-02-20  7:32     ` Gerd Hoffmann
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 09/25] vhost-user: Express sizeof with size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:06   ` Marc-André Lureau
2019-02-20 11:06   ` [Qemu-devel] " Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 10/25] usb-redir: Verify usbredirparser_write get called with positive count Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  7:32   ` [Qemu-devel] " Gerd Hoffmann
2019-02-20  7:32     ` Gerd Hoffmann
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 11/25] xen: Let xencons_send() take a 'size' argument Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:07   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:07     ` Marc-André Lureau
2019-02-21  9:34   ` [Qemu-devel] " Paul Durrant
2019-02-21  9:34     ` Paul Durrant
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 12/25] xen: Let buffer_append() return the size consumed Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:13   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:13     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [RFC PATCH v3 13/25] xen: Let buffer_append() return a size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-21  9:54   ` [Qemu-devel] " Paul Durrant
2019-02-21  9:54     ` Paul Durrant
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 14/25] virtio-serial: Let VirtIOSerialPortClass::have_data() use size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:21   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:21     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 15/25] spapr-vty: Let vty_putchars() " Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  1:39   ` [Qemu-devel] " David Gibson
2019-02-20  1:39     ` David Gibson
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 16/25] tpm: Use size_t to hold sizes Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:22   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:22     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 17/25] net/filter-mirror: Use size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 11:23   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 11:23     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 18/25] s390x/3270: Let insert_IAC_escape_char() use size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  9:37   ` [Qemu-devel] " Cornelia Huck
2019-02-20  9:37   ` Cornelia Huck
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 19/25] s390/ebcdic: Use size_t to iterate over arrays Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20  9:40   ` [Qemu-devel] " Cornelia Huck
2019-02-20  9:40     ` Cornelia Huck
2019-02-20 11:37     ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-02-20 11:37     ` Philippe Mathieu-Daudé
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 20/25] s390x/sclp: Use a const variable to improve readability Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:53   ` [Qemu-devel] " Cornelia Huck
2019-02-20 10:53     ` Cornelia Huck
2019-03-08 19:12     ` [Qemu-devel] " Philippe Mathieu-Daudé
2019-03-08 19:12       ` Philippe Mathieu-Daudé
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 21/25] s390x/sclp: Use size_t in process_mdb() Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:53   ` [Qemu-devel] " Cornelia Huck
2019-02-20 10:53     ` Cornelia Huck
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 22/25] s390x/sclp: Let write_console_data() take a size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:54   ` [Qemu-devel] " Cornelia Huck
2019-02-20 10:54     ` Cornelia Huck
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 23/25] hw/ipmi: Assert outlen > outpos Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 13:36   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 13:36     ` Marc-André Lureau
2019-02-20 13:36   ` [Qemu-devel] " Corey Minyard
2019-02-20 13:36     ` Corey Minyard
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 24/25] chardev: Let qemu_chr_fe_write[_all] use size_t type argument Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 13:44   ` [Qemu-devel] " Marc-André Lureau
2019-02-20 13:44     ` Marc-André Lureau
2019-02-20  1:02 ` [Qemu-devel] [PATCH v3 25/25] chardev: Let qemu_chr_write[_all] use size_t Philippe Mathieu-Daudé
2019-02-20  1:02   ` Philippe Mathieu-Daudé
2019-02-20 10:38   ` [Qemu-devel] " Daniel P. Berrangé
2019-02-20 10:42     ` Marc-André Lureau [this message]
2019-02-20 10:42       ` Marc-André Lureau
2019-02-20 11:31       ` Philippe Mathieu-Daudé
2019-02-20 11:31         ` Philippe Mathieu-Daudé
2019-02-20 10:38   ` Daniel P. Berrangé
2019-02-20 10:53 ` [Qemu-devel] [PATCH v3 00/25] chardev: Convert qemu_chr_write() to take a size_t argument Marc-André Lureau
2019-02-20 10:53   ` Marc-André Lureau
2019-02-20 10:57   ` [Qemu-devel] " Cornelia Huck
2019-02-20 10:57     ` Cornelia Huck
2019-02-20 11:30   ` [Qemu-devel] " Daniel P. Berrangé
2019-02-20 11:30     ` Daniel P. Berrangé
2019-02-20 14:20     ` Eric Blake
2019-02-20 14:20       ` Eric Blake

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=CAMxuvayMF+3Y-cMkvBW8KqfuBy_AQCg771wyV660nnsmeG-q2g@mail.gmail.com \
    --to=marcandre.lureau@redhat.com \
    --cc=amit@kernel.org \
    --cc=anthony.perard@citrix.com \
    --cc=berrange@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=minyard@acm.org \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=paul.durrant@citrix.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=pjp@fedoraproject.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=sstabellini@kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=zhangckid@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.