qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Colin Lord <clord@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org,
	mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 0/2] Dynamic module loading for block drivers
Date: Fri, 17 Jun 2016 10:54:51 +0100	[thread overview]
Message-ID: <20160617095451.GC6994@stefanha-x1.localdomain> (raw)
In-Reply-To: <1466016055-31351-1-git-send-email-clord@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

On Wed, Jun 15, 2016 at 02:40:53PM -0400, Colin Lord wrote:
> 1) Denis Lunev suggested having block_module_load_one return the
> loaded driver to reduce duplicated for loops in many of the functions
> in block.c. I'd be happy to do this but wasn't completely sure how
> error handling would happen in that case since currently the return
> value is an integer error code. Would I switch to using the
> error handling mechanisms provided in util/error.c?

Yes, change "int foo(...)" to "MyObject *foo(..., Error **errp)".  The
Error object allows functions to provide detailed, human-readable error
messages so it can be a win.

If this change would cause a lot of changes you can stop the refactoring
from snowballing using error_setg_errno() to bridge new Error functions
with old int -errno functions:

  MyObject *foo(..., Error **errp)
  {
      /* I don't want propagate Error to all called functions yet, it
       * would snowball.  So just wrap up the errno:
       */
      ret = legacy_function(...);
      if (ret < 0) {
          error_setg_errno(errp, -ret, "legacy_function failed");
	  return NULL;
      }
  }

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2016-06-17  9:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 18:40 [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers Colin Lord
2016-06-15 18:40 ` [Qemu-devel] [PATCH 1/2] blockdev: Add dynamic generation of module_block.h Colin Lord
2016-06-15 22:48   ` Paolo Bonzini
2016-06-16  4:59   ` Fam Zheng
2016-06-16 13:57     ` Colin Lord
2016-06-17  9:57       ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2016-06-15 18:40 ` [Qemu-devel] [PATCH 2/2] blockdev: Add dynamic module loading for block drivers Colin Lord
2016-06-15 22:50   ` Paolo Bonzini
2016-06-16 14:00     ` Colin Lord
2016-06-16 14:05       ` Paolo Bonzini
2016-06-16 14:10         ` Colin Lord
2016-06-16 14:12           ` Paolo Bonzini
2016-06-17  9:54 ` Stefan Hajnoczi [this message]
2016-06-20 15:32   ` [Qemu-devel] [Qemu-block] [PATCH 0/2] Dynamic " Colin Lord
2016-06-21  9:32     ` Stefan Hajnoczi
2016-06-21 10:01       ` [Qemu-devel] " Paolo Bonzini
2016-06-21 15:42       ` [Qemu-devel] [Qemu-block] " Colin Lord
2016-06-21 16:59         ` [Qemu-devel] " Paolo Bonzini
2016-06-22 10:09           ` Stefan Hajnoczi

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=20160617095451.GC6994@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=clord@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).