From patchwork Thu Apr 20 12:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 675618 Delivered-To: patch@linaro.org Received: by 2002:a5d:4a41:0:0:0:0:0 with SMTP id v1csp277854wrs; Thu, 20 Apr 2023 05:15:02 -0700 (PDT) X-Google-Smtp-Source: AKy350b32ir3p4Do+CdCDWb7UFI/IP6anxblKsBAVJZ8OQvG+IJCW0G0lB/osx5XbRvLtQd4au/m X-Received: by 2002:a05:622a:192:b0:3ee:1771:fc9f with SMTP id s18-20020a05622a019200b003ee1771fc9fmr1656226qtw.56.1681992902143; Thu, 20 Apr 2023 05:15:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681992902; cv=none; d=google.com; s=arc-20160816; b=w6NcSK6IDa0+lBx9Y7MnXPzvLsvwBaBjkOjKtWkNZD3mpzILBIiEFrQd1B0xKvLgW4 c2HjI0vONjbjH1xjxgkERERo/s3QJTxGZNSJ/zjh38Lh5iELhVZhpWnGl2/1FH/pwDAq qi+7lgwEf1BJ3ScaPw1k0PzS+QMFVybV1OlquBb+Gr5w1JKFt788PQkYYvzLTdTkVFUq 1Sp7xMusmYbVFLq/Y1n/b9y1LXuU1vV0AoKa5idTQdjhTTZvCijz2A92yirZidaAzsC/ 78iBs43vRaDCQQs3tNYdai3f19a+jn8ORaOoCPe+QVZDU5FHD315wv7nQ6kjnr2nsu5o 0lBQ== 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=Pkf3KMvisO8TYjoOGTRBzS5PYfICt1+mkW8bKvoMqscrdMUFZDx84TYs+1zjDapUVl v8crXR3D7RkEa29/hMdtpr0r7/AgewC0sOoLLhm4/IuWsCSsUYSBpoDfmfsfyQIaQxfC vzjp1Wfq2t2Z3erbApTc4mnfClgKUK7u2Gq5+KnrTyxfQlVEgSVS5JprOGqTbyRHlpSV qSptiCx5sZ6ME3U6sbCIvPlL8WwaQPCjchF1zVE9/OnQi1F9CYsxyF/2V96JCjA4kHNX 4VD/K4yuOVh2gyyfsil7cW2zrIQVrut7fMzJp8nQo/ZWr4PS2OD91ngTCOoZqBZ/7cHP l3Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GPMaIqXJ; 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 c8-20020a05620a268800b0074e034b6edesi998508qkp.71.2023.04.20.05.15.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Apr 2023 05:15:02 -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=GPMaIqXJ; 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 1ppT7n-0001pA-AV; Thu, 20 Apr 2023 08:10:56 -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 1ppT7K-0001eD-Lz for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:10:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ppT7F-0003fB-Jh for qemu-devel@nongnu.org; Thu, 20 Apr 2023 08:10:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681992621; 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=GPMaIqXJm5ZYCIo7nMs+pPZsyuUj8C66ISyLECFYzcGwBRdaO6PRep8cjP284v1eVlvtZw uSdZM3hjKHJSKAmnrNrosEpUrxzfQ2cIcHKnapFJ2OGPRLp1dIDCMJ5NJ0EQB0ZlMZvN7w KWDiptU6xH1WlflFSd5Lkna1YFEPr+Y= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-ugQ21I8BN42FIut2abyb8g-1; Thu, 20 Apr 2023 08:10:16 -0400 X-MC-Unique: ugQ21I8BN42FIut2abyb8g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6759D800B35; Thu, 20 Apr 2023 12:10:16 +0000 (UTC) Received: from localhost (unknown [10.39.193.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 909FB1410F1C; Thu, 20 Apr 2023 12:10:15 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: Raphael Norwitz , Kevin Wolf , Markus Armbruster , Julia Suvorova , Eric Blake , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Thomas Huth , qemu-block@nongnu.org, Cornelia Huck , "Dr. David Alan Gilbert" , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , Peter Maydell , Stefano Garzarella , kvm@vger.kernel.org, virtio-fs@redhat.com, Stefan Hajnoczi , Hanna Reitz , Fam Zheng , Aarushi Mehta Subject: [PULL 09/20] block/dmg: Declare a type definition for DMG uncompress function Date: Thu, 20 Apr 2023 08:09:37 -0400 Message-Id: <20230420120948.436661-10-stefanha@redhat.com> In-Reply-To: <20230420120948.436661-1-stefanha@redhat.com> References: <20230420120948.436661-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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=ham 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