From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfiEj-0000Eq-8V for qemu-devel@nongnu.org; Thu, 23 May 2013 23:00:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfiEX-0005yE-M6 for qemu-devel@nongnu.org; Thu, 23 May 2013 23:00:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfiEX-0005xS-Di for qemu-devel@nongnu.org; Thu, 23 May 2013 22:59:57 -0400 Date: Fri, 24 May 2013 10:59:50 +0800 From: Fam Zheng Message-ID: <20130524025950.GC1705@localhost.nay.redhat.com> References: <1369280289-20928-1-git-send-email-famz@redhat.com> <1369280289-20928-6-git-send-email-famz@redhat.com> <20130523135559.GP9093@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130523135559.GP9093@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 05/11] curl: add timer to BDRVCURLState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, 05/23 15:55, Stefan Hajnoczi wrote: > On Thu, May 23, 2013 at 11:38:03AM +0800, Fam Zheng wrote: > > diff --git a/block/curl.c b/block/curl.c > > index fc464ad..4fd5bb9 100644 > > --- a/block/curl.c > > +++ b/block/curl.c > > @@ -89,6 +89,7 @@ typedef struct BDRVCURLState { > > QLIST_HEAD(, CURLSockInfo) socks; > > char *url; > > size_t readahead_size; > > + QEMUTimer *timer; > > /* Whether http server accept range in header */ > > bool accept_range; > > } BDRVCURLState; > > @@ -148,6 +149,38 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque) > > return realsize; > > } > > > > +static void curl_timer_cb(void *opaque) > > +{ > > + int running; > > + BDRVCURLState *bs = (BDRVCURLState *)opaque; > > Please call it 's'. 'bs' is for BlockDriverState*. > > Also, there is no need to cast void* to BDRVCURLState*, the conversion > is implicit. > > > + DPRINTF("curl timeout!\n"); > > + curl_multi_socket_action(bs->multi, CURL_SOCKET_TIMEOUT, 0, &running); > > +} > > + > > +/* Call back for curl_multi interface */ > > +static int curl_multi_timer_cb(CURLM *multi, long timeout_ms, void *s) > > +{ > > + BDRVCURLState *bs = (BDRVCURLState *)s; > > Same here. > OK. -- Fam