From patchwork Mon Apr 24 17:55:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 676583 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp2292924wrs; Mon, 24 Apr 2023 10:55:56 -0700 (PDT) X-Google-Smtp-Source: AKy350a9NM0xoc4L2o/AkE3HFW/v+Lpt66qHX32kL8mij+zhd4YGDeKlYmyJF8lJOGMG1K24HEeF X-Received: by 2002:ac8:7f83:0:b0:3f0:a16a:64a0 with SMTP id z3-20020ac87f83000000b003f0a16a64a0mr5475281qtj.54.1682358955925; Mon, 24 Apr 2023 10:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682358955; cv=none; d=google.com; s=arc-20160816; b=HISezAYQ/oizQtaIaxEl7y+1XVQgmiQ6+4+BuMX1/G1Kvo93m7DfGLWsjQ0dmwF475 GaQe1mGFxeC7t0eZC5M8PGXzOFNeVkng5CiJ9hSj24WzglYlbpgKDIhftxffspXJndL7 ZpUZ2LM3J0zZ6DeFIb27swrR7tU7xW6ztOkp7GIL27aVMdPMRmlTBPWoojdekuXN8wNz rBwp+JNwT2qFaWSPNExAVhg3r7Km6Bb/0AzhR9P2yod5snKx8IMpHu8fdy1dwXdZx8aX 5takQ5NwCY9+betoMS1D431nP0QfXvecg6/487Vi3EPU6dln5wwcw+o+HDJoPn7OmP3P Ydlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DyRg2nO17XfSte2Qiq60HFpJmMSh6St95+0xBJuJYUw=; b=pabpPYriE23OnV+0J1fsju7CGpTgwZ996FP+6SFUgUPgi0Ow6lgKpd2pofEFqAzKoo QIXhwwLiQUwx+dXmTuU/WDA1qnv/tjxMIGxTugKP6MPUwYxR78VwhNt0P59HgQ/Ynad4 HtcUJ1HaQJDDGQXoT9TJDcOjiKgnJZj755OaK6zjYNPLUhqkjHsMMnZJqUI+w0sirzMo w3JX8JGtVwSfYA6fU1P5wA6OnatkxqcKUSVQeao5ra8mAQktEpR1W3m40hZoyV8CZk++ m3IvQfZ31WMy/mreaUOjvXHPOk0Q2Id6brkM/aEd492LAQA4NedU7ott+rVdhp8MKwQ5 xkCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xrnfssi5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m21-20020a05620a291500b0074df1b975fcsi902347qkp.287.2023.04.24.10.55.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Apr 2023 10:55:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xrnfssi5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pr0PY-00080y-D0; Mon, 24 Apr 2023 13:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pr0PW-000809-EV for qemu-devel@nongnu.org; Mon, 24 Apr 2023 13:55:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pr0PT-0007ty-VV for qemu-devel@nongnu.org; Mon, 24 Apr 2023 13:55:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682358931; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DyRg2nO17XfSte2Qiq60HFpJmMSh6St95+0xBJuJYUw=; b=Xrnfssi5U2Q1KsH97gYW9oMOp4CMxR67rROYvgnU9qRFc3GY0lfMwe90DDWgxJ9jC9M7yh Xh6zD4w5ebqJ211d78UfnGK9744ZaL6H95JLs3CUkq+yXRKAH6HHLOE8fg+lSWXIdC30kz mkzpoApyDfXG4a5I3gk7lF4AHGwgqvc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-452-oAnBs-z6NrSCL3WqXhLh2g-1; Mon, 24 Apr 2023 13:55:23 -0400 X-MC-Unique: oAnBs-z6NrSCL3WqXhLh2g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F4C23C02B70; Mon, 24 Apr 2023 17:55:23 +0000 (UTC) Received: from localhost (unknown [10.39.195.6]) by smtp.corp.redhat.com (Postfix) with ESMTP id A65C22027043; Mon, 24 Apr 2023 17:55:22 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Kevin Wolf , qemu-block@nongnu.org, Hanna Reitz , Stefan Hajnoczi , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 1/2] block/dmg: Declare a type definition for DMG uncompress function Date: Mon, 24 Apr 2023 13:55:17 -0400 Message-Id: <20230424175518.325931-2-stefanha@redhat.com> In-Reply-To: <20230424175518.325931-1-stefanha@redhat.com> References: <20230424175518.325931-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Received-SPF: pass client-ip=170.10.133.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.171, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Introduce the BdrvDmgUncompressFunc type defintion. To emphasis dmg_uncompress_bz2 and dmg_uncompress_lzfse are pointer to functions, declare them using this new typedef. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20230320152610.32052-1-philmd@linaro.org Signed-off-by: Stefan Hajnoczi --- block/dmg.h | 8 ++++---- block/dmg.c | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/dmg.h b/block/dmg.h index e488601b62..dcd6165e63 100644 --- a/block/dmg.h +++ b/block/dmg.h @@ -51,10 +51,10 @@ typedef struct BDRVDMGState { z_stream zstream; } BDRVDMGState; -extern int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, - char *next_out, unsigned int avail_out); +typedef int BdrvDmgUncompressFunc(char *next_in, unsigned int avail_in, + char *next_out, unsigned int avail_out); -extern int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, - char *next_out, unsigned int avail_out); +extern BdrvDmgUncompressFunc *dmg_uncompress_bz2; +extern BdrvDmgUncompressFunc *dmg_uncompress_lzfse; #endif diff --git a/block/dmg.c b/block/dmg.c index e10b9a2ba5..2769900359 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -31,11 +31,8 @@ #include "qemu/memalign.h" #include "dmg.h" -int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, - char *next_out, unsigned int avail_out); - -int (*dmg_uncompress_lzfse)(char *next_in, unsigned int avail_in, - char *next_out, unsigned int avail_out); +BdrvDmgUncompressFunc *dmg_uncompress_bz2; +BdrvDmgUncompressFunc *dmg_uncompress_lzfse; enum { /* Limit chunk sizes to prevent unreasonable amounts of memory being used