[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 11/24] block: Clean up some bad code in the vvfat dri
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 11/24] block: Clean up some bad code in the vvfat driver |
Date: |
Tue, 26 Sep 2017 16:21:20 +0200 |
From: Thomas Huth <address@hidden>
Remove the unnecessary home-grown redefinition of the assert() macro here,
and remove the unusable debug code at the end of the checkpoint() function.
The code there uses assert() with side-effects (assignment to the "mapping"
variable), which should be avoided. Looking more closely, it seems as it is
apparently also only usable for one certain directory layout (with a file
named USB.H in it) and thus is of no use for the rest of the world.
Signed-off-by: Thomas Huth <address@hidden>
Reviewed-by: John Snow <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vvfat.c | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index cbabb36f62..1d6e7087a8 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -57,15 +57,6 @@
static void checkpoint(void);
-#ifdef __MINGW32__
-void nonono(const char* file, int line, const char* msg) {
- fprintf(stderr, "Nonono! %s:%d %s\n", file, line, msg);
- exit(-5);
-}
-#undef assert
-#define assert(a) do {if (!(a)) nonono(__FILE__, __LINE__, #a);}while(0)
-#endif
-
#else
#define DLOG(a)
@@ -3270,24 +3261,11 @@ static void bdrv_vvfat_init(void)
block_init(bdrv_vvfat_init);
#ifdef DEBUG
-static void checkpoint(void) {
+static void checkpoint(void)
+{
assert(((mapping_t*)array_get(&(vvv->mapping), 0))->end == 2);
check1(vvv);
check2(vvv);
assert(!vvv->current_mapping || vvv->current_fd ||
(vvv->current_mapping->mode & MODE_DIRECTORY));
-#if 0
- if (((direntry_t*)vvv->directory.pointer)[1].attributes != 0xf)
- fprintf(stderr, "Nonono!\n");
- mapping_t* mapping;
- direntry_t* direntry;
- assert(vvv->mapping.size >= vvv->mapping.item_size * vvv->mapping.next);
- assert(vvv->directory.size >= vvv->directory.item_size *
vvv->directory.next);
- if (vvv->mapping.next<47)
- return;
- assert((mapping = array_get(&(vvv->mapping), 47)));
- assert(mapping->dir_index < vvv->directory.next);
- direntry = array_get(&(vvv->directory), mapping->dir_index);
- assert(!memcmp(direntry->name, "USB H ", 11) || direntry->name[0]==0);
-#endif
}
#endif
--
2.13.5
- [Qemu-block] [PULL 08/24] iotests: Print full path of bad output if mismatch, (continued)
- [Qemu-block] [PULL 08/24] iotests: Print full path of bad output if mismatch, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 04/24] docs: add qemu-block-drivers(7) man page, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 07/24] iotests: use virtio aliases for 067, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 09/24] throttle: Assert that bkt->max is valid in throttle_compute_wait(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 10/24] block/throttle-groups.c: allocate RestartData on the heap, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 13/24] block: Add reopen_queue to bdrv_child_perm(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 12/24] qemu-io: Drop write permissions before read-only reopen, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 17/24] block: Fix permissions after bdrv_reopen(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 11/24] block: Clean up some bad code in the vvfat driver,
Kevin Wolf <=
- [Qemu-block] [PULL 14/24] block: Add reopen queue to bdrv_check_perm(), Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 15/24] block: Base permissions on rw state after reopen, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 18/24] qemu-iotests: Test change-backing-file command, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 16/24] block: reopen: Queue children after their parents, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 19/24] iotests: fix 181: enable postcopy-ram capability on target, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 22/24] qcow2: add shrink image support, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 20/24] qemu-img: add --shrink flag for resize, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 23/24] qemu-iotests: add shrinking image test, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 24/24] block/qcow2-bitmap: fix use of uninitialized pointer, Kevin Wolf, 2017/09/26
- [Qemu-block] [PULL 21/24] qcow2: add qcow2_cache_discard, Kevin Wolf, 2017/09/26