ia64/xen-unstable

changeset 17360:6a7a61c26b14

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>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Apr 01 10:07:35 2008 +0100 (2008-04-01)
parents 05ac689a9473
children ff32e4cd61af
files tools/libxen/include/xen/api/xen_acmpolicy.h tools/libxen/include/xen/api/xen_xspolicy.h tools/libxen/src/xen_xspolicy.c
line diff
     1.1 --- a/tools/libxen/include/xen/api/xen_acmpolicy.h	Tue Apr 01 10:06:58 2008 +0100
     1.2 +++ b/tools/libxen/include/xen/api/xen_acmpolicy.h	Tue Apr 01 10:07:35 2008 +0100
     1.3 @@ -74,7 +74,7 @@ xen_acm_header_free(xen_acm_header *hdr)
     1.4  /**
     1.5   * Get the referenced policy's record.
     1.6   */
     1.7 -bool
     1.8 +extern bool
     1.9  xen_acmpolicy_get_record(xen_session *session, xen_acmpolicy_record **result,
    1.10                           xen_xspolicy xspolicy);
    1.11  
    1.12 @@ -118,14 +118,14 @@ xen_acmpolicy_get_enforced_binary(xen_se
    1.13  /**
    1.14   * Get the ACM ssidref of the given VM.
    1.15   */
    1.16 -bool
    1.17 +extern bool
    1.18  xen_acmpolicy_get_VM_ssidref(xen_session *session, int64_t *result,
    1.19                               xen_vm vm);
    1.20  
    1.21  /**
    1.22   * Get the UUID field of the given policy.
    1.23   */
    1.24 -bool
    1.25 +extern bool
    1.26  xen_acmpolicy_get_uuid(xen_session *session, char **result,
    1.27                         xen_xspolicy xspolicy);
    1.28  
     2.1 --- a/tools/libxen/include/xen/api/xen_xspolicy.h	Tue Apr 01 10:06:58 2008 +0100
     2.2 +++ b/tools/libxen/include/xen/api/xen_xspolicy.h	Tue Apr 01 10:07:35 2008 +0100
     2.3 @@ -68,6 +68,8 @@ enum xs_instantiationflags {
     2.4  #define XSERR_RESOURCE_ACCESS           23 + XSERR_BASE
     2.5  #define XSERR_HV_OP_FAILED              24 + XSERR_BASE
     2.6  #define XSERR_BOOTPOLICY_INSTALL_ERROR  25 + XSERR_BASE
     2.7 +#define XSERR_VM_NOT_AUTHORIZED         26 + XSERR_BASE
     2.8 +#define XSERR_VM_IN_CONFLICT            27 + XSERR_BASE
     2.9  
    2.10  
    2.11  /**
    2.12 @@ -179,28 +181,28 @@ typedef struct xen_xs_policystate
    2.13      char *errors;
    2.14  } xen_xs_policystate;
    2.15  
    2.16 -void
    2.17 +extern void
    2.18  xen_xs_policystate_free(xen_xs_policystate *state);
    2.19  
    2.20  
    2.21  /**
    2.22   * Get the referenced policy's record.
    2.23   */
    2.24 -bool
    2.25 +extern bool
    2.26  xen_xspolicy_get_record(xen_session *session, xen_xspolicy_record **result,
    2.27                          xen_xspolicy xspolicy);
    2.28  
    2.29  /**
    2.30   * Get the UUID field of the given policy.
    2.31   */
    2.32 -bool
    2.33 +extern bool
    2.34  xen_xspolicy_get_uuid(xen_session *session, char **result,
    2.35                        xen_xspolicy xspolicy);
    2.36  
    2.37  /**
    2.38   * Get a policy given it's UUID
    2.39   */
    2.40 -bool
    2.41 +extern bool
    2.42  xen_xspolicy_get_by_uuid(xen_session *session, xen_xspolicy *result,
    2.43                           char *uuid);
    2.44  
    2.45 @@ -208,7 +210,7 @@ xen_xspolicy_get_by_uuid(xen_session *se
    2.46  /**
    2.47   * Get the types of policies supported by the system.
    2.48   */
    2.49 -bool
    2.50 +extern bool
    2.51  xen_xspolicy_get_xstype(xen_session *session, xs_type *result);
    2.52  
    2.53  
    2.54 @@ -216,13 +218,13 @@ xen_xspolicy_get_xstype(xen_session *ses
    2.55   * Get information about the currently managed policy.
    2.56   * (The API allows only one policy to be on the system.)
    2.57   */
    2.58 -bool
    2.59 +extern bool
    2.60  xen_xspolicy_get_xspolicy(xen_session *session, xen_xs_policystate **result);
    2.61  
    2.62  /**
    2.63   * Activate the referenced policy by loading it into the hypervisor.
    2.64   */
    2.65 -bool
    2.66 +extern bool
    2.67  xen_xspolicy_activate_xspolicy(xen_session *session, int64_t *result,
    2.68                                 xen_xspolicy xspolicy,
    2.69                                 xs_instantiationflags flags);
    2.70 @@ -234,7 +236,7 @@ xen_xspolicy_activate_xspolicy(xen_sessi
    2.71   * on whether to load the policy immediately and whether to overwrite
    2.72   * an existing policy on the system.
    2.73   */
    2.74 -bool
    2.75 +extern bool
    2.76  xen_xspolicy_set_xspolicy(xen_session *session, xen_xs_policystate **result,
    2.77                            xs_type type, char *repr, int64_t flags,
    2.78                            bool overwrite);
    2.79 @@ -248,7 +250,7 @@ xen_xspolicy_set_xspolicy(xen_session *s
    2.80   * for example fail if other domains than Domain-0 are running and have
    2.81   * different labels than Domain-0.
    2.82   */
    2.83 -bool
    2.84 +extern bool
    2.85  xen_xspolicy_reset_xspolicy(xen_session *session, xen_xs_policystate **result,
    2.86                              xs_type type);
    2.87  
    2.88 @@ -281,4 +283,11 @@ extern bool
    2.89  xen_xspolicy_get_resource_label(xen_session *session, char **label,
    2.90                                  char *resource);
    2.91  
    2.92 +/**
    2.93 + * Check whether a VM with the given VM-label could run.
    2.94 + */
    2.95 +extern bool
    2.96 +xen_xspolicy_can_run(xen_session *session, int64_t *result,
    2.97 +                     char *security_label);
    2.98 +
    2.99  #endif
     3.1 --- a/tools/libxen/src/xen_xspolicy.c	Tue Apr 01 10:06:58 2008 +0100
     3.2 +++ b/tools/libxen/src/xen_xspolicy.c	Tue Apr 01 10:07:35 2008 +0100
     3.3 @@ -343,3 +343,21 @@ xen_xspolicy_activate_xspolicy(xen_sessi
     3.4      XEN_CALL_("XSPolicy.activate_xspolicy");
     3.5      return session->ok;
     3.6  }
     3.7 +
     3.8 +
     3.9 +bool
    3.10 +xen_xspolicy_can_run(xen_session *session, int64_t *result,
    3.11 +                     char *security_label)
    3.12 +{
    3.13 +    abstract_value param_values[] =
    3.14 +        {
    3.15 +            { .type = &abstract_type_string,
    3.16 +              .u.string_val = security_label }
    3.17 +        };
    3.18 +
    3.19 +    abstract_type result_type = abstract_type_int;
    3.20 +
    3.21 +    *result = 0;
    3.22 +    XEN_CALL_("XSPolicy.can_run");
    3.23 +    return session->ok;
    3.24 +}