All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: xen-devel@lists.xensource.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 02/10] xen: backend driver core
Date: Wed, 08 Apr 2009 11:21:59 +0200	[thread overview]
Message-ID: <49DC6CB7.8000602@redhat.com> (raw)
In-Reply-To: <49DBAC54.7010500@us.ibm.com>

On 04/07/09 21:41, Anthony Liguori wrote:
>> +/* private */
>> +static TAILQ_HEAD(XenDeviceHead, XenDevice) xendevs =
>> TAILQ_HEAD_INITIALIZER(xendevs);
>> +static int debug = 0;
>
> Would be better to have all of this in a structure that had a single
> static instance. Would be even better if you could avoid requiring the
> static instance.

Huh?  Point being?  This is just a list head, i.e. a pointer (or two?).

>> +char *xenstore_read_str(const char *base, const char *node)
>> +{
>> + char abspath[XEN_BUFSIZE];
>> + unsigned int len;
>> +
>> + snprintf(abspath, sizeof(abspath), "%s/%s", base, node);
>> + return xs_read(xenstore, 0, abspath, &len);
>
> xs_read() is a xenstore API, it's returning malloc()'d memory.

>> +int xenstore_read_int(const char *base, const char *node, int *ival)
>> +{
>> + char *val;
>> + int rc = -1;
>> +
>> + val = xenstore_read_str(base, node);
>> + if (val && 1 == sscanf(val, "%d", ival))
>> + rc = 0;
>> + qemu_free(val);
>
> And here you're free()'ing with qemu_free.

Oops.  Good catch.

>> + xendev = qemu_mallocz(ops->size);
>> + if (!xendev)
>> + return NULL;
>
> No need to check malloc failures.

Will fix.

>> + dev = xs_directory(xenstore, 0, path, &cdev);
>> + qemu_free(dev);
>
> Mixing qemu_free() with malloc'd memory.

This too.

> You also have open coded calls to fprintf(stderr)
> whereas you've introduced a higher level function.

The high-level function wants a device instance and thus doesn't work 
everythere.  Nevertheless the code probably should use the new 
qemu_log() function instead.  I'll look into this.

cheers,
  Gerd

  reply	other threads:[~2009-04-08  9:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-07 14:44 [Qemu-devel] [PATCH 00/10] xen: pv domain support Gerd Hoffmann
2009-04-07 14:44 ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 01/10] xen: groundwork for xen support Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 02/10] xen: backend driver core Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 19:41   ` [Qemu-devel] " Anthony Liguori
2009-04-08  9:21     ` Gerd Hoffmann [this message]
2009-04-08  9:52       ` Gerd Hoffmann
2009-04-08 13:17       ` Anthony Liguori
2009-04-08 14:25         ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 03/10] xen: add console backend driver Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 04/10] xen: add framebuffer " Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 05/10] xen: add block device " Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 06/10] xen: add net " Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 07/10] xen: blk & nic configuration via cmd line Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 08/10] xen: pv domain builder Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 09/10] simplify vga selection Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 14:44 ` [Qemu-devel] [PATCH 10/10] xen: add -vga xenfb option, configure xenfb Gerd Hoffmann
2009-04-07 14:44   ` Gerd Hoffmann
2009-04-07 17:30 ` [Qemu-devel] [PATCH 00/10] xen: pv domain support Blue Swirl
2009-04-07 17:30   ` Blue Swirl
2009-04-08 14:08   ` [Qemu-devel] " Gerd Hoffmann
  -- strict thread matches above, loose matches on Subject: below --
2009-04-21 12:19 Gerd Hoffmann
2009-04-21 12:20 ` [Qemu-devel] [PATCH 02/10] xen: backend driver core Gerd Hoffmann
2009-04-01 21:39 [Qemu-devel] [PATCH 00/10] xen: pv domain support Gerd Hoffmann
2009-04-01 21:39 ` [Qemu-devel] [PATCH 02/10] xen: backend driver core Gerd Hoffmann
2009-04-02 16:49   ` Blue Swirl
2009-04-03 19:59     ` Gerd Hoffmann

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=49DC6CB7.8000602@redhat.com \
    --to=kraxel@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xen-devel@lists.xensource.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.