From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:50535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3iZv-0004PO-1f for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:08:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3iZt-0002Fu-Fl for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:08:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3iZt-0002Ff-84 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:08:41 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7L78eWL005387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Aug 2012 03:08:40 -0400 Message-ID: <50333442.1080400@redhat.com> Date: Tue, 21 Aug 2012 10:09:54 +0300 From: Yonit Halperin MIME-Version: 1.0 References: <1345469176-1675-1-git-send-email-yhalperi@redhat.com> <1345469176-1675-3-git-send-email-yhalperi@redhat.com> <503331AD.1010101@redhat.com> In-Reply-To: <503331AD.1010101@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/5] spice: notify on vm state change only via spice_server_vm_start/stop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Hi, On 08/21/2012 09:58 AM, Gerd Hoffmann wrote: > Hi, > >> +#if SPICE_SERVER_VERSION>= 0x000b02 /* 0.11.2 */ >> +static void display_start(void) >> +{ >> + DisplayListItem *item; >> + >> + QLIST_FOREACH(item,&display_list, link) { >> + item->display->running = true; >> + } >> +} > > I think we should simply use a global variable for 'running' here. It's > global state anyway. Having this in per-display state struct buys us > nothing and adds alot of code for updating and display list maintainance. > ok, good point. >> void qemu_spice_vm_change_state_handler(void *opaque, int running, >> RunState state) >> { >> +#if SPICE_SERVER_VERSION< 0x000b02 /* before 0.11.2 */ >> SimpleSpiceDisplay *ssd = opaque; > >> +#if SPICE_SERVER_VERSION< 0x000b02 /* before 0.11.2 */ >> qemu_add_vm_change_state_handler(qemu_spice_vm_change_state_handler,&sdpy); >> +#endif > > If you don't register qemu_spice_vm_change_state_handler on new > spice-server you should #ifdef the whole function, not the body only. > qemu_spice_vm_change_state_handler is also called from qxl.c, as part of its own vm_change_state handler. I didn't want to add another ifdef there. > cheers, > Gerd