This RFC adds an Error ** parameter to bdrv_open, bdrv_file_open, bdrv_create and the respective functions provided by a block driver.
This results in more specific error information than just -errno provided to the user when opening or creating images (disregarding the fact that block drivers often already use error_report, which is generally changed to error_setg through this patch). The fifth patch in this series changes the qcow2 block driver to set an example of usage in a block driver. Note that several I/O tests break by applying this RFC since they expect different error messages (generally, previously, an error message on image opening/creation consisted of two lines; the first of which would be generated by the driver through error_report, the second by the block layer itself through strerror(-ret); this patch is designed to merge these two lines into a single one). This applies to the tests 49, 51, 54 and 60. v2: - included all block drivers - split open/create patches (old 1 into 1/2 and old 2 into 3/4) - added a patch (6) for printing out error messages from blk_open, blk_file_open and blk_create in all block drivers (except qcow2, for which there is a dedicated patch (5)) I intentionally made this an own commit since I think this to be real functionality, whereas the patches 3 and 4 are more for introducing Error into block.c and making sure everything compiles with these changes (without actually adding functionality to any other code). However, I'm well aware that this in some way breaks the code between patches 3/4 and 6, since some error messages may be discarded between these commits. Therefore I wouldn't object too much to merging patch 6 with 3/4. Max Reitz (6): bdrv: Use "Error" for opening images bdrv: Use "Error" for creating images block: Error parameter for open functions block: Error parameter for create functions qcow2: Use Error parameter bdrv: No silent error message discarding block.c | 164 ++++++++++++++++++++++++++++++---------------- block/blkdebug.c | 7 +- block/blkverify.c | 11 +++- block/bochs.c | 3 +- block/cloop.c | 3 +- block/cow.c | 15 +++-- block/curl.c | 3 +- block/dmg.c | 3 +- block/gluster.c | 4 +- block/iscsi.c | 6 +- block/mirror.c | 5 +- block/nbd.c | 3 +- block/parallels.c | 3 +- block/qcow.c | 15 +++-- block/qcow2.c | 143 ++++++++++++++++++++++++++-------------- block/qed.c | 18 +++-- block/raw-posix.c | 18 +++-- block/raw-win32.c | 9 ++- block/raw_bsd.c | 16 ++++- block/rbd.c | 6 +- block/sheepdog.c | 14 ++-- block/snapshot.c | 2 +- block/ssh.c | 6 +- block/vdi.c | 6 +- block/vhdx.c | 3 +- block/vmdk.c | 17 +++-- block/vpc.c | 6 +- block/vvfat.c | 13 +++- blockdev.c | 30 ++++----- include/block/block.h | 11 ++-- include/block/block_int.h | 9 ++- qemu-img.c | 39 +++++------ qemu-io.c | 14 ++-- qemu-nbd.c | 6 +- 34 files changed, 410 insertions(+), 221 deletions(-) -- 1.8.3.1