From patchwork Thu Aug 12 14:09:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 61602 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4517EB70D1 for ; Fri, 13 Aug 2010 00:19:55 +1000 (EST) Received: from localhost ([127.0.0.1]:34106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjYdL-0006uv-57 for incoming@patchwork.ozlabs.org; Thu, 12 Aug 2010 10:19:51 -0400 Received: from [140.186.70.92] (port=59955 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjYVw-0002hZ-Sx for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:12:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjYU4-0000z1-1p for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:10:17 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:51011) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjYU3-0000vb-TB for qemu-devel@nongnu.org; Thu, 12 Aug 2010 10:10:16 -0400 X-IronPort-AV: E=Sophos;i="4.55,358,1278302400"; d="scan'208";a="109436858" Received: from ftlpexchmx01.citrite.net ([10.9.154.126]) by FTLPIPO02.CITRIX.COM with ESMTP; 12 Aug 2010 10:10:15 -0400 Received: from smtp01.ad.xensource.com ([10.219.128.104]) by FTLPEXCHMX01.citrite.net with Microsoft SMTPSVC(6.0.3790.4675); Thu, 12 Aug 2010 10:10:15 -0400 Received: from localhost.localdomain (kaball.uk.xensource.com [10.80.2.59]) by smtp01.ad.xensource.com (8.13.1/8.13.1) with ESMTP id o7CEA013020767; Thu, 12 Aug 2010 07:10:13 -0700 From: stefano.stabellini@eu.citrix.com To: qemu-devel@nongnu.org Date: Thu, 12 Aug 2010 15:09:54 +0100 Message-Id: <1281622202-3453-7-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: X-OriginalArrivalTime: 12 Aug 2010 14:10:15.0911 (UTC) FILETIME=[16667F70:01CB3A28] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Anthony.Perard@citrix.com, Anthony PERARD , xen-devel@lists.xensource.com, Stefano Stabellini Subject: [Qemu-devel] [PATCH 07/15] xen: handle xenstore events X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD Add an handler to process xenstore events. Signed-off-by: Anthony PERARD Signed-off-by: Stefano Stabellini --- target-xen/xenstore.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/target-xen/xenstore.c b/target-xen/xenstore.c index c202f66..9f2e1ea 100644 --- a/target-xen/xenstore.c +++ b/target-xen/xenstore.c @@ -1,6 +1,18 @@ #include "hw/xen_backend.h" #include "xenstore.h" +static void xenstore_process_event(void *opaque) +{ + char **vec; + unsigned int num; + + vec = xs_read_watch(xenstore, &num); + if (!vec) + return; + + free(vec); +} + int xen_dm_init(void) { xenstore = xs_daemon_open(); @@ -9,6 +21,9 @@ int xen_dm_init(void) return -1; } + if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_process_event, NULL, NULL) < 0) + goto err; + xen_xc = xc_interface_open(NULL, NULL, 0); if (xen_xc == NULL) { xen_be_printf(NULL, 0, "can't open xen interface\n"); @@ -17,6 +32,7 @@ int xen_dm_init(void) return 0; err: + qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL); xs_daemon_close(xenstore); xenstore = NULL;