From nobody Wed Dec 17 05:32:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500388277580585.7158648104029; Tue, 18 Jul 2017 07:31:17 -0700 (PDT) Received: from localhost ([::1]:56860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTWu-00046k-8U for importer@patchew.org; Tue, 18 Jul 2017 10:31:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXTKg-0000mi-Uo for qemu-devel@nongnu.org; Tue, 18 Jul 2017 10:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXTKf-0007mv-V7 for qemu-devel@nongnu.org; Tue, 18 Jul 2017 10:18:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46486) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXTKc-0007jw-Qm; Tue, 18 Jul 2017 10:18:34 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1F4FC058EBD; Tue, 18 Jul 2017 14:18:33 +0000 (UTC) Received: from noname.str.redhat.com (dhcp-192-175.str.redhat.com [10.33.192.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD4EA7EF5F; Tue, 18 Jul 2017 14:18:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D1F4FC058EBD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kwolf@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D1F4FC058EBD From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 18 Jul 2017 16:18:00 +0200 Message-Id: <1500387486-5469-16-git-send-email-kwolf@redhat.com> In-Reply-To: <1500387486-5469-1-git-send-email-kwolf@redhat.com> References: <1500387486-5469-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 18 Jul 2017 14:18:34 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/21] vvfat: add constants for special values of name[0] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Herv=C3=A9 Poussineau Signed-off-by: Herv=C3=A9 Poussineau Signed-off-by: Kevin Wolf --- 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)= { =20 #endif =20 +#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) =20 static char is_free(const direntry_t* direntry) { - return direntry->name[0]=3D=3D0xe5 || direntry->name[0]=3D=3D0x00; + return direntry->name[0] =3D=3D DIR_DELETED || direntry->name[0] =3D= =3D DIR_FREE; } =20 static char is_volume_label(const direntry_t* direntry) @@ -487,7 +492,7 @@ static char is_short_name(const direntry_t* direntry) =20 static char is_directory(const direntry_t* direntry) { - return direntry->attributes & 0x10 && direntry->name[0] !=3D 0xe5; + return direntry->attributes & 0x10 && direntry->name[0] !=3D DIR_DELET= ED; } =20 static inline char is_dot(const direntry_t* direntry) @@ -589,8 +594,8 @@ static direntry_t *create_short_filename(BDRVVVFATState= *s, } } =20 - if (entry->name[0] =3D=3D 0xe5) { - entry->name[0] =3D 0x05; + if (entry->name[0] =3D=3D DIR_KANJI) { + entry->name[0] =3D DIR_KANJI_FAKE; } =20 /* numeric-tail generation */ @@ -1748,8 +1753,8 @@ static int parse_short_name(BDRVVVFATState* s, } else lfn->name[i + j + 1] =3D '\0'; =20 - if (lfn->name[0] =3D=3D 0x05) { - lfn->name[0] =3D 0xe5; + if (lfn->name[0] =3D=3D DIR_KANJI_FAKE) { + lfn->name[0] =3D DIR_KANJI; } lfn->len =3D strlen((char*)lfn->name); =20 --=20 1.8.3.1