[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 0/2] Dynamic module loading for block drivers
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-block] [PATCH 0/2] Dynamic module loading for block drivers |
Date: |
Fri, 17 Jun 2016 10:54:51 +0100 |
User-agent: |
Mutt/1.6.1 (2016-04-27) |
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;
}
}
signature.asc
Description: PGP signature
- Re: [Qemu-block] [PATCH 1/2] blockdev: Add dynamic generation of module_block.h, (continued)
[Qemu-block] [PATCH 2/2] blockdev: Add dynamic module loading for block drivers, Colin Lord, 2016/06/15
Re: [Qemu-block] [PATCH 0/2] Dynamic module loading for block drivers,
Stefan Hajnoczi <=
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Colin Lord, 2016/06/20
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Stefan Hajnoczi, 2016/06/21
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Paolo Bonzini, 2016/06/21
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Colin Lord, 2016/06/21
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Paolo Bonzini, 2016/06/21
- Re: [Qemu-block] [Qemu-devel] [PATCH 0/2] Dynamic module loading for block drivers, Stefan Hajnoczi, 2016/06/22