From nobody Fri Nov 7 12:59:47 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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1538783930339224.46012483837046; Fri, 5 Oct 2018 16:58:50 -0700 (PDT) Received: from localhost ([::1]:37418 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Zzd-0001eF-3a for importer@patchew.org; Fri, 05 Oct 2018 19:58:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8Zj0-0003iz-CC for qemu-devel@nongnu.org; Fri, 05 Oct 2018 19:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8Ziw-0000bz-LQ for qemu-devel@nongnu.org; Fri, 05 Oct 2018 19:41:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45742) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g8Ziu-0000YS-Ez; Fri, 05 Oct 2018 19:41:32 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0EB030001E5; Fri, 5 Oct 2018 23:41:31 +0000 (UTC) Received: from localhost (ovpn-204-46.brq.redhat.com [10.40.204.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 50685308BDA1; Fri, 5 Oct 2018 23:41:31 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Sat, 6 Oct 2018 01:40:19 +0200 Message-Id: <20181005234023.8104-28-mreitz@redhat.com> In-Reply-To: <20181005234023.8104-1-mreitz@redhat.com> References: <20181005234023.8104-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 05 Oct 2018 23:41:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v11 27/31] block/curl: Harmonize option defaults 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: Kevin Wolf , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Both of the defaults we currently have in the curl driver are named based on a slightly different schema, let's unify that and call both CURL_BLOCK_OPT_${NAME}_DEFAULT. While at it, we can add a macro for the third option for which a default exists, namely "sslverify". Signed-off-by: Max Reitz Reviewed-by: Alberto Garcia --- block/curl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/block/curl.c b/block/curl.c index dbbb72b5d7..96790fdc70 100644 --- a/block/curl.c +++ b/block/curl.c @@ -73,8 +73,6 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_= handle, =20 #define CURL_NUM_STATES 8 #define CURL_NUM_ACB 8 -#define READ_AHEAD_DEFAULT (256 * 1024) -#define CURL_TIMEOUT_DEFAULT 5 #define CURL_TIMEOUT_MAX 10000 =20 #define CURL_BLOCK_OPT_URL "url" @@ -88,6 +86,10 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi= _handle, #define CURL_BLOCK_OPT_PROXY_USERNAME "proxy-username" #define CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET "proxy-password-secret" =20 +#define CURL_BLOCK_OPT_READAHEAD_DEFAULT (256 * 1024) +#define CURL_BLOCK_OPT_SSLVERIFY_DEFAULT true +#define CURL_BLOCK_OPT_TIMEOUT_DEFAULT 5 + struct BDRVCURLState; =20 static bool libcurl_initialized; @@ -708,7 +710,7 @@ static int curl_open(BlockDriverState *bs, QDict *optio= ns, int flags, } =20 s->readahead_size =3D qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD, - READ_AHEAD_DEFAULT); + CURL_BLOCK_OPT_READAHEAD_DEFAULT= ); if ((s->readahead_size & 0x1ff) !=3D 0) { error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512= ", s->readahead_size); @@ -716,13 +718,14 @@ static int curl_open(BlockDriverState *bs, QDict *opt= ions, int flags, } =20 s->timeout =3D qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, - CURL_TIMEOUT_DEFAULT); + CURL_BLOCK_OPT_TIMEOUT_DEFAULT); if (s->timeout > CURL_TIMEOUT_MAX) { error_setg(errp, "timeout parameter is too large or negative"); goto out_noclean; } =20 - s->sslverify =3D qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, tru= e); + s->sslverify =3D qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, + CURL_BLOCK_OPT_SSLVERIFY_DEFAULT); =20 cookie =3D qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); cookie_secret =3D qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET); --=20 2.17.1