diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:46 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:46 +0000 |
commit | 02e4f47747e6198c834017e5038fa6bf98a0cfeb (patch) | |
tree | e186d387ef6632056c5e55a9750a6e9f3987c0c4 /tools/libxc/xenctrlosdep.h | |
parent | 94705cc4bfe4d9d749d86f49045f62ed9e48a0bc (diff) | |
download | xen-02e4f47747e6198c834017e5038fa6bf98a0cfeb.tar.gz xen-02e4f47747e6198c834017e5038fa6bf98a0cfeb.tar.bz2 xen-02e4f47747e6198c834017e5038fa6bf98a0cfeb.zip |
libxc: osdep: add framework for abstracting access to dom0 OS hypervisor interfaces.
This patch introduces the basic infrastructure and uses it for open
and close operations on privcmd, evtchn and gnttab devices.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xenctrlosdep.h')
-rw-r--r-- | tools/libxc/xenctrlosdep.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h new file mode 100644 index 0000000000..f807d0d2dc --- /dev/null +++ b/tools/libxc/xenctrlosdep.h @@ -0,0 +1,90 @@ +/****************************************************************************** + * + * Interface to OS specific low-level operations + * + * Copyright (c) 2010, Citrix Systems Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/* + * This interface defines the interactions between the Xen control + * libraries and the OS facilities used to communicate with the + * hypervisor. + */ + +#ifndef XC_OSDEP_H +#define XC_OSDEP_H + +/* Tell the Xen public headers we are a user-space tools build. */ +#ifndef __XEN_TOOLS__ +#define __XEN_TOOLS__ 1 +#endif + +#include <sys/mman.h> +#include <sys/types.h> + +#include <xen/sys/privcmd.h> + +enum xc_osdep_type { + XC_OSDEP_PRIVCMD, + XC_OSDEP_EVTCHN, + XC_OSDEP_GNTTAB, +}; + +/* Opaque handle internal to the backend */ +typedef unsigned long xc_osdep_handle; + +#define XC_OSDEP_OPEN_ERROR ((xc_osdep_handle)-1) + +struct xc_osdep_ops +{ + /* Opens an interface. + * + * Must return an opaque handle on success or + * XC_OSDEP_OPEN_ERROR on failure + */ + xc_osdep_handle (*open)(xc_interface *xch); + + int (*close)(xc_interface *xch, xc_osdep_handle h); +}; +typedef struct xc_osdep_ops xc_osdep_ops; + +typedef xc_osdep_ops *(*xc_osdep_init_fn)(xc_interface *xch, enum xc_osdep_type); + +struct xc_osdep_info +{ + /* Describes this backend. */ + const char *name; + + /* Returns ops function. */ + xc_osdep_init_fn init; +}; +typedef struct xc_osdep_info xc_osdep_info_t; + +/* All backends, including the builtin backend, must supply this structure. */ +extern xc_osdep_info_t xc_osdep_info; + +#endif + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ |