From nobody Sun May 5 04:17:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579172868; cv=none; d=zohomail.com; s=zohoarc; b=G/Vi5ht/uEWHpQUtQ2hoGXBlrhxckLNqZstk/mg8hD6NGwxptLDmxMqQAkWoA/vzagJKGLbEYpapjfXBMNxDsCaMWsbsnMrORdOOqaaNzY4qxLn0Piwnk8XRLQ0XKx+z0SUtDvmd2DHJBP6i3IeAIrkzyi/CQOs5MnquAj8C8Qo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579172868; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=R6n2jObZlM+a+BNNQ61cNznB4+Ock+JPQF7NLy0uG34=; b=huq3qDWpO4qCE8/tRsOyC2SZWu7Sct1XBTufvoYJU0OU+bRUHUTgQX0FBlyHqbQK2Ias1GL9HWEXX7ryAd+s9/2++18xT8DXekVLH4YWtUv/wRzg7ga0dJtXSIDgTfdDfPEeZNxvVIhZ7nWm2v6JNmI1/Pe04OaHMv9gS9eXSpk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1579172868676217.8219574250811; Thu, 16 Jan 2020 03:07:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-MjulxPHdM5CIsJT7soy56Q-1; Thu, 16 Jan 2020 06:07:43 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5004F8D6795; Thu, 16 Jan 2020 11:07:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFBB468435; Thu, 16 Jan 2020 11:07:37 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 98F1318089C8; Thu, 16 Jan 2020 11:07:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00GB7ZaW008113 for ; Thu, 16 Jan 2020 06:07:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 00B8D1001901; Thu, 16 Jan 2020 11:07:35 +0000 (UTC) Received: from domokun.gsslab.fab.redhat.com (unknown [10.33.8.110]) by smtp.corp.redhat.com (Postfix) with ESMTP id 618691000329; Thu, 16 Jan 2020 11:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579172865; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=R6n2jObZlM+a+BNNQ61cNznB4+Ock+JPQF7NLy0uG34=; b=em48d+smnXLOZuaS8W9nLzyhmYEIILn+GIFwKRZByEmCNifjT9hEUgNHdNTYfoSBrCJls6 RDernw1dKXj4j4LlF3Q0mLAP/N8OriEnpgkAdmxdUueQkJuTEtutMVhyCibptN6rSr5+D3 KT4NvqDbg9dRo9rvFexf1VbDv5sxj3Q= From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 16 Jan 2020 11:07:28 +0000 Message-Id: <20200116110728.479284-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] esx: remove compatibility for old libcurl X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: MjulxPHdM5CIsJT7soy56Q-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) RHEL7 has libcurl 7.29.0, which is the oldest of any supported build platform. Thus we no longer need the back compat for libcurl < 7.28.0. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Pavel Hrdina --- src/esx/esx_vi.c | 151 ----------------------------------------------- src/esx/esx_vi.h | 9 --- 2 files changed, 160 deletions(-) diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 4e67d76bfe..421905c693 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -22,7 +22,6 @@ =20 #include =20 -#include #include #include =20 @@ -641,67 +640,6 @@ esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, esxV= I_CURL *curl) * MultiCURL */ =20 -#if ESX_EMULATE_CURL_MULTI_WAIT - -static int -esxVI_MultiCURL_SocketCallback(CURL *handle G_GNUC_UNUSED, - curl_socket_t fd, int action, - void *callback_opaque, - void *socket_opaque G_GNUC_UNUSED) -{ - esxVI_MultiCURL *multi =3D callback_opaque; - size_t i; - struct pollfd *pollfd =3D NULL; - struct pollfd dummy; - - if (action & CURL_POLL_REMOVE) { - for (i =3D 0; i < multi->npollfds; ++i) { - if (multi->pollfds[i].fd =3D=3D fd) { - VIR_DELETE_ELEMENT(multi->pollfds, i, multi->npollfds); - break; - } - } - } else { - for (i =3D 0; i < multi->npollfds; ++i) { - if (multi->pollfds[i].fd =3D=3D fd) { - pollfd =3D &multi->pollfds[i]; - break; - } - } - - if (pollfd =3D=3D NULL) { - if (VIR_APPEND_ELEMENT(multi->pollfds, multi->npollfds, dummy)= < 0) - return 0; /* curl_multi_socket() doc says "The callback MU= ST return 0." */ - - pollfd =3D &multi->pollfds[multi->npollfds - 1]; - } - - pollfd->fd =3D fd; - pollfd->events =3D 0; - - if (action & CURL_POLL_IN) - pollfd->events |=3D POLLIN; - - if (action & CURL_POLL_OUT) - pollfd->events |=3D POLLOUT; - } - - return 0; -} - -static int -esxVI_MultiCURL_TimerCallback(CURLM *handle G_GNUC_UNUSED, - long timeout_ms G_GNUC_UNUSED, - void *callback_opaque) -{ - esxVI_MultiCURL *multi =3D callback_opaque; - - multi->timeoutPending =3D true; - - return 0; -} - -#endif =20 /* esxVI_MultiCURL_Alloc */ ESX_VI__TEMPLATE__ALLOC(MultiCURL) @@ -717,10 +655,6 @@ ESX_VI__TEMPLATE__FREE(MultiCURL, =20 if (item->handle) curl_multi_cleanup(item->handle); - -#if ESX_EMULATE_CURL_MULTI_WAIT - VIR_FREE(item->pollfds); -#endif }) =20 int @@ -747,14 +681,6 @@ esxVI_MultiCURL_Add(esxVI_MultiCURL *multi, esxVI_CURL= *curl) return -1; } =20 -#if ESX_EMULATE_CURL_MULTI_WAIT - curl_multi_setopt(multi->handle, CURLMOPT_SOCKETFUNCTION, - esxVI_MultiCURL_SocketCallback); - curl_multi_setopt(multi->handle, CURLMOPT_SOCKETDATA, multi); - curl_multi_setopt(multi->handle, CURLMOPT_TIMERFUNCTION, - esxVI_MultiCURL_TimerCallback); - curl_multi_setopt(multi->handle, CURLMOPT_TIMERDATA, multi); -#endif } =20 virMutexLock(&curl->lock); @@ -803,81 +729,6 @@ esxVI_MultiCURL_Remove(esxVI_MultiCURL *multi, esxVI_C= URL *curl) return 0; } =20 -#if ESX_EMULATE_CURL_MULTI_WAIT - -int -esxVI_MultiCURL_Wait(esxVI_MultiCURL *multi, int *runningHandles) -{ - long timeout =3D -1; - CURLMcode errorCode; - int rc; - size_t i; - int action; - - if (multi->timeoutPending) { - do { - errorCode =3D curl_multi_socket_action(multi->handle, CURL_SOC= KET_TIMEOUT, - 0, runningHandles); - } while (errorCode =3D=3D CURLM_CALL_MULTI_SOCKET); - - if (errorCode !=3D CURLM_OK) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not trigger socket action: %s (%d)"), - curl_multi_strerror(errorCode), errorCode); - return -1; - } - - multi->timeoutPending =3D false; - } - - if (multi->npollfds =3D=3D 0) - return 0; - - curl_multi_timeout(multi->handle, &timeout); - - if (timeout < 0) - timeout =3D 1000; /* default to 1 sec timeout */ - - do { - rc =3D poll(multi->pollfds, multi->npollfds, timeout); - } while (rc < 0 && (errno =3D=3D EAGAIN || errno =3D=3D EINTR)); - - if (rc < 0) { - virReportSystemError(errno, "%s", _("Could not wait for transfer")= ); - return -1; - } - - for (i =3D 0; i < multi->npollfds && rc > 0; ++i) { - if (multi->pollfds[i].revents =3D=3D 0) - continue; - - --rc; - action =3D 0; - - if (multi->pollfds[i].revents & POLLIN) - action |=3D CURL_POLL_IN; - - if (multi->pollfds[i].revents & POLLOUT) - action |=3D CURL_POLL_OUT; - - do { - errorCode =3D curl_multi_socket_action(multi->handle, - multi->pollfds[i].fd, act= ion, - runningHandles); - } while (errorCode =3D=3D CURLM_CALL_MULTI_SOCKET); - - if (errorCode !=3D CURLM_OK) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Could not trigger socket action: %s (%d)"), - curl_multi_strerror(errorCode), errorCode); - return -1; - } - } - - return 0; -} - -#else =20 int esxVI_MultiCURL_Wait(esxVI_MultiCURL *multi, int *runningHandles) @@ -902,8 +753,6 @@ esxVI_MultiCURL_Wait(esxVI_MultiCURL *multi, int *runni= ngHandles) return esxVI_MultiCURL_Perform(multi, runningHandles); } =20 -#endif - int esxVI_MultiCURL_Perform(esxVI_MultiCURL *multi, int *runningHandles) { diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h index bff2782ba1..5c60fd58f4 100644 --- a/src/esx/esx_vi.h +++ b/src/esx/esx_vi.h @@ -32,10 +32,6 @@ #include "esx_vi_types.h" #include "esx_util.h" =20 -/* curl_multi_wait was added in libcurl 7.28.0, emulate it on older versio= ns */ -#define ESX_EMULATE_CURL_MULTI_WAIT (LIBCURL_VERSION_NUM < 0x071C00) - - =20 #define ESX_VI__SOAP__REQUEST_HEADER \ "\n" \ @@ -159,11 +155,6 @@ int esxVI_SharedCURL_Remove(esxVI_SharedCURL *shared, = esxVI_CURL *curl); struct _esxVI_MultiCURL { CURLM *handle; size_t count; /* number of added easy handle */ -#if ESX_EMULATE_CURL_MULTI_WAIT - struct pollfd *pollfds; - size_t npollfds; - bool timeoutPending; -#endif }; =20 int esxVI_MultiCURL_Alloc(esxVI_MultiCURL **multi); --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list