|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libflask: Add boolean manipulation functions
# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1328196253 0
# Node ID 300bfdf167fa5c0bcd129914c1bd890b431fdb9e
# Parent 2b092d291348f0cf7f04e5a12af3e293372dd022
libflask: Add boolean manipulation functions
Add wrappers for getting and setting policy booleans by name or ID.
Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---
diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/flask_op.c
--- a/tools/flask/libflask/flask_op.c Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/flask_op.c Thu Feb 02 15:24:13 2012 +0000
@@ -109,6 +109,65 @@
return 0;
}
+int flask_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr,
int *pend)
+{
+ flask_op_t op;
+ char buf[255];
+ int rv;
+
+ op.cmd = FLASK_GETBOOL2;
+ op.buf = buf;
+ op.size = 255;
+
+ snprintf(buf, sizeof buf, "%i", id);
+
+ rv = xc_flask_op(xc_handle, &op);
+
+ if ( rv )
+ return rv;
+
+ sscanf(buf, "%i %i %s", curr, pend, name);
+
+ return rv;
+}
+
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int
*pend)
+{
+ flask_op_t op;
+ char buf[255];
+ int rv;
+
+ op.cmd = FLASK_GETBOOL_NAMED;
+ op.buf = buf;
+ op.size = 255;
+
+ strncpy(buf, name, op.size);
+
+ rv = xc_flask_op(xc_handle, &op);
+
+ if ( rv )
+ return rv;
+
+ sscanf(buf, "%i %i", curr, pend);
+
+ return rv;
+}
+
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit)
+{
+ flask_op_t op;
+ char buf[255];
+ int size = 255;
+
+ op.cmd = FLASK_SETBOOL_NAMED;
+ op.buf = buf;
+ op.size = size;
+
+ snprintf(buf, size, "%s %i %i", name, value, commit);
+
+ return xc_flask_op(xc_handle, &op);
+}
+
int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
{
int err;
diff -r 2b092d291348 -r 300bfdf167fa tools/flask/libflask/include/libflask.h
--- a/tools/flask/libflask/include/libflask.h Thu Feb 02 15:23:43 2012 +0000
+++ b/tools/flask/libflask/include/libflask.h Thu Feb 02 15:24:13 2012 +0000
@@ -21,6 +21,9 @@
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_getbool_byid(xc_interface *xc_handle, int id, char *name, int *curr,
int *pend);
+int flask_getbool_byname(xc_interface *xc_handle, char *name, int *curr, int
*pend);
+int flask_setbool(xc_interface *xc_handle, char *name, int value, int commit);
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);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |