On Mon, Nov 1, 2010 at 3:01 PM, Alexander Graf <ag...@suse.de> wrote: > Xenner emulates parts of libxc, so we can not use the real xen infrastructure > when running xen pv guests without xen. > > This patch adds support for emulation of xenstored. > > Signed-off-by: Alexander Graf <ag...@suse.de> > --- > hw/xenner_guest_store.c | 494 +++++++++++++++++++++++++++++++++ > hw/xenner_libxenstore.c | 709 > +++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 1203 insertions(+), 0 deletions(-) > create mode 100644 hw/xenner_guest_store.c > create mode 100644 hw/xenner_libxenstore.c > > diff --git a/hw/xenner_guest_store.c b/hw/xenner_guest_store.c > new file mode 100644 > index 0000000..c067275 > --- /dev/null > +++ b/hw/xenner_guest_store.c > @@ -0,0 +1,494 @@ > +/* > + * Copyright (C) 2005 Rusty Russell IBM Corporation > + * Copyright (C) Red Hat 2007 > + * Copyright (C) Novell Inc. 2010 > + * > + * Author(s): Gerd Hoffmann <kra...@redhat.com> > + * Alexander Graf <ag...@suse.de> > + * > + * Xenner emulation -- guest interface to xenstore > + * > + * tools/xenstore/xenstored_domain.c equivalent, some code is from there. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; under version 2 of the License. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License along > + * with this program; if not, see <http://www.gnu.org/licenses/>. > + */ > + > +#include "xen.h" > +#include "xen_interfaces.h" > +#include "xenner.h" > +#include "qemu-char.h" > + > +/* ------------------------------------------------------------- */ > + > +static target_phys_addr_t xen_store_mfn; > + > +static struct xs_handle *xs_guest; > +static char xs_buf[1024]; > +static char xs_len; > +static int debug = 0; > + > +static int evtchndev; > +static evtchn_port_t evtchnport;
A lot of static state. Couldn't this be wrapped inside a structure, which is then passed around?