From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH 1/2] curl: Store BDRVCURLState pointer in CURLSocket
Date: Tue, 9 Mar 2021 14:05:40 +0100 [thread overview]
Message-ID: <20210309130541.37540-2-mreitz@redhat.com> (raw)
In-Reply-To: <20210309130541.37540-1-mreitz@redhat.com>
A socket does not really belong to any specific state. We do not need
to store a pointer to "its" state in it, a pointer to the common
BDRVCURLState is sufficient.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
block/curl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/curl.c b/block/curl.c
index 4ff895df8f..43c79bcf36 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -78,7 +78,7 @@ typedef struct CURLAIOCB {
typedef struct CURLSocket {
int fd;
- struct CURLState *state;
+ struct BDRVCURLState *s;
QLIST_ENTRY(CURLSocket) next;
} CURLSocket;
@@ -155,7 +155,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
if (!socket) {
socket = g_new0(CURLSocket, 1);
socket->fd = fd;
- socket->state = state;
+ socket->s = s;
QLIST_INSERT_HEAD(&state->sockets, socket, next);
}
@@ -385,7 +385,7 @@ static void curl_multi_check_completion(BDRVCURLState *s)
/* Called with s->mutex held. */
static void curl_multi_do_locked(CURLSocket *socket)
{
- BDRVCURLState *s = socket->state->s;
+ BDRVCURLState *s = socket->s;
int running;
int r;
@@ -401,7 +401,7 @@ static void curl_multi_do_locked(CURLSocket *socket)
static void curl_multi_do(void *arg)
{
CURLSocket *socket = arg;
- BDRVCURLState *s = socket->state->s;
+ BDRVCURLState *s = socket->s;
qemu_mutex_lock(&s->mutex);
curl_multi_do_locked(socket);
--
2.29.2
next prev parent reply other threads:[~2021-03-09 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-09 13:05 [PATCH 0/2] block/curl: Disconnect sockets from CURLState Max Reitz
2021-03-09 13:05 ` Max Reitz [this message]
2021-03-09 13:13 ` [PATCH 1/2] curl: Store BDRVCURLState pointer in CURLSocket Philippe Mathieu-Daudé
2021-03-09 13:05 ` [PATCH 2/2] curl: Disconnect sockets from CURLState Max Reitz
2021-03-10 11:51 ` [PATCH 0/2] block/curl: " Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210309130541.37540-2-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).