Blame SOURCES/kvm-curl-Keep-pointer-to-the-CURLState-in-CURLSocket.patch

Pablo Greco e6a3ae
From 21dbedae8100710d284b79f7ce21a6b095a4c6e0 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Date: Tue, 19 Nov 2019 15:29:54 +0000
Pablo Greco e6a3ae
Subject: [PATCH 2/8] curl: Keep pointer to the CURLState in CURLSocket
Pablo Greco e6a3ae
MIME-Version: 1.0
Pablo Greco e6a3ae
Content-Type: text/plain; charset=UTF-8
Pablo Greco e6a3ae
Content-Transfer-Encoding: 8bit
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Message-id: <20191119153000.101646-2-mreitz@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 92515
Pablo Greco e6a3ae
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH 1/7] curl: Keep pointer to the CURLState in CURLSocket
Pablo Greco e6a3ae
Bugzilla: 1744602
Pablo Greco e6a3ae
RH-Acked-by: Maxim Levitsky <mlevitsk@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
A follow-up patch will make curl_multi_do() and curl_multi_read() take a
Pablo Greco e6a3ae
CURLSocket instead of the CURLState.  They still need the latter,
Pablo Greco e6a3ae
though, so add a pointer to it to the former.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Cc: qemu-stable@nongnu.org
Pablo Greco e6a3ae
Signed-off-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: John Snow <jsnow@redhat.com>
Pablo Greco e6a3ae
Message-id: 20190910124136.10565-2-mreitz@redhat.com
Pablo Greco e6a3ae
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit 0487861685294660b23bc146e1ebd5304aa8bbe0)
Pablo Greco e6a3ae
Signed-off-by: Max Reitz <mreitz@redhat.com>
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 block/curl.c | 3 +++
Pablo Greco e6a3ae
 1 file changed, 3 insertions(+)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/block/curl.c b/block/curl.c
Pablo Greco e6a3ae
index f0df33a..fa602d1 100644
Pablo Greco e6a3ae
--- a/block/curl.c
Pablo Greco e6a3ae
+++ b/block/curl.c
Pablo Greco e6a3ae
@@ -89,6 +89,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
Pablo Greco e6a3ae
 #define CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET "proxy-password-secret"
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 struct BDRVCURLState;
Pablo Greco e6a3ae
+struct CURLState;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 static bool libcurl_initialized;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -106,6 +107,7 @@ typedef struct CURLAIOCB {
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 typedef struct CURLSocket {
Pablo Greco e6a3ae
     int fd;
Pablo Greco e6a3ae
+    struct CURLState *state;
Pablo Greco e6a3ae
     QLIST_ENTRY(CURLSocket) next;
Pablo Greco e6a3ae
 } CURLSocket;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
@@ -189,6 +191,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
Pablo Greco e6a3ae
     if (!socket) {
Pablo Greco e6a3ae
         socket = g_new0(CURLSocket, 1);
Pablo Greco e6a3ae
         socket->fd = fd;
Pablo Greco e6a3ae
+        socket->state = state;
Pablo Greco e6a3ae
         QLIST_INSERT_HEAD(&state->sockets, socket, next);
Pablo Greco e6a3ae
     }
Pablo Greco e6a3ae
     socket = NULL;
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae