diff options
author | Keir Fraser <keir@xensource.com> | 2007-10-18 15:12:03 +0100 |
---|---|---|
committer | Keir Fraser <keir@xensource.com> | 2007-10-18 15:12:03 +0100 |
commit | cefbbff3f52785929be438c73d1cd4d57fe7829f (patch) | |
tree | 1d3a504354b22d1ca73457c49d324fff25df9fa7 /tools/libxc/xc_flask.c | |
parent | 5550335afcfe3584c668317f2445536b8e608ae6 (diff) | |
download | xen-cefbbff3f52785929be438c73d1cd4d57fe7829f.tar.gz xen-cefbbff3f52785929be438c73d1cd4d57fe7829f.tar.bz2 xen-cefbbff3f52785929be438c73d1cd4d57fe7829f.zip |
tools: Remove bogus external uses of xc_private.h. Clean up libflask.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'tools/libxc/xc_flask.c')
-rw-r--r-- | tools/libxc/xc_flask.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/libxc/xc_flask.c b/tools/libxc/xc_flask.c new file mode 100644 index 0000000000..bb2b61295f --- /dev/null +++ b/tools/libxc/xc_flask.c @@ -0,0 +1,46 @@ +/****************************************************************************** + * xc_flask.c + * + * 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, version 2 of the + * License. + */ + +#include "xc_private.h" + +int xc_flask_op(int xc_handle, flask_op_t *op) +{ + int ret = -1; + DECLARE_HYPERCALL; + + hypercall.op = __HYPERVISOR_xsm_op; + hypercall.arg[0] = (unsigned long)op; + + if ( mlock(op, sizeof(*op)) != 0 ) + { + PERROR("Could not lock memory for Xen hypercall"); + goto out; + } + + if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 ) + { + if ( errno == EACCES ) + fprintf(stderr, "XSM operation failed!\n"); + } + + safe_munlock(op, sizeof(*op)); + + out: + return ret; +} + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ |