diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-28 09:30:19 +0100 |
commit | 5cc436c1d2b3b0be3f42104582f53eec3969b43a (patch) | |
tree | 1e30ade146ee7287c486d1309b5d3d2c69a2d9b9 /tools/flask | |
parent | 7f9a888af4b65cb8c22cea3c8295d30d0fedd623 (diff) | |
download | xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.gz xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.tar.bz2 xen-5cc436c1d2b3b0be3f42104582f53eec3969b43a.zip |
libxc: eliminate static variables, use xentoollog; API change
This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).
Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.
There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.
All libxc callers have been adjusted accordingly.
Also update QEMU_TAG for corresponding qemu change.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/flask')
-rw-r--r-- | tools/flask/libflask/flask_op.c | 39 | ||||
-rw-r--r-- | tools/flask/libflask/include/libflask.h | 39 | ||||
-rw-r--r-- | tools/flask/utils/getenforce.c | 6 | ||||
-rw-r--r-- | tools/flask/utils/loadpolicy.c | 6 | ||||
-rw-r--r-- | tools/flask/utils/setenforce.c | 6 |
5 files changed, 48 insertions, 48 deletions
diff --git a/tools/flask/libflask/flask_op.c b/tools/flask/libflask/flask_op.c index 29c3cd1149..d4b8ef01f5 100644 --- a/tools/flask/libflask/flask_op.c +++ b/tools/flask/libflask/flask_op.c @@ -20,9 +20,8 @@ #include <stdint.h> #include <sys/ioctl.h> #include <libflask.h> -#include <xenctrl.h> -int flask_load(int xc_handle, char *buf, uint32_t size) +int flask_load(xc_interface *xc_handle, char *buf, uint32_t size) { int err; flask_op_t op; @@ -37,7 +36,7 @@ int flask_load(int xc_handle, char *buf, uint32_t size) return 0; } -int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid) +int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid) { int err; flask_op_t op; @@ -54,7 +53,7 @@ int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid) return 0; } -int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size) +int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size) { int err; flask_op_t op; @@ -71,7 +70,7 @@ int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size) return 0; } -int flask_getenforce(int xc_handle) +int flask_getenforce(xc_interface *xc_handle) { int err; flask_op_t op; @@ -91,7 +90,7 @@ int flask_getenforce(int xc_handle) return mode; } -int flask_setenforce(int xc_handle, int mode) +int flask_setenforce(xc_interface *xc_handle, int mode) { int err; flask_op_t op; @@ -110,7 +109,7 @@ int flask_setenforce(int xc_handle, int mode) return 0; } -int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext) +int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext) { int err; flask_op_t op; @@ -139,7 +138,7 @@ int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext) } -int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high, +int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high, char *scontext) { int err; @@ -169,7 +168,7 @@ int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high, } -int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high, +int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high, char *scontext) { int err; @@ -199,7 +198,7 @@ int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high, } -int flask_add_device(int xc_handle, unsigned long device, char *scontext) +int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext) { int err; flask_op_t op; @@ -228,7 +227,7 @@ int flask_add_device(int xc_handle, unsigned long device, char *scontext) } -int flask_del_pirq(int xc_handle, unsigned int pirq) +int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq) { int err; flask_op_t op; @@ -257,7 +256,7 @@ int flask_del_pirq(int xc_handle, unsigned int pirq) } -int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high) +int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high) { int err; flask_op_t op; @@ -286,7 +285,7 @@ int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high) } -int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high) +int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high) { int err; flask_op_t op; @@ -315,7 +314,7 @@ int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high) } -int flask_del_device(int xc_handle, unsigned long device) +int flask_del_device(xc_interface *xc_handle, unsigned long device) { int err; flask_op_t op; @@ -343,7 +342,7 @@ int flask_del_device(int xc_handle, unsigned long device) } -int flask_access(int xc_handle, const char *scon, const char *tcon, +int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon, u_int16_t tclass, u_int32_t req, u_int32_t *allowed, u_int32_t *decided, u_int32_t *auditallow, u_int32_t *auditdeny, @@ -407,7 +406,7 @@ int flask_access(int xc_handle, const char *scon, const char *tcon, } -int flask_avc_hashstats(int xc_handle, char *buf, int size) +int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size) { int err; flask_op_t op; @@ -425,7 +424,7 @@ int flask_avc_hashstats(int xc_handle, char *buf, int size) return 0; } -int flask_avc_cachestats(int xc_handle, char *buf, int size) +int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size) { int err; flask_op_t op; @@ -443,7 +442,7 @@ int flask_avc_cachestats(int xc_handle, char *buf, int size) return 0; } -int flask_policyvers(int xc_handle, char *buf, int size) +int flask_policyvers(xc_interface *xc_handle, char *buf, int size) { int err; flask_op_t op; @@ -461,7 +460,7 @@ int flask_policyvers(int xc_handle, char *buf, int size) return 0; } -int flask_getavc_threshold(int xc_handle) +int flask_getavc_threshold(xc_interface *xc_handle) { int err; flask_op_t op; @@ -481,7 +480,7 @@ int flask_getavc_threshold(int xc_handle) return threshold; } -int flask_setavc_threshold(int xc_handle, int threshold) +int flask_setavc_threshold(xc_interface *xc_handle, int threshold) { int err; flask_op_t op; diff --git a/tools/flask/libflask/include/libflask.h b/tools/flask/libflask/include/libflask.h index 7548d4e299..e4c34b8746 100644 --- a/tools/flask/libflask/include/libflask.h +++ b/tools/flask/libflask/include/libflask.h @@ -14,32 +14,33 @@ #include <stdint.h> #include <xen/xen.h> #include <xen/xsm/flask_op.h> +#include <xenctrl.h> -int flask_load(int xc_handle, char *buf, uint32_t size); -int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid); -int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size); -int flask_getenforce(int xc_handle); -int flask_setenforce(int xc_handle, int mode); -int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext); -int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high, +int flask_load(xc_interface *xc_handle, char *buf, uint32_t size); +int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid); +int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size); +int flask_getenforce(xc_interface *xc_handle); +int flask_setenforce(xc_interface *xc_handle, int mode); +int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext); +int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high, char *scontext); -int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high, +int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high, char *scontext); -int flask_add_device(int xc_handle, unsigned long device, char *scontext); -int flask_del_pirq(int xc_handle, unsigned int pirq); -int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high); -int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high); -int flask_del_device(int xc_handle, unsigned long device); -int flask_access(int xc_handle, const char *scon, const char *tcon, +int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext); +int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq); +int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high); +int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high); +int flask_del_device(xc_interface *xc_handle, unsigned long device); +int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon, u_int16_t tclass, u_int32_t req, u_int32_t *allowed, u_int32_t *decided, u_int32_t *auditallow, u_int32_t *auditdeny, u_int32_t *seqno); -int flask_avc_cachestats(int xc_handle, char *buf, int size); -int flask_policyvers(int xc_handle, char *buf, int size); -int flask_avc_hashstats(int xc_handle, char *buf, int size); -int flask_getavc_threshold(int xc_handle); -int flask_setavc_threshold(int xc_handle, int threshold); +int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size); +int flask_policyvers(xc_interface *xc_handle, char *buf, int size); +int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size); +int flask_getavc_threshold(xc_interface *xc_handle); +int flask_setavc_threshold(xc_interface *xc_handle, int threshold); #define flask_add_single_ioport(x, l, s) flask_add_ioport(x, l, l, s) #define flask_add_single_iomem(x, l, s) flask_add_iomem(x, l, l, s) #define flask_del_single_ioport(x, l) flask_del_ioport(x, l, l) diff --git a/tools/flask/utils/getenforce.c b/tools/flask/utils/getenforce.c index 1706f6a2e2..281fc814e6 100644 --- a/tools/flask/utils/getenforce.c +++ b/tools/flask/utils/getenforce.c @@ -27,13 +27,13 @@ static void usage (int argCnt, const char *args[]) int main (int argCnt, const char *args[]) { int ret; - int xch = 0; + xc_interface *xch = 0; if (argCnt != 1) usage(argCnt, args); - xch = xc_interface_open(); - if ( xch < 0 ) + xch = xc_interface_open(0,0,0); + if ( !xch ) { fprintf(stderr, "Unable to create interface to xenctrl: %s\n", strerror(errno)); diff --git a/tools/flask/utils/loadpolicy.c b/tools/flask/utils/loadpolicy.c index 13e4cb2c32..4e99c71e2a 100644 --- a/tools/flask/utils/loadpolicy.c +++ b/tools/flask/utils/loadpolicy.c @@ -35,7 +35,7 @@ int main (int argCnt, const char *args[]) void *polMemCp = NULL; struct stat info; int ret; - int xch = 0; + xc_interface *xch = 0; if (argCnt != 2) usage(argCnt, args); @@ -70,8 +70,8 @@ int main (int argCnt, const char *args[]) goto cleanup; } - xch = xc_interface_open(); - if ( xch < 0 ) + xch = xc_interface_open(0,0,0); + if ( !xch ) { fprintf(stderr, "Unable to create interface to xenctrl: %s\n", strerror(errno)); diff --git a/tools/flask/utils/setenforce.c b/tools/flask/utils/setenforce.c index 60e8eb086f..63928bdd3a 100644 --- a/tools/flask/utils/setenforce.c +++ b/tools/flask/utils/setenforce.c @@ -27,15 +27,15 @@ static void usage (int argCnt, const char *args[]) int main (int argCnt, const char *args[]) { int ret = 0; - int xch = 0; + xc_interface *xch = 0; long mode = 0; char *end; if (argCnt != 2) usage(argCnt, args); - xch = xc_interface_open(); - if ( xch < 0 ) + xch = xc_interface_open(0,0,0); + if ( !xch ) { fprintf(stderr, "Unable to create interface to xenctrl: %s\n", strerror(errno)); |