[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Fix VTPM bindings -- ints in the model are uint64_t at the C binding level.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Node ID d0d6f230f1d439626625996ae2f9d3903d8ad749 # Parent 8f090c551b09577d93aab5b71b30edae671bbf98 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@xxxxxxxxxxxxx> --- tools/libxen/include/xen_vm.h | 5 ++--- tools/libxen/include/xen_vtpm.h | 23 +++++++++++++++-------- tools/libxen/src/xen_vm.c | 6 +++++- tools/libxen/src/xen_vtpm.c | 31 +++++++++++++++++++++++++++---- 4 files changed, 49 insertions(+), 16 deletions(-) diff -r 8f090c551b09 -r d0d6f230f1d4 tools/libxen/include/xen_vm.h --- a/tools/libxen/include/xen_vm.h Thu Oct 26 15:59:51 2006 +0100 +++ b/tools/libxen/include/xen_vm.h Thu Oct 26 16:02:49 2006 +0100 @@ -29,9 +29,9 @@ #include "xen_string_string_map.h" #include "xen_vbd_decl.h" #include "xen_vif_decl.h" -#include "xen_vtpm_decl.h" #include "xen_vm_decl.h" #include "xen_vm_power_state.h" +#include "xen_vtpm_decl.h" /* @@ -98,8 +98,7 @@ typedef struct xen_vm_record enum xen_on_crash_behaviour actions_after_crash; struct xen_vif_record_opt_set *vifs; struct xen_vbd_record_opt_set *vbds; - uint64_t tpm_instance; - uint64_t tpm_backend; + struct xen_vtpm_record_opt_set *vtpms; char *bios_boot; bool platform_std_vga; char *platform_serial; diff -r 8f090c551b09 -r d0d6f230f1d4 tools/libxen/include/xen_vtpm.h --- a/tools/libxen/include/xen_vtpm.h Thu Oct 26 15:59:51 2006 +0100 +++ b/tools/libxen/include/xen_vtpm.h Thu Oct 26 16:02:49 2006 +0100 @@ -22,13 +22,13 @@ #include "xen_common.h" #include "xen_driver_type.h" +#include "xen_vm_decl.h" #include "xen_vtpm_decl.h" -#include "xen_vm_decl.h" /* - * The VTPM class. - * + * The VTPM class. + * * A virtual TPM device. */ @@ -67,8 +67,8 @@ typedef struct xen_vtpm_record char *uuid; struct xen_vm_record_opt *vm; struct xen_vm_record_opt *backend; - int instance; enum xen_driver_type driver; + uint64_t instance; } xen_vtpm_record; /** @@ -78,8 +78,8 @@ xen_vtpm_record_alloc(void); xen_vtpm_record_alloc(void); /** - * Free the given xen_vtpm_record, and all referenced values. The given - * record must have been allocated by this library. + * Free the given xen_vtpm_record, and all referenced values. The + * given record must have been allocated by this library. */ extern void xen_vtpm_record_free(xen_vtpm_record *record); @@ -143,7 +143,7 @@ xen_vtpm_record_opt_set_alloc(size_t siz xen_vtpm_record_opt_set_alloc(size_t size); /** - * Free the given xen_vtpm_record_opt_set, and all referenced values. + * Free the given xen_vtpm_record_opt_set, and all referenced values. * The given set must have been allocated by this library. */ extern void @@ -193,10 +193,17 @@ xen_vtpm_get_backend(xen_session *sessio /** + * Get the driver field of the given VTPM. + */ +extern bool +xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm); + + +/** * Get the instance field of the given VTPM. */ extern bool -xen_vtpm_get_instance(xen_session *session, int *result, xen_vtpm vtpm); +xen_vtpm_get_instance(xen_session *session, uint64_t *result, xen_vtpm vtpm); #endif diff -r 8f090c551b09 -r d0d6f230f1d4 tools/libxen/src/xen_vm.c --- a/tools/libxen/src/xen_vm.c Thu Oct 26 15:59:51 2006 +0100 +++ b/tools/libxen/src/xen_vm.c Thu Oct 26 16:02:49 2006 +0100 @@ -32,9 +32,9 @@ #include "xen_string_string_map.h" #include "xen_vbd.h" #include "xen_vif.h" -#include "xen_vtpm.h" #include "xen_vm.h" #include "xen_vm_power_state_internal.h" +#include "xen_vtpm.h" XEN_FREE(xen_vm) @@ -126,6 +126,9 @@ static const struct_member xen_vm_record { .key = "vbds", .type = &abstract_type_ref_set, .offset = offsetof(xen_vm_record, vbds) }, + { .key = "vtpms", + .type = &abstract_type_ref_set, + .offset = offsetof(xen_vm_record, vtpms) }, { .key = "bios_boot", .type = &abstract_type_string, .offset = offsetof(xen_vm_record, bios_boot) }, @@ -200,6 +203,7 @@ xen_vm_record_free(xen_vm_record *record xen_cpu_feature_set_free(record->vcpus_features_force_off); xen_vif_record_opt_set_free(record->vifs); xen_vbd_record_opt_set_free(record->vbds); + xen_vtpm_record_opt_set_free(record->vtpms); free(record->bios_boot); free(record->platform_serial); free(record->builder); diff -r 8f090c551b09 -r d0d6f230f1d4 tools/libxen/src/xen_vtpm.c --- a/tools/libxen/src/xen_vtpm.c Thu Oct 26 15:59:51 2006 +0100 +++ b/tools/libxen/src/xen_vtpm.c Thu Oct 26 16:02:49 2006 +0100 @@ -24,12 +24,17 @@ #include "xen_common.h" #include "xen_driver_type_internal.h" #include "xen_internal.h" +#include "xen_vm.h" #include "xen_vtpm.h" -#include "xen_vm.h" XEN_FREE(xen_vtpm) XEN_SET_ALLOC_FREE(xen_vtpm) +XEN_ALLOC(xen_vtpm_record) +XEN_SET_ALLOC_FREE(xen_vtpm_record) +XEN_ALLOC(xen_vtpm_record_opt) +XEN_RECORD_OPT_FREE(xen_vtpm) +XEN_SET_ALLOC_FREE(xen_vtpm_record_opt) static const struct_member xen_vtpm_record_struct_members[] = @@ -46,6 +51,9 @@ static const struct_member xen_vtpm_reco { .key = "driver", .type = &xen_driver_type_abstract_type_, .offset = offsetof(xen_vtpm_record, driver) }, + { .key = "instance", + .type = &abstract_type_int, + .offset = offsetof(xen_vtpm_record, instance) } }; const abstract_type xen_vtpm_record_abstract_type_ = @@ -161,7 +169,24 @@ xen_vtpm_get_backend(xen_session *sessio bool -xen_vtpm_get_instance(xen_session *session, int *result, xen_vtpm vtpm) +xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vtpm } + }; + + abstract_type result_type = xen_driver_type_abstract_type_; + char *result_str = NULL; + XEN_CALL_("VTPM.get_driver"); + *result = xen_driver_type_from_string(session, result_str); + return session->ok; +} + + +bool +xen_vtpm_get_instance(xen_session *session, uint64_t *result, xen_vtpm vtpm) { abstract_value param_values[] = { @@ -182,5 +207,3 @@ xen_vtpm_get_uuid(xen_session *session, *result = session->ok ? xen_strdup_((char *)vtpm) : NULL; return session->ok; } - - _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |