From nobody Tue Apr 15 03:54:48 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 1506436355178393.6281809775752; Tue, 26 Sep 2017 07:32:35 -0700 (PDT) Received: from localhost ([::1]:47834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwquV-0001zO-9x for importer@patchew.org; Tue, 26 Sep 2017 10:32:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwqki-0001ju-PR for qemu-devel@nongnu.org; Tue, 26 Sep 2017 10:22:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwqkc-0005Yj-Ow for qemu-devel@nongnu.org; Tue, 26 Sep 2017 10:22:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwqkM-0005LH-5k; Tue, 26 Sep 2017 10:22:02 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AD5168B3; Tue, 26 Sep 2017 14:22:01 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-39.ams2.redhat.com [10.36.117.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 817385C66F; Tue, 26 Sep 2017 14:21:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4AD5168B3 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kwolf@redhat.com From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 26 Sep 2017 16:21:20 +0200 Message-Id: <20170926142133.2498-12-kwolf@redhat.com> In-Reply-To: <20170926142133.2498-1-kwolf@redhat.com> References: <20170926142133.2498-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 26 Sep 2017 14:22:01 +0000 (UTC) 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 11/24] block: Clean up some bad code in the vvfat driver 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth 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 Reviewed-by: John Snow Reviewed-by: Eric Blake Signed-off-by: Kevin Wolf --- 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 @@ =20 static void checkpoint(void); =20 -#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 =20 #define DLOG(a) @@ -3270,24 +3261,11 @@ static void bdrv_vvfat_init(void) block_init(bdrv_vvfat_init); =20 #ifdef DEBUG -static void checkpoint(void) { +static void checkpoint(void) +{ assert(((mapping_t*)array_get(&(vvv->mapping), 0))->end =3D=3D 2); check1(vvv); check2(vvv); assert(!vvv->current_mapping || vvv->current_fd || (vvv->current_mappi= ng->mode & MODE_DIRECTORY)); -#if 0 - if (((direntry_t*)vvv->directory.pointer)[1].attributes !=3D 0xf) - fprintf(stderr, "Nonono!\n"); - mapping_t* mapping; - direntry_t* direntry; - assert(vvv->mapping.size >=3D vvv->mapping.item_size * vvv->mapping.ne= xt); - assert(vvv->directory.size >=3D vvv->directory.item_size * vvv->direct= ory.next); - if (vvv->mapping.next<47) - return; - assert((mapping =3D array_get(&(vvv->mapping), 47))); - assert(mapping->dir_index < vvv->directory.next); - direntry =3D array_get(&(vvv->directory), mapping->dir_index); - assert(!memcmp(direntry->name, "USB H ", 11) || direntry->name[0]= =3D=3D0); -#endif } #endif --=20 2.13.5