From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfW01-0004Fz-6M for qemu-devel@nongnu.org; Thu, 23 May 2013 09:56:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfVzu-0007Cu-Nh for qemu-devel@nongnu.org; Thu, 23 May 2013 09:56:09 -0400 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:58352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfVzu-0007CR-E0 for qemu-devel@nongnu.org; Thu, 23 May 2013 09:56:02 -0400 Received: by mail-wg0-f49.google.com with SMTP id y10so2047634wgg.4 for ; Thu, 23 May 2013 06:56:01 -0700 (PDT) Date: Thu, 23 May 2013 15:55:59 +0200 From: Stefan Hajnoczi Message-ID: <20130523135559.GP9093@stefanha-thinkpad.redhat.com> References: <1369280289-20928-1-git-send-email-famz@redhat.com> <1369280289-20928-6-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1369280289-20928-6-git-send-email-famz@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: Fam Zheng Cc: kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com 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.