diff options
author | Ewan Mellor <ewan@xensource.com> | 2007-02-27 00:37:27 +0000 |
---|---|---|
committer | Ewan Mellor <ewan@xensource.com> | 2007-02-27 00:37:27 +0000 |
commit | d8309d27a1423904824363930736b7ea258a562d (patch) | |
tree | 9e93f767fbd07858b645f3bb56bb9ec846833593 /tools/libxen | |
parent | b3c8af5814936eb99e2377428330c9938df67e43 (diff) | |
download | xen-d8309d27a1423904824363930736b7ea258a562d.tar.gz xen-d8309d27a1423904824363930736b7ea258a562d.tar.bz2 xen-d8309d27a1423904824363930736b7ea258a562d.zip |
Added some more fields to host_cpu.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/libxen')
-rw-r--r-- | tools/libxen/include/xen_host_cpu.h | 36 | ||||
-rw-r--r-- | tools/libxen/src/xen_host_cpu.c | 47 |
2 files changed, 48 insertions, 35 deletions
diff --git a/tools/libxen/include/xen_host_cpu.h b/tools/libxen/include/xen_host_cpu.h index 945a7279d1..f70023f24e 100644 --- a/tools/libxen/include/xen_host_cpu.h +++ b/tools/libxen/include/xen_host_cpu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, XenSource Inc. + * Copyright (c) 2006-2007, XenSource Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,8 +25,8 @@ /* - * The host_cpu class. - * + * The host_cpu class. + * * A physical CPU. */ @@ -68,6 +68,8 @@ typedef struct xen_host_cpu_record char *vendor; int64_t speed; char *modelname; + char *stepping; + char *flags; double utilisation; } xen_host_cpu_record; @@ -165,20 +167,6 @@ xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid) /** - * Create a new host_cpu instance, and return its handle. - */ -extern bool -xen_host_cpu_create(xen_session *session, xen_host_cpu *result, xen_host_cpu_record *record); - - -/** - * Destroy the specified host_cpu instance. - */ -extern bool -xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu); - - -/** * Get the uuid field of the given host_cpu. */ extern bool @@ -221,6 +209,20 @@ xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu hos /** + * Get the stepping field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** + * Get the flags field of the given host_cpu. + */ +extern bool +xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu); + + +/** * Get the utilisation field of the given host_cpu. */ extern bool diff --git a/tools/libxen/src/xen_host_cpu.c b/tools/libxen/src/xen_host_cpu.c index 1300ce0e43..425d0c60b9 100644 --- a/tools/libxen/src/xen_host_cpu.c +++ b/tools/libxen/src/xen_host_cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, XenSource Inc. + * Copyright (c) 2006-2007, XenSource Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -55,6 +55,12 @@ static const struct_member xen_host_cpu_record_struct_members[] = { .key = "modelname", .type = &abstract_type_string, .offset = offsetof(xen_host_cpu_record, modelname) }, + { .key = "stepping", + .type = &abstract_type_string, + .offset = offsetof(xen_host_cpu_record, stepping) }, + { .key = "flags", + .type = &abstract_type_string, + .offset = offsetof(xen_host_cpu_record, flags) }, { .key = "utilisation", .type = &abstract_type_float, .offset = offsetof(xen_host_cpu_record, utilisation) } @@ -82,6 +88,8 @@ xen_host_cpu_record_free(xen_host_cpu_record *record) xen_host_record_opt_free(record->host); free(record->vendor); free(record->modelname); + free(record->stepping); + free(record->flags); free(record); } @@ -127,24 +135,24 @@ xen_host_cpu_get_by_uuid(xen_session *session, xen_host_cpu *result, char *uuid) bool -xen_host_cpu_create(xen_session *session, xen_host_cpu *result, xen_host_cpu_record *record) +xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu) { abstract_value param_values[] = { - { .type = &xen_host_cpu_record_abstract_type_, - .u.struct_val = record } + { .type = &abstract_type_string, + .u.string_val = host_cpu } }; abstract_type result_type = abstract_type_string; *result = NULL; - XEN_CALL_("host_cpu.create"); + XEN_CALL_("host_cpu.get_host"); return session->ok; } bool -xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu) +xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -152,13 +160,15 @@ xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu) .u.string_val = host_cpu } }; - xen_call_(session, "host_cpu.destroy", param_values, 1, NULL, NULL); + abstract_type result_type = abstract_type_int; + + XEN_CALL_("host_cpu.get_number"); return session->ok; } bool -xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_cpu) +xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -169,13 +179,13 @@ xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu host_ abstract_type result_type = abstract_type_string; *result = NULL; - XEN_CALL_("host_cpu.get_host"); + XEN_CALL_("host_cpu.get_vendor"); return session->ok; } bool -xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host_cpu) +xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -185,13 +195,13 @@ xen_host_cpu_get_number(xen_session *session, int64_t *result, xen_host_cpu host abstract_type result_type = abstract_type_int; - XEN_CALL_("host_cpu.get_number"); + XEN_CALL_("host_cpu.get_speed"); return session->ok; } bool -xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_cpu) +xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -202,13 +212,13 @@ xen_host_cpu_get_vendor(xen_session *session, char **result, xen_host_cpu host_c abstract_type result_type = abstract_type_string; *result = NULL; - XEN_CALL_("host_cpu.get_vendor"); + XEN_CALL_("host_cpu.get_modelname"); return session->ok; } bool -xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_cpu) +xen_host_cpu_get_stepping(xen_session *session, char **result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -216,15 +226,16 @@ xen_host_cpu_get_speed(xen_session *session, int64_t *result, xen_host_cpu host_ .u.string_val = host_cpu } }; - abstract_type result_type = abstract_type_int; + abstract_type result_type = abstract_type_string; - XEN_CALL_("host_cpu.get_speed"); + *result = NULL; + XEN_CALL_("host_cpu.get_stepping"); return session->ok; } bool -xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu host_cpu) +xen_host_cpu_get_flags(xen_session *session, char **result, xen_host_cpu host_cpu) { abstract_value param_values[] = { @@ -235,7 +246,7 @@ xen_host_cpu_get_modelname(xen_session *session, char **result, xen_host_cpu hos abstract_type result_type = abstract_type_string; *result = NULL; - XEN_CALL_("host_cpu.get_modelname"); + XEN_CALL_("host_cpu.get_flags"); return session->ok; } |