diff options
author | Ewan Mellor <ewan@xensource.com> | 2007-03-17 23:55:03 +0000 |
---|---|---|
committer | Ewan Mellor <ewan@xensource.com> | 2007-03-17 23:55:03 +0000 |
commit | 98321440ec5681052fc4cadfaed5471b01cfd451 (patch) | |
tree | 2781b355ce6569d1341c74dc33f3650369fd2501 /tools/libxen/src | |
parent | 716d0617c936b721deb6fc2212add0acca58af32 (diff) | |
download | xen-98321440ec5681052fc4cadfaed5471b01cfd451.tar.gz xen-98321440ec5681052fc4cadfaed5471b01cfd451.tar.bz2 xen-98321440ec5681052fc4cadfaed5471b01cfd451.zip |
Replace VDI.location with a more generic VDI.other_config map. Remove
VDI.sector_size.
Xend work by Tom Wilkie <tom.wilkie@gmail.com>.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/libxen/src')
-rw-r--r-- | tools/libxen/src/xen_vbd.c | 3 | ||||
-rw-r--r-- | tools/libxen/src/xen_vdi.c | 90 |
2 files changed, 70 insertions, 23 deletions
diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c index 300f1d857d..893bf70958 100644 --- a/tools/libxen/src/xen_vbd.c +++ b/tools/libxen/src/xen_vbd.c @@ -54,9 +54,6 @@ static const struct_member xen_vbd_record_struct_members[] = { .key = "device", .type = &abstract_type_string, .offset = offsetof(xen_vbd_record, device) }, - { .key = "image", - .type = &abstract_type_string, - .offset = offsetof(xen_vbd_record, image) }, { .key = "bootable", .type = &abstract_type_bool, .offset = offsetof(xen_vbd_record, bootable) }, diff --git a/tools/libxen/src/xen_vdi.c b/tools/libxen/src/xen_vdi.c index 2e50db9e80..10f3fc4066 100644 --- a/tools/libxen/src/xen_vdi.c +++ b/tools/libxen/src/xen_vdi.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 @@ -24,6 +24,7 @@ #include "xen_crashdump.h" #include "xen_internal.h" #include "xen_sr.h" +#include "xen_string_string_map.h" #include "xen_vbd.h" #include "xen_vdi.h" #include "xen_vdi_type_internal.h" @@ -64,12 +65,6 @@ static const struct_member xen_vdi_record_struct_members[] = { .key = "physical_utilisation", .type = &abstract_type_int, .offset = offsetof(xen_vdi_record, physical_utilisation) }, - { .key = "sector_size", - .type = &abstract_type_int, - .offset = offsetof(xen_vdi_record, sector_size) }, - { .key = "location", - .type = &abstract_type_string, - .offset = offsetof(xen_vdi_record, location) }, { .key = "type", .type = &xen_vdi_type_abstract_type_, .offset = offsetof(xen_vdi_record, type) }, @@ -78,7 +73,10 @@ static const struct_member xen_vdi_record_struct_members[] = .offset = offsetof(xen_vdi_record, sharable) }, { .key = "read_only", .type = &abstract_type_bool, - .offset = offsetof(xen_vdi_record, read_only) } + .offset = offsetof(xen_vdi_record, read_only) }, + { .key = "other_config", + .type = &abstract_type_string_string_map, + .offset = offsetof(xen_vdi_record, other_config) } }; const abstract_type xen_vdi_record_abstract_type_ = @@ -105,6 +103,7 @@ xen_vdi_record_free(xen_vdi_record *record) xen_sr_record_opt_free(record->sr); xen_vbd_record_opt_set_free(record->vbds); xen_crashdump_record_opt_set_free(record->crash_dumps); + xen_string_string_map_free(record->other_config); free(record); } @@ -315,7 +314,7 @@ xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi bool -xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi) +xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi) { abstract_value param_values[] = { @@ -323,15 +322,14 @@ xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi) .u.string_val = vdi } }; - abstract_type result_type = abstract_type_int; - - XEN_CALL_("VDI.get_sector_size"); + abstract_type result_type = xen_vdi_type_abstract_type_; + XEN_CALL_("VDI.get_type"); return session->ok; } bool -xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi) +xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi) { abstract_value param_values[] = { @@ -339,14 +337,15 @@ xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi) .u.string_val = vdi } }; - abstract_type result_type = xen_vdi_type_abstract_type_; - XEN_CALL_("VDI.get_type"); + abstract_type result_type = abstract_type_bool; + + XEN_CALL_("VDI.get_sharable"); return session->ok; } bool -xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi) +xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi) { abstract_value param_values[] = { @@ -356,13 +355,13 @@ xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi) abstract_type result_type = abstract_type_bool; - XEN_CALL_("VDI.get_sharable"); + XEN_CALL_("VDI.get_read_only"); return session->ok; } bool -xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi) +xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi) { abstract_value param_values[] = { @@ -370,9 +369,10 @@ xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi) .u.string_val = vdi } }; - abstract_type result_type = abstract_type_bool; + abstract_type result_type = abstract_type_string_string_map; - XEN_CALL_("VDI.get_read_only"); + *result = NULL; + XEN_CALL_("VDI.get_other_config"); return session->ok; } @@ -458,6 +458,56 @@ xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only) bool +xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vdi }, + { .type = &abstract_type_string_string_map, + .u.set_val = (arbitrary_set *)other_config } + }; + + xen_call_(session, "VDI.set_other_config", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vdi }, + { .type = &abstract_type_string, + .u.string_val = key }, + { .type = &abstract_type_string, + .u.string_val = value } + }; + + xen_call_(session, "VDI.add_to_other_config", param_values, 3, NULL, NULL); + return session->ok; +} + + +bool +xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vdi }, + { .type = &abstract_type_string, + .u.string_val = key } + }; + + xen_call_(session, "VDI.remove_from_other_config", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool xen_vdi_snapshot(xen_session *session, xen_vdi *result, xen_vdi vdi) { abstract_value param_values[] = |