[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH XEN v5 09/23] tools: Refactor hypercall calling wrappers into libxencall.



On 09/11/15 12:00, Ian Campbell wrote:
> diff --git a/tools/libs/call/include/xencall.h 
> b/tools/libs/call/include/xencall.h
> new file mode 100644
> index 0000000..a0b3591
> --- /dev/null
> +++ b/tools/libs/call/include/xencall.h
> @@ -0,0 +1,84 @@
> +/*
> + * 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, see 
> <http://www.gnu.org/licenses/>.
> + */
> +#ifndef XENCALL_H
> +#define XENCALL_H
> +
> +/*
> + * This library allows you to make arbitrary hypercalls (subject to
> + * sufficient permission for the process and the domain itself). Note
> + * that while the library interface is stable the hypercalls are
> + * subject to their own rules.
> + */
> +
> +#include <stdint.h>
> +#include <stddef.h>
> +
> +/* Callers who don't care don't need to #include <xentoollog.h> */
> +typedef struct xentoollog_logger xentoollog_logger;
> +
> +typedef struct xencall_handle xencall_handle;
> +
> +/*
> + */
> +#define XENCALL_OPENFLAG_NON_REENTRANT (1U<<0)
> +
> +/*
> + * Return a handle onto the hypercall driver.  Logs errors.
> + */
> +xencall_handle *xencall_open(xentoollog_logger *logger, unsigned open_flags);
> +
> +/*
> + * Close a handle previously allocated with xencall_open().
> + */
> +int xencall_close(xencall_handle *xcall);
> +
> +/*
> + * Call hypercalls with varying numbers of arguments.
> + */
> +int xencall0(xencall_handle *xcall, unsigned int op);
> +int xencall1(xencall_handle *xcall, unsigned int op,
> +             uint64_t arg1);
> +int xencall2(xencall_handle *xcall, unsigned int op,
> +             uint64_t arg1, uint64_t arg2);
> +int xencall3(xencall_handle *xcall, unsigned int op,
> +             uint64_t arg1, uint64_t arg2, uint64_t arg3);
> +int xencall4(xencall_handle *xcall, unsigned int op,
> +             uint64_t arg1, uint64_t arg2, uint64_t arg3,
> +             uint64_t arg4);
> +int xencall5(xencall_handle *xcall, unsigned int op,
> +             uint64_t arg1, uint64_t arg2, uint64_t arg3,
> +             uint64_t arg4, uint64_t arg5);
> +
> +/*
> + * Allocate and free memory which is suitable for use as a pointer
> + * argument to a hypercall.
> + */
> +void *xencall_alloc_buffer_pages(xencall_handle *xcall, int nr_pages);
> +void xencall_free_buffer_pages(xencall_handle *xcall, void *p, int nr_pages);

size_t nr_pages.  (The osdep internals appear to use unsigned nr_pages,
just to be different).

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.