[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 25/33] block/vvfat: Propagate errors through init_
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL v2 25/33] block/vvfat: Propagate errors through init_directories() |
Date: |
Wed, 28 May 2014 14:32:35 +0200 |
From: Markus Armbruster <address@hidden>
Completes the conversion of the open method to Error started in commit
015a103.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/vvfat.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 9b9b8f1..8f5114b 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -831,7 +831,8 @@ static inline off_t cluster2sector(BDRVVVFATState* s,
uint32_t cluster_num)
}
static int init_directories(BDRVVVFATState* s,
- const char *dirname, int heads, int secs)
+ const char *dirname, int heads, int secs,
+ Error **errp)
{
bootsector_t* bootsector;
mapping_t* mapping;
@@ -892,8 +893,8 @@ static int init_directories(BDRVVVFATState* s,
if (mapping->mode & MODE_DIRECTORY) {
mapping->begin = cluster;
if(read_directory(s, i)) {
- fprintf(stderr, "Could not read directory %s\n",
- mapping->path);
+ error_setg(errp, "Could not read directory %s",
+ mapping->path);
return -1;
}
mapping = array_get(&(s->mapping), i);
@@ -919,9 +920,10 @@ static int init_directories(BDRVVVFATState* s,
cluster = mapping->end;
if(cluster > s->cluster_count) {
- fprintf(stderr,"Directory does not fit in FAT%d (capacity %.2f
MB)\n",
- s->fat_type, s->sector_count / 2000.0);
- return -EINVAL;
+ error_setg(errp,
+ "Directory does not fit in FAT%d (capacity %.2f MB)",
+ s->fat_type, s->sector_count / 2000.0);
+ return -1;
}
/* fix fat for entry */
@@ -1169,7 +1171,7 @@ DLOG(if (stderr == NULL) {
bs->total_sectors = cyls * heads * secs;
- if (init_directories(s, dirname, heads, secs)) {
+ if (init_directories(s, dirname, heads, secs, errp)) {
ret = -EIO;
goto fail;
}
--
1.9.3
- [Qemu-devel] [PULL v2 14/33] docs: Define refcount_bits value, (continued)
- [Qemu-devel] [PULL v2 14/33] docs: Define refcount_bits value, Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 15/33] blockdev: Don't use qerror_report_err() in drive_init(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 16/33] blockdev: Don't use qerror_report() in do_drive_del(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 17/33] qemu-nbd: Don't use qerror_report(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 19/33] block/ssh: Drop superfluous libssh2_session_last_errno() calls, Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 20/33] block/ssh: Propagate errors through check_host_key(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 21/33] block/ssh: Propagate errors through authenticate(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 22/33] block/ssh: Propagate errors through connect_to_ssh(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 23/33] block/ssh: Propagate errors to open and create methods, Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 24/33] block/vvfat: Propagate errors through enable_write_target(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 25/33] block/vvfat: Propagate errors through init_directories(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL v2 18/33] block/rbd: Propagate errors to open and create methods, Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 26/33] block/sheepdog: Propagate errors through connect_to_sdog(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 27/33] block/sheepdog: Propagate errors through get_sheep_fd(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 30/33] block/sheepdog: Propagate errors through find_vdi_name(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 33/33] block/sheepdog: Don't use qerror_report(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 29/33] block/sheepdog: Propagate errors through do_sd_create(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 28/33] block/sheepdog: Propagate errors through sd_prealloc(), Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 32/33] block/sheepdog: Fix silent sd_open(), sd_create() failures, Stefan Hajnoczi, 2014/05/28
- [Qemu-devel] [PULL v2 31/33] block/sheepdog: Propagate errors to open and create methods, Stefan Hajnoczi, 2014/05/28
- Re: [Qemu-devel] [PULL v2 00/33] Block patches, Peter Maydell, 2014/05/28