From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ii7-00060t-IB for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:17:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T3ii3-0004OO-H5 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:17:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T3ii3-0004OJ-91 for qemu-devel@nongnu.org; Tue, 21 Aug 2012 03:17:07 -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 q7L7H6mI014313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 21 Aug 2012 03:17:06 -0400 Message-ID: <503335F0.3010907@redhat.com> Date: Tue, 21 Aug 2012 09:17:04 +0200 From: Gerd Hoffmann 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> <50333442.1080400@redhat.com> In-Reply-To: <50333442.1080400@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 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: Yonit Halperin Cc: qemu-devel@nongnu.org On 08/21/12 09:09, Yonit Halperin wrote: > 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. Fair point, but then you can drop the #ifdef for the qemu_add_vm_change_state_handler call too. cheers, Gerd