mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
libxen: XSPolicy.can_run for libxen
Add the stub and prototype for the XSPolicy.can_run function to the lib-xen library. I also fixed some prototypes that had missing 'extern's. Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
This commit is contained in:
1 parent
999853b092
commit
a9920c61ac
3 files changed
+39
-12
No files matched your search
@@ -74,7 +74,7 @@ xen_acm_header_free(xen_acm_header *hdr);
|
||||
/**
|
||||
* Get the referenced policy's record.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_acmpolicy_get_record(xen_session *session, xen_acmpolicy_record **result,
|
||||
xen_xspolicy xspolicy);
|
||||
|
||||
@@ -118,14 +118,14 @@ xen_acmpolicy_get_enforced_binary(xen_session *session, char **binary,
|
||||
/**
|
||||
* Get the ACM ssidref of the given VM.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_acmpolicy_get_VM_ssidref(xen_session *session, int64_t *result,
|
||||
xen_vm vm);
|
||||
|
||||
/**
|
||||
* Get the UUID field of the given policy.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_acmpolicy_get_uuid(xen_session *session, char **result,
|
||||
xen_xspolicy xspolicy);
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ enum xs_instantiationflags {
|
||||
#define XSERR_RESOURCE_ACCESS 23 + XSERR_BASE
|
||||
#define XSERR_HV_OP_FAILED 24 + XSERR_BASE
|
||||
#define XSERR_BOOTPOLICY_INSTALL_ERROR 25 + XSERR_BASE
|
||||
#define XSERR_VM_NOT_AUTHORIZED 26 + XSERR_BASE
|
||||
#define XSERR_VM_IN_CONFLICT 27 + XSERR_BASE
|
||||
|
||||
|
||||
/**
|
||||
@@ -179,28 +181,28 @@ typedef struct xen_xs_policystate
|
||||
char *errors;
|
||||
} xen_xs_policystate;
|
||||
|
||||
void
|
||||
extern void
|
||||
xen_xs_policystate_free(xen_xs_policystate *state);
|
||||
|
||||
|
||||
/**
|
||||
* Get the referenced policy's record.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_get_record(xen_session *session, xen_xspolicy_record **result,
|
||||
xen_xspolicy xspolicy);
|
||||
|
||||
/**
|
||||
* Get the UUID field of the given policy.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_get_uuid(xen_session *session, char **result,
|
||||
xen_xspolicy xspolicy);
|
||||
|
||||
/**
|
||||
* Get a policy given it's UUID
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
|
||||
char *uuid);
|
||||
|
||||
@@ -208,7 +210,7 @@ xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
|
||||
/**
|
||||
* Get the types of policies supported by the system.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_get_xstype(xen_session *session, xs_type *result);
|
||||
|
||||
|
||||
@@ -216,13 +218,13 @@ xen_xspolicy_get_xstype(xen_session *session, xs_type *result);
|
||||
* Get information about the currently managed policy.
|
||||
* (The API allows only one policy to be on the system.)
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result);
|
||||
|
||||
/**
|
||||
* Activate the referenced policy by loading it into the hypervisor.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_activate_xspolicy(xen_session *session, int64_t *result,
|
||||
xen_xspolicy xspolicy,
|
||||
xs_instantiationflags flags);
|
||||
@@ -234,7 +236,7 @@ xen_xspolicy_activate_xspolicy(xen_session *session, int64_t *result,
|
||||
* on whether to load the policy immediately and whether to overwrite
|
||||
* an existing policy on the system.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
|
||||
xs_type type, char *repr, int64_t flags,
|
||||
bool overwrite);
|
||||
@@ -248,7 +250,7 @@ xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
|
||||
* for example fail if other domains than Domain-0 are running and have
|
||||
* different labels than Domain-0.
|
||||
*/
|
||||
bool
|
||||
extern bool
|
||||
xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result,
|
||||
xs_type type);
|
||||
|
||||
@@ -281,4 +283,11 @@ extern bool
|
||||
xen_xspolicy_get_resource_label(xen_session *session, char **label,
|
||||
char *resource);
|
||||
|
||||
/**
|
||||
* Check whether a VM with the given VM-label could run.
|
||||
*/
|
||||
extern bool
|
||||
xen_xspolicy_can_run(xen_session *session, int64_t *result,
|
||||
char *security_label);
|
||||
|
||||
#endif
|
||||
@@ -343,3 +343,21 @@ xen_xspolicy_activate_xspolicy(xen_session *session,
|
||||
XEN_CALL_("XSPolicy.activate_xspolicy");
|
||||
return session->ok;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
xen_xspolicy_can_run(xen_session *session, int64_t *result,
|
||||
char *security_label)
|
||||
{
|
||||
abstract_value param_values[] =
|
||||
{
|
||||
{ .type = &abstract_type_string,
|
||||
.u.string_val = security_label }
|
||||
};
|
||||
|
||||
abstract_type result_type = abstract_type_int;
|
||||
|
||||
*result = 0;
|
||||
XEN_CALL_("XSPolicy.can_run");
|
||||
return session->ok;
|
||||
}
|
||||