ia64/xen-unstable

changeset 12168:d0d6f230f1d4

Fix VTPM bindings -- ints in the model are uint64_t at the C binding level.
VM's, being referenced from the VTPM, have a backreferring set. Remove the
implementation of the old, dead VTPM-related fields on VM.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Oct 26 16:02:49 2006 +0100 (2006-10-26)
parents 8f090c551b09
children 9adcaf73fae2
files tools/libxen/include/xen_vm.h tools/libxen/include/xen_vtpm.h tools/libxen/src/xen_vm.c tools/libxen/src/xen_vtpm.c
line diff
     1.1 --- a/tools/libxen/include/xen_vm.h	Thu Oct 26 15:59:51 2006 +0100
     1.2 +++ b/tools/libxen/include/xen_vm.h	Thu Oct 26 16:02:49 2006 +0100
     1.3 @@ -29,9 +29,9 @@
     1.4  #include "xen_string_string_map.h"
     1.5  #include "xen_vbd_decl.h"
     1.6  #include "xen_vif_decl.h"
     1.7 -#include "xen_vtpm_decl.h"
     1.8  #include "xen_vm_decl.h"
     1.9  #include "xen_vm_power_state.h"
    1.10 +#include "xen_vtpm_decl.h"
    1.11  
    1.12  
    1.13  /*
    1.14 @@ -98,8 +98,7 @@ typedef struct xen_vm_record
    1.15      enum xen_on_crash_behaviour actions_after_crash;
    1.16      struct xen_vif_record_opt_set *vifs;
    1.17      struct xen_vbd_record_opt_set *vbds;
    1.18 -    uint64_t tpm_instance;
    1.19 -    uint64_t tpm_backend;
    1.20 +    struct xen_vtpm_record_opt_set *vtpms;
    1.21      char *bios_boot;
    1.22      bool platform_std_vga;
    1.23      char *platform_serial;
     2.1 --- a/tools/libxen/include/xen_vtpm.h	Thu Oct 26 15:59:51 2006 +0100
     2.2 +++ b/tools/libxen/include/xen_vtpm.h	Thu Oct 26 16:02:49 2006 +0100
     2.3 @@ -22,13 +22,13 @@
     2.4  
     2.5  #include "xen_common.h"
     2.6  #include "xen_driver_type.h"
     2.7 +#include "xen_vm_decl.h"
     2.8  #include "xen_vtpm_decl.h"
     2.9 -#include "xen_vm_decl.h"
    2.10  
    2.11  
    2.12  /*
    2.13 - * The VTPM class.
    2.14 - *
    2.15 + * The VTPM class. 
    2.16 + *  
    2.17   * A virtual TPM device.
    2.18   */
    2.19  
    2.20 @@ -67,8 +67,8 @@ typedef struct xen_vtpm_record
    2.21      char *uuid;
    2.22      struct xen_vm_record_opt *vm;
    2.23      struct xen_vm_record_opt *backend;
    2.24 -    int instance;
    2.25      enum xen_driver_type driver;
    2.26 +    uint64_t instance;
    2.27  } xen_vtpm_record;
    2.28  
    2.29  /**
    2.30 @@ -78,8 +78,8 @@ extern xen_vtpm_record *
    2.31  xen_vtpm_record_alloc(void);
    2.32  
    2.33  /**
    2.34 - * Free the given xen_vtpm_record, and all referenced values.  The given
    2.35 - * record must have been allocated by this library.
    2.36 + * Free the given xen_vtpm_record, and all referenced values.  The
    2.37 + * given record must have been allocated by this library.
    2.38   */
    2.39  extern void
    2.40  xen_vtpm_record_free(xen_vtpm_record *record);
    2.41 @@ -143,7 +143,7 @@ extern xen_vtpm_record_opt_set *
    2.42  xen_vtpm_record_opt_set_alloc(size_t size);
    2.43  
    2.44  /**
    2.45 - * Free the given xen_vtpm_record_opt_set, and all referenced values.
    2.46 + * Free the given xen_vtpm_record_opt_set, and all referenced values. 
    2.47   * The given set must have been allocated by this library.
    2.48   */
    2.49  extern void
    2.50 @@ -193,10 +193,17 @@ xen_vtpm_get_backend(xen_session *sessio
    2.51  
    2.52  
    2.53  /**
    2.54 + * Get the driver field of the given VTPM.
    2.55 + */
    2.56 +extern bool
    2.57 +xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm);
    2.58 +
    2.59 +
    2.60 +/**
    2.61   * Get the instance field of the given VTPM.
    2.62   */
    2.63  extern bool
    2.64 -xen_vtpm_get_instance(xen_session *session, int *result, xen_vtpm vtpm);
    2.65 +xen_vtpm_get_instance(xen_session *session, uint64_t *result, xen_vtpm vtpm);
    2.66  
    2.67  
    2.68  #endif
     3.1 --- a/tools/libxen/src/xen_vm.c	Thu Oct 26 15:59:51 2006 +0100
     3.2 +++ b/tools/libxen/src/xen_vm.c	Thu Oct 26 16:02:49 2006 +0100
     3.3 @@ -32,9 +32,9 @@
     3.4  #include "xen_string_string_map.h"
     3.5  #include "xen_vbd.h"
     3.6  #include "xen_vif.h"
     3.7 -#include "xen_vtpm.h"
     3.8  #include "xen_vm.h"
     3.9  #include "xen_vm_power_state_internal.h"
    3.10 +#include "xen_vtpm.h"
    3.11  
    3.12  
    3.13  XEN_FREE(xen_vm)
    3.14 @@ -126,6 +126,9 @@ static const struct_member xen_vm_record
    3.15          { .key = "vbds",
    3.16            .type = &abstract_type_ref_set,
    3.17            .offset = offsetof(xen_vm_record, vbds) },
    3.18 +        { .key = "vtpms",
    3.19 +          .type = &abstract_type_ref_set,
    3.20 +          .offset = offsetof(xen_vm_record, vtpms) },
    3.21          { .key = "bios_boot",
    3.22            .type = &abstract_type_string,
    3.23            .offset = offsetof(xen_vm_record, bios_boot) },
    3.24 @@ -200,6 +203,7 @@ xen_vm_record_free(xen_vm_record *record
    3.25      xen_cpu_feature_set_free(record->vcpus_features_force_off);
    3.26      xen_vif_record_opt_set_free(record->vifs);
    3.27      xen_vbd_record_opt_set_free(record->vbds);
    3.28 +    xen_vtpm_record_opt_set_free(record->vtpms);
    3.29      free(record->bios_boot);
    3.30      free(record->platform_serial);
    3.31      free(record->builder);
     4.1 --- a/tools/libxen/src/xen_vtpm.c	Thu Oct 26 15:59:51 2006 +0100
     4.2 +++ b/tools/libxen/src/xen_vtpm.c	Thu Oct 26 16:02:49 2006 +0100
     4.3 @@ -24,12 +24,17 @@
     4.4  #include "xen_common.h"
     4.5  #include "xen_driver_type_internal.h"
     4.6  #include "xen_internal.h"
     4.7 +#include "xen_vm.h"
     4.8  #include "xen_vtpm.h"
     4.9 -#include "xen_vm.h"
    4.10  
    4.11  
    4.12  XEN_FREE(xen_vtpm)
    4.13  XEN_SET_ALLOC_FREE(xen_vtpm)
    4.14 +XEN_ALLOC(xen_vtpm_record)
    4.15 +XEN_SET_ALLOC_FREE(xen_vtpm_record)
    4.16 +XEN_ALLOC(xen_vtpm_record_opt)
    4.17 +XEN_RECORD_OPT_FREE(xen_vtpm)
    4.18 +XEN_SET_ALLOC_FREE(xen_vtpm_record_opt)
    4.19  
    4.20  
    4.21  static const struct_member xen_vtpm_record_struct_members[] =
    4.22 @@ -46,6 +51,9 @@ static const struct_member xen_vtpm_reco
    4.23          { .key = "driver",
    4.24            .type = &xen_driver_type_abstract_type_,
    4.25            .offset = offsetof(xen_vtpm_record, driver) },
    4.26 +        { .key = "instance",
    4.27 +          .type = &abstract_type_int,
    4.28 +          .offset = offsetof(xen_vtpm_record, instance) }
    4.29      };
    4.30  
    4.31  const abstract_type xen_vtpm_record_abstract_type_ =
    4.32 @@ -161,7 +169,24 @@ xen_vtpm_get_backend(xen_session *sessio
    4.33  
    4.34  
    4.35  bool
    4.36 -xen_vtpm_get_instance(xen_session *session, int *result, xen_vtpm vtpm)
    4.37 +xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm)
    4.38 +{
    4.39 +    abstract_value param_values[] =
    4.40 +        {
    4.41 +            { .type = &abstract_type_string,
    4.42 +              .u.string_val = vtpm }
    4.43 +        };
    4.44 +
    4.45 +    abstract_type result_type = xen_driver_type_abstract_type_;
    4.46 +    char *result_str = NULL;
    4.47 +    XEN_CALL_("VTPM.get_driver");
    4.48 +    *result = xen_driver_type_from_string(session, result_str);
    4.49 +    return session->ok;
    4.50 +}
    4.51 +
    4.52 +
    4.53 +bool
    4.54 +xen_vtpm_get_instance(xen_session *session, uint64_t *result, xen_vtpm vtpm)
    4.55  {
    4.56      abstract_value param_values[] =
    4.57          {
    4.58 @@ -182,5 +207,3 @@ xen_vtpm_get_uuid(xen_session *session, 
    4.59      *result = session->ok ? xen_strdup_((char *)vtpm) : NULL;
    4.60      return session->ok;
    4.61  }
    4.62 -
    4.63 -