ia64/xen-unstable

changeset 12165:4b0326c75c5b

Implement HostCPU.{vendor,speed,modelname}.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Oct 26 15:56:44 2006 +0100 (2006-10-26)
parents caf35cfcdda0
children de31d79add5e
files tools/libxen/include/xen_host_cpu.h tools/libxen/src/xen_host_cpu.c
line diff
     1.1 --- a/tools/libxen/include/xen_host_cpu.h	Thu Oct 26 15:53:31 2006 +0100
     1.2 +++ b/tools/libxen/include/xen_host_cpu.h	Thu Oct 26 15:56:44 2006 +0100
     1.3 @@ -66,6 +66,9 @@ typedef struct xen_host_cpu_record
     1.4      char *uuid;
     1.5      struct xen_host_record_opt *host;
     1.6      uint64_t number;
     1.7 +    char *vendor;
     1.8 +    uint64_t speed;
     1.9 +    char *modelname;
    1.10      struct xen_cpu_feature_set *features;
    1.11      double utilisation;
    1.12  } xen_host_cpu_record;
    1.13 @@ -192,6 +195,27 @@ xen_host_cpu_get_number(xen_session *ses
    1.14  
    1.15  
    1.16  /**
    1.17 + * Get the vendor field of the given host_cpu.
    1.18 + */
    1.19 +extern bool
    1.20 +xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu);
    1.21 +
    1.22 +
    1.23 +/**
    1.24 + * Get the speed field of the given host_cpu.
    1.25 + */
    1.26 +extern bool
    1.27 +xen_host_cpu_get_speed(xen_session *session, uint64_t *result, xen_host_cpu host_cpu);
    1.28 +
    1.29 +
    1.30 +/**
    1.31 + * Get the modelname field of the given host_cpu.
    1.32 + */
    1.33 +extern bool
    1.34 +xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu);
    1.35 +
    1.36 +
    1.37 +/**
    1.38   * Get the features field of the given host_cpu.
    1.39   */
    1.40  extern bool
     2.1 --- a/tools/libxen/src/xen_host_cpu.c	Thu Oct 26 15:53:31 2006 +0100
     2.2 +++ b/tools/libxen/src/xen_host_cpu.c	Thu Oct 26 15:56:44 2006 +0100
     2.3 @@ -48,6 +48,15 @@ static const struct_member xen_host_cpu_
     2.4          { .key = "number",
     2.5            .type = &abstract_type_int,
     2.6            .offset = offsetof(xen_host_cpu_record, number) },
     2.7 +        { .key = "vendor",
     2.8 +          .type = &abstract_type_string,
     2.9 +          .offset = offsetof(xen_host_cpu_record, vendor) },
    2.10 +        { .key = "speed",
    2.11 +          .type = &abstract_type_int,
    2.12 +          .offset = offsetof(xen_host_cpu_record, speed) },
    2.13 +        { .key = "modelname",
    2.14 +          .type = &abstract_type_string,
    2.15 +          .offset = offsetof(xen_host_cpu_record, modelname) },
    2.16          { .key = "features",
    2.17            .type = &xen_cpu_feature_set_abstract_type_,
    2.18            .offset = offsetof(xen_host_cpu_record, features) },
    2.19 @@ -72,6 +81,8 @@ xen_host_cpu_record_free(xen_host_cpu_re
    2.20      free(record->handle);
    2.21      free(record->uuid);
    2.22      xen_host_record_opt_free(record->host);
    2.23 +    free(record->vendor);
    2.24 +    free(record->modelname);
    2.25      xen_cpu_feature_set_free(record->features);
    2.26      free(record);
    2.27  }
    2.28 @@ -168,6 +179,56 @@ xen_host_cpu_get_number(xen_session *ses
    2.29  
    2.30  
    2.31  bool
    2.32 +xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu)
    2.33 +{
    2.34 +    abstract_value param_values[] =
    2.35 +        {
    2.36 +            { .type = &abstract_type_string,
    2.37 +              .u.string_val = host_cpu }
    2.38 +        };
    2.39 +
    2.40 +    abstract_type result_type = abstract_type_string;
    2.41 +
    2.42 +    *result = NULL;
    2.43 +    XEN_CALL_("host_cpu.get_vendor");
    2.44 +    return session->ok;
    2.45 +}
    2.46 +
    2.47 +
    2.48 +bool
    2.49 +xen_host_cpu_get_speed(xen_session *session, uint64_t *result, xen_host_cpu host_cpu)
    2.50 +{
    2.51 +    abstract_value param_values[] =
    2.52 +        {
    2.53 +            { .type = &abstract_type_string,
    2.54 +              .u.string_val = host_cpu }
    2.55 +        };
    2.56 +
    2.57 +    abstract_type result_type = abstract_type_int;
    2.58 +
    2.59 +    XEN_CALL_("host_cpu.get_speed");
    2.60 +    return session->ok;
    2.61 +}
    2.62 +
    2.63 +
    2.64 +bool
    2.65 +xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu)
    2.66 +{
    2.67 +    abstract_value param_values[] =
    2.68 +        {
    2.69 +            { .type = &abstract_type_string,
    2.70 +              .u.string_val = host_cpu }
    2.71 +        };
    2.72 +
    2.73 +    abstract_type result_type = abstract_type_string;
    2.74 +
    2.75 +    *result = NULL;
    2.76 +    XEN_CALL_("host_cpu.get_modelname");
    2.77 +    return session->ok;
    2.78 +}
    2.79 +
    2.80 +
    2.81 +bool
    2.82  xen_host_cpu_get_features(xen_session *session, struct xen_cpu_feature_set **result, xen_host_cpu host_cpu)
    2.83  {
    2.84      abstract_value param_values[] =