[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 15/21] vvfat: add constants for special values of nam
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 15/21] vvfat: add constants for special values of name[0] |
Date: |
Tue, 18 Jul 2017 16:18:00 +0200 |
From: Hervé Poussineau <address@hidden>
Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vvfat.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index 4dae790..eb266b5 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -71,6 +71,11 @@ void nonono(const char* file, int line, const char* msg) {
#endif
+#define DIR_DELETED 0xe5
+#define DIR_KANJI DIR_DELETED
+#define DIR_KANJI_FAKE 0x05
+#define DIR_FREE 0x00
+
/* dynamic array functions */
typedef struct array_t {
char* pointer;
@@ -466,7 +471,7 @@ static direntry_t *create_long_filename(BDRVVVFATState *s,
const char *filename)
static char is_free(const direntry_t* direntry)
{
- return direntry->name[0]==0xe5 || direntry->name[0]==0x00;
+ return direntry->name[0] == DIR_DELETED || direntry->name[0] == DIR_FREE;
}
static char is_volume_label(const direntry_t* direntry)
@@ -487,7 +492,7 @@ static char is_short_name(const direntry_t* direntry)
static char is_directory(const direntry_t* direntry)
{
- return direntry->attributes & 0x10 && direntry->name[0] != 0xe5;
+ return direntry->attributes & 0x10 && direntry->name[0] != DIR_DELETED;
}
static inline char is_dot(const direntry_t* direntry)
@@ -589,8 +594,8 @@ static direntry_t *create_short_filename(BDRVVVFATState *s,
}
}
- if (entry->name[0] == 0xe5) {
- entry->name[0] = 0x05;
+ if (entry->name[0] == DIR_KANJI) {
+ entry->name[0] = DIR_KANJI_FAKE;
}
/* numeric-tail generation */
@@ -1748,8 +1753,8 @@ static int parse_short_name(BDRVVVFATState* s,
} else
lfn->name[i + j + 1] = '\0';
- if (lfn->name[0] == 0x05) {
- lfn->name[0] = 0xe5;
+ if (lfn->name[0] == DIR_KANJI_FAKE) {
+ lfn->name[0] = DIR_KANJI;
}
lfn->len = strlen((char*)lfn->name);
--
1.8.3.1
- [Qemu-block] [PULL 08/21] block: Make blk_all_next() public, (continued)
- [Qemu-block] [PULL 08/21] block: Make blk_all_next() public, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 09/21] block/qapi: Use blk_all_next() for query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 07/21] block/qapi: Add qdev device name to query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 10/21] block: List anonymous device BBs in query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 11/21] ide: bdrv_attach_dev() for empty CD-ROM, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 12/21] scsi-disk: bdrv_attach_dev() for empty CD-ROM, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 14/21] qemu-iotests: Test unplug of -device without drive, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 16/21] vvfat: add a constant for bootsector name, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 13/21] qemu-iotests: Test 'info block', Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 17/21] vvfat: correctly parse non-ASCII short and long file names, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 15/21] vvfat: add constants for special values of name[0],
Kevin Wolf <=
- [Qemu-block] [PULL 19/21] block/vvfat: Fix compiler warning with gcc 7, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 20/21] blockdev: move BDRV_O_NO_BACKING option forward, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 18/21] vvfat: initialize memory after allocating it, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 21/21] qemu-img: Check for backing image if specified during create, Kevin Wolf, 2017/07/18
- Re: [Qemu-block] [Qemu-devel] [PULL 00/21] Block layer patches, no-reply, 2017/07/18
- Re: [Qemu-block] [Qemu-devel] [PULL 00/21] Block layer patches, no-reply, 2017/07/18
- Re: [Qemu-block] [PULL 00/21] Block layer patches, Peter Maydell, 2017/07/19