mirror of https://gitee.com/openkylin/qemu.git
curl: Store BDRVCURLState pointer in CURLSocket
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> Message-Id: <20210309130541.37540-2-mreitz@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
1bf26076d6
commit
3663dca461
|
@ -78,7 +78,7 @@ typedef struct CURLAIOCB {
|
||||||
|
|
||||||
typedef struct CURLSocket {
|
typedef struct CURLSocket {
|
||||||
int fd;
|
int fd;
|
||||||
struct CURLState *state;
|
struct BDRVCURLState *s;
|
||||||
QLIST_ENTRY(CURLSocket) next;
|
QLIST_ENTRY(CURLSocket) next;
|
||||||
} CURLSocket;
|
} CURLSocket;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
|
||||||
if (!socket) {
|
if (!socket) {
|
||||||
socket = g_new0(CURLSocket, 1);
|
socket = g_new0(CURLSocket, 1);
|
||||||
socket->fd = fd;
|
socket->fd = fd;
|
||||||
socket->state = state;
|
socket->s = s;
|
||||||
QLIST_INSERT_HEAD(&state->sockets, socket, next);
|
QLIST_INSERT_HEAD(&state->sockets, socket, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ static void curl_multi_check_completion(BDRVCURLState *s)
|
||||||
/* Called with s->mutex held. */
|
/* Called with s->mutex held. */
|
||||||
static void curl_multi_do_locked(CURLSocket *socket)
|
static void curl_multi_do_locked(CURLSocket *socket)
|
||||||
{
|
{
|
||||||
BDRVCURLState *s = socket->state->s;
|
BDRVCURLState *s = socket->s;
|
||||||
int running;
|
int running;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ static void curl_multi_do_locked(CURLSocket *socket)
|
||||||
static void curl_multi_do(void *arg)
|
static void curl_multi_do(void *arg)
|
||||||
{
|
{
|
||||||
CURLSocket *socket = arg;
|
CURLSocket *socket = arg;
|
||||||
BDRVCURLState *s = socket->state->s;
|
BDRVCURLState *s = socket->s;
|
||||||
|
|
||||||
qemu_mutex_lock(&s->mutex);
|
qemu_mutex_lock(&s->mutex);
|
||||||
curl_multi_do_locked(socket);
|
curl_multi_do_locked(socket);
|
||||||
|
|
Loading…
Reference in New Issue