# HG changeset patch # User Ewan Mellor # Date 1170029140 0 # Node ID bb15af2c2b4a52ef8a3ce9646507b956e6eae322 # Parent 9db1847845d695f28cf59010fd7c0837811a8e1d Remove VBD.driver, VIF.type, VIF.name, VTPM.driver. This modelling was never correct, and the values are best left implicit. Signed-off-by: Ewan Mellor Index: xen-3.0.4-testing/docs/xen-api/xenapi-datamodel.tex =================================================================== --- xen-3.0.4-testing.orig/docs/xen-api/xenapi-datamodel.tex +++ xen-3.0.4-testing/docs/xen-api/xenapi-datamodel.tex @@ -274,16 +274,6 @@ The following enumeration types are used \end{longtable} \vspace{1cm} -\begin{longtable}{|ll|} -\hline -{\tt enum driver\_type} & \\ -\hline -\hspace{0.5cm}{\tt ioemu} & use hardware emulation \\ -\hspace{0.5cm}{\tt paravirtualised} & use paravirtualised driver \\ -\hline -\end{longtable} - -\vspace{1cm} \newpage \section{Class: session} @@ -5950,8 +5940,6 @@ references to objects with match names Quals & Field & Type & Description \\ \hline $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ -$\mathit{RW}$ & {\tt name} & string & human-readable name of the interface \\ -$\mathit{RW}$ & {\tt type} & driver\_type & interface type \\ $\mathit{RW}$ & {\tt device} & string & name of network device as exposed to guest e.g. eth0 \\ $\mathit{RW}$ & {\tt network} & network ref & virtual network to which this vif is connected \\ $\mathit{RW}$ & {\tt VM} & VM ref & virtual machine to which this vif is connected \\ @@ -6060,72 +6048,6 @@ void \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~get\_type} - -{\bf Overview:} -Get the type field of the given VIF. - - \noindent {\bf Signature:} -\begin{verbatim} (driver_type) get_type (session_id s, VIF ref self)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt VIF ref } & self & reference to the object \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - \noindent {\bf Return Type:} -{\tt -driver\_type -} - - -value of the field -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} -\subsubsection{RPC name:~set\_type} - -{\bf Overview:} -Set the type field of the given VIF. - - \noindent {\bf Signature:} -\begin{verbatim} void set_type (session_id s, VIF ref self, driver_type value)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt VIF ref } & self & reference to the object \\ \hline - -{\tt driver\_type } & value & New value to set \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - \noindent {\bf Return Type:} -{\tt -void -} - - - -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} \subsubsection{RPC name:~get\_device} {\bf Overview:} @@ -8782,7 +8704,6 @@ $\mathit{RW}$ & {\tt VDI} & VDI ref & t $\mathit{RW}$ & {\tt device} & string & device seen by the guest e.g. hda1 \\ $\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the disk should be mounted with \\ $\mathit{RW}$ & {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\ -$\mathit{RW}$ & {\tt driver} & driver\_type & the style of driver \\ $\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\ $\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\ \hline @@ -9184,72 +9105,6 @@ void \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~get\_driver} - -{\bf Overview:} -Get the driver field of the given VBD. - - \noindent {\bf Signature:} -\begin{verbatim} (driver_type) get_driver (session_id s, VBD ref self)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt VBD ref } & self & reference to the object \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - \noindent {\bf Return Type:} -{\tt -driver\_type -} - - -value of the field -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} -\subsubsection{RPC name:~set\_driver} - -{\bf Overview:} -Set the driver field of the given VBD. - - \noindent {\bf Signature:} -\begin{verbatim} void set_driver (session_id s, VBD ref self, driver_type value)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt VBD ref } & self & reference to the object \\ \hline - -{\tt driver\_type } & value & New value to set \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - \noindent {\bf Return Type:} -{\tt -void -} - - - -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} \subsubsection{RPC name:~get\_io\_read\_kbs} {\bf Overview:} @@ -9457,7 +9312,6 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ $\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\ $\mathit{RO}_\mathit{ins}$ & {\tt backend} & VM ref & the domain where the backend is located \\ -$\mathit{RO}_\mathit{ins}$ & {\tt driver} & driver\_type & the style of driver \\ $\mathit{RO}_\mathit{ins}$ & {\tt instance} & int & the instance number the virtual TPM represents \\ \hline \end{longtable} @@ -9558,38 +9412,6 @@ value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} -\subsubsection{RPC name:~get\_driver} - -{\bf Overview:} -Get the driver field of the given VTPM. - - \noindent {\bf Signature:} -\begin{verbatim} (driver_type) get_driver (session_id s, VTPM ref self)\end{verbatim} - - -\noindent{\bf Arguments:} - - -\vspace{0.3cm} -\begin{tabular}{|c|c|p{7cm}|} - \hline -{\bf type} & {\bf name} & {\bf description} \\ \hline -{\tt VTPM ref } & self & reference to the object \\ \hline - -\end{tabular} - -\vspace{0.3cm} - - \noindent {\bf Return Type:} -{\tt -driver\_type -} - - -value of the field -\vspace{0.3cm} -\vspace{0.3cm} -\vspace{0.3cm} \subsubsection{RPC name:~get\_instance} {\bf Overview:} Index: xen-3.0.4-testing/tools/libxen/include/xen_vbd.h =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/include/xen_vbd.h +++ xen-3.0.4-testing/tools/libxen/include/xen_vbd.h @@ -20,7 +20,6 @@ #define XEN_VBD_H #include "xen_common.h" -#include "xen_driver_type.h" #include "xen_vbd_decl.h" #include "xen_vbd_mode.h" #include "xen_vdi_decl.h" @@ -28,8 +27,8 @@ /* - * The VBD class. - * + * The VBD class. + * * A virtual block device. */ @@ -71,7 +70,6 @@ typedef struct xen_vbd_record char *device; char *image; enum xen_vbd_mode mode; - enum xen_driver_type driver; double io_read_kbs; double io_write_kbs; } xen_vbd_record; @@ -219,13 +217,6 @@ xen_vbd_get_mode(xen_session *session, e /** - * Get the driver field of the given VBD. - */ -extern bool -xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd); - - -/** * Get the io/read_kbs field of the given VBD. */ extern bool @@ -268,13 +259,6 @@ xen_vbd_set_mode(xen_session *session, x /** - * Set the driver field of the given VBD. - */ -extern bool -xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver); - - -/** * Change the media in the device for CDROM-like devices only. For * other devices, detach the VBD and attach a new one */ Index: xen-3.0.4-testing/tools/libxen/include/xen_vif.h =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/include/xen_vif.h +++ xen-3.0.4-testing/tools/libxen/include/xen_vif.h @@ -20,15 +20,14 @@ #define XEN_VIF_H #include "xen_common.h" -#include "xen_driver_type.h" #include "xen_network_decl.h" #include "xen_vif_decl.h" #include "xen_vm_decl.h" /* - * The VIF class. - * + * The VIF class. + * * A virtual network interface. */ @@ -65,8 +64,6 @@ typedef struct xen_vif_record { xen_vif handle; char *uuid; - char *name; - enum xen_driver_type type; char *device; struct xen_network_record_opt *network; struct xen_vm_record_opt *vm; @@ -191,20 +188,6 @@ xen_vif_get_uuid(xen_session *session, c /** - * Get the name field of the given VIF. - */ -extern bool -xen_vif_get_name(xen_session *session, char **result, xen_vif vif); - - -/** - * Get the type field of the given VIF. - */ -extern bool -xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif); - - -/** * Get the device field of the given VIF. */ extern bool @@ -254,20 +237,6 @@ xen_vif_get_io_write_kbs(xen_session *se /** - * Set the name field of the given VIF. - */ -extern bool -xen_vif_set_name(xen_session *session, xen_vif vif, char *name); - - -/** - * Set the type field of the given VIF. - */ -extern bool -xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type); - - -/** * Set the device field of the given VIF. */ extern bool Index: xen-3.0.4-testing/tools/libxen/include/xen_vtpm.h =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/include/xen_vtpm.h +++ xen-3.0.4-testing/tools/libxen/include/xen_vtpm.h @@ -21,7 +21,6 @@ #define XEN_VTPM_H #include "xen_common.h" -#include "xen_driver_type.h" #include "xen_vm_decl.h" #include "xen_vtpm_decl.h" @@ -67,7 +66,6 @@ typedef struct xen_vtpm_record char *uuid; struct xen_vm_record_opt *vm; struct xen_vm_record_opt *backend; - enum xen_driver_type driver; int64_t instance; } xen_vtpm_record; @@ -200,13 +198,6 @@ 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 Index: xen-3.0.4-testing/tools/libxen/src/xen_vbd.c =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/src/xen_vbd.c +++ xen-3.0.4-testing/tools/libxen/src/xen_vbd.c @@ -21,7 +21,6 @@ #include #include "xen_common.h" -#include "xen_driver_type_internal.h" #include "xen_internal.h" #include "xen_vbd.h" #include "xen_vbd_mode_internal.h" @@ -58,9 +57,6 @@ static const struct_member xen_vbd_recor { .key = "mode", .type = &xen_vbd_mode_abstract_type_, .offset = offsetof(xen_vbd_record, mode) }, - { .key = "driver", - .type = &xen_driver_type_abstract_type_, - .offset = offsetof(xen_vbd_record, driver) }, { .key = "io_read_kbs", .type = &abstract_type_float, .offset = offsetof(xen_vbd_record, io_read_kbs) }, @@ -235,23 +231,6 @@ xen_vbd_get_mode(xen_session *session, e bool -xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vbd } - }; - - abstract_type result_type = xen_driver_type_abstract_type_; - char *result_str = NULL; - XEN_CALL_("VBD.get_driver"); - *result = xen_driver_type_from_string(session, result_str); - return session->ok; -} - - -bool xen_vbd_get_io_read_kbs(xen_session *session, double *result, xen_vbd vbd) { abstract_value param_values[] = @@ -348,22 +327,6 @@ xen_vbd_set_mode(xen_session *session, x bool -xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vbd }, - { .type = &xen_driver_type_abstract_type_, - .u.string_val = xen_driver_type_to_string(driver) } - }; - - xen_call_(session, "VBD.set_driver", param_values, 2, NULL, NULL); - return session->ok; -} - - -bool xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi) { abstract_value param_values[] = Index: xen-3.0.4-testing/tools/libxen/src/xen_vif.c =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/src/xen_vif.c +++ xen-3.0.4-testing/tools/libxen/src/xen_vif.c @@ -21,7 +21,6 @@ #include #include "xen_common.h" -#include "xen_driver_type_internal.h" #include "xen_internal.h" #include "xen_network.h" #include "xen_vif.h" @@ -42,12 +41,6 @@ static const struct_member xen_vif_recor { .key = "uuid", .type = &abstract_type_string, .offset = offsetof(xen_vif_record, uuid) }, - { .key = "name", - .type = &abstract_type_string, - .offset = offsetof(xen_vif_record, name) }, - { .key = "type", - .type = &xen_driver_type_abstract_type_, - .offset = offsetof(xen_vif_record, type) }, { .key = "device", .type = &abstract_type_string, .offset = offsetof(xen_vif_record, device) }, @@ -90,7 +83,6 @@ xen_vif_record_free(xen_vif_record *reco } free(record->handle); free(record->uuid); - free(record->name); free(record->device); xen_network_record_opt_free(record->network); xen_vm_record_opt_free(record->vm); @@ -171,38 +163,6 @@ xen_vif_destroy(xen_session *session, xe bool -xen_vif_get_name(xen_session *session, char **result, xen_vif vif) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vif } - }; - - abstract_type result_type = abstract_type_string; - - *result = NULL; - XEN_CALL_("VIF.get_name"); - return session->ok; -} - - -bool -xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vif } - }; - - abstract_type result_type = xen_driver_type_abstract_type_; - XEN_CALL_("VIF.get_type"); - return session->ok; -} - - -bool xen_vif_get_device(xen_session *session, char **result, xen_vif vif) { abstract_value param_values[] = @@ -319,38 +279,6 @@ xen_vif_get_io_write_kbs(xen_session *se bool -xen_vif_set_name(xen_session *session, xen_vif vif, char *name) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vif }, - { .type = &abstract_type_string, - .u.string_val = name } - }; - - xen_call_(session, "VIF.set_name", param_values, 2, NULL, NULL); - return session->ok; -} - - -bool -xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type) -{ - abstract_value param_values[] = - { - { .type = &abstract_type_string, - .u.string_val = vif }, - { .type = &xen_driver_type_abstract_type_, - .u.string_val = xen_driver_type_to_string(type) } - }; - - xen_call_(session, "VIF.set_type", param_values, 2, NULL, NULL); - return session->ok; -} - - -bool xen_vif_set_device(xen_session *session, xen_vif vif, char *device) { abstract_value param_values[] = Index: xen-3.0.4-testing/tools/libxen/src/xen_vtpm.c =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/src/xen_vtpm.c +++ xen-3.0.4-testing/tools/libxen/src/xen_vtpm.c @@ -22,7 +22,6 @@ #include #include "xen_common.h" -#include "xen_driver_type_internal.h" #include "xen_internal.h" #include "xen_vm.h" #include "xen_vtpm.h" @@ -48,9 +47,6 @@ static const struct_member xen_vtpm_reco { .key = "backend", .type = &abstract_type_ref, .offset = offsetof(xen_vtpm_record, backend) }, - { .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) } @@ -187,21 +183,6 @@ xen_vtpm_get_backend(xen_session *sessio bool -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_; - XEN_CALL_("VTPM.get_driver"); - return session->ok; -} - - -bool xen_vtpm_get_instance(xen_session *session, int64_t *result, xen_vtpm vtpm) { abstract_value param_values[] = Index: xen-3.0.4-testing/tools/libxen/test/test_bindings.c =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/test/test_bindings.c +++ xen-3.0.4-testing/tools/libxen/test/test_bindings.c @@ -382,8 +382,7 @@ static xen_vm create_new_vm(xen_session .vm = &vm_record_opt, .vdi = &vdi0_record_opt, .device = "xvda1", - .mode = XEN_VBD_MODE_RW, - .driver = XEN_DRIVER_TYPE_PARAVIRTUALISED + .mode = XEN_VBD_MODE_RW }; xen_vbd vbd0; Index: xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py =================================================================== --- xen-3.0.4-testing.orig/tools/python/xen/xend/XendAPI.py +++ xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py @@ -1067,8 +1067,7 @@ class XendAPI: 'VDI', 'device', 'mode', - 'type', - 'driver'] + 'type'] VBD_attr_inst = VBD_attr_rw + ['image'] @@ -1150,10 +1149,6 @@ class XendAPI: xendom = XendDomain.instance() return xen_api_success(xendom.get_dev_property('vbd', vbd_ref, 'mode')) - def VBD_get_driver(self, session, vbd_ref): - xendom = XendDomain.instance() - return xen_api_success(xendom.get_dev_property('vbd', vbd_ref, - 'driver')) def VBD_get_type(self, session, vbd_ref): xendom = XendDomain.instance() @@ -1177,9 +1172,7 @@ class XendAPI: VIF_attr_ro = ['io_read_kbs', 'io_write_kbs'] - VIF_attr_rw = ['name', - 'type', - 'device', + VIF_attr_rw = ['device', 'network', 'VM', 'MAC', @@ -1237,10 +1230,6 @@ class XendAPI: vm = xendom.get_vm_with_dev_uuid('vif', vif_ref) return xen_api_success(vm.get_uuid()) - def VIF_get_name(self, session, vif_ref): - xendom = XendDomain.instance() - return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref, - 'name')) def VIF_get_MTU(self, session, vif_ref): xendom = XendDomain.instance() return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref, @@ -1250,17 +1239,10 @@ class XendAPI: return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref, 'MAC')) - def VIF_get_type(self, session, vif_ref): - xendom = XendDomain.instance() - return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref, - 'type')) - - def VIF_get_device(self, session, vif_ref): xendom = XendDomain.instance() return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref, 'device')) - def VIF_get_io_read_kbs(self, session, vif_ref): return xen_api_todo() @@ -1434,8 +1416,7 @@ class XendAPI: VTPM_attr_rw = [ ] VTPM_attr_ro = ['VM', 'backend', - 'instance', - 'driver'] + 'instance'] VTPM_attr_inst = VTPM_attr_rw @@ -1471,20 +1452,6 @@ class XendAPI: instance = -1 return xen_api_success(instance) - def VTPM_get_driver(self, session, vtpm_ref): - xendom = XendDomain.instance() - vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref) - if not vm: - return xen_api_error(XEND_ERROR_VTPM_INVALID) - cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref) - if not cfg: - return xen_api_error(XEND_ERROR_VTPM_INVALID) - if cfg.has_key('type'): - driver = cfg['type'] - else: - driver = "Unknown" - return xen_api_success(driver) - def VTPM_get_backend(self, session, vtpm_ref): xendom = XendDomain.instance() vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref) Index: xen-3.0.4-testing/tools/libxen/include/xen_driver_type.h =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/include/xen_driver_type.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2006, XenSource Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef XEN_DRIVER_TYPE_H -#define XEN_DRIVER_TYPE_H - - -#include "xen_common.h" - - -enum xen_driver_type -{ - /** - * use hardware emulation - */ - XEN_DRIVER_TYPE_IOEMU, - - /** - * use paravirtualised driver - */ - XEN_DRIVER_TYPE_PARAVIRTUALISED -}; - - -typedef struct xen_driver_type_set -{ - size_t size; - enum xen_driver_type contents[]; -} xen_driver_type_set; - -/** - * Allocate a xen_driver_type_set of the given size. - */ -extern xen_driver_type_set * -xen_driver_type_set_alloc(size_t size); - -/** - * Free the given xen_driver_type_set. The given set must have been - * allocated by this library. - */ -extern void -xen_driver_type_set_free(xen_driver_type_set *set); - - -/** - * Return the name corresponding to the given code. This string must - * not be modified or freed. - */ -extern const char * -xen_driver_type_to_string(enum xen_driver_type val); - - -/** - * Return the correct code for the given string, or set the session - * object to failure and return an undefined value if the given string does - * not match a known code. - */ -extern enum xen_driver_type -xen_driver_type_from_string(xen_session *session, const char *str); - - -#endif Index: xen-3.0.4-testing/tools/libxen/include/xen_driver_type_internal.h =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/include/xen_driver_type_internal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2006, XenSource Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -/* - * Declarations of the abstract types used during demarshalling of enum - * xen_driver_type. Internal to this library -- do not use from outside. - */ - - -#ifndef XEN_DRIVER_TYPE_INTERNAL_H -#define XEN_DRIVER_TYPE_INTERNAL_H - - -#include "xen_internal.h" - - -extern const abstract_type xen_driver_type_abstract_type_; -extern const abstract_type xen_driver_type_set_abstract_type_; - - -#endif Index: xen-3.0.4-testing/tools/libxen/src/xen_driver_type.c =================================================================== --- xen-3.0.4-testing.orig/tools/libxen/src/xen_driver_type.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2006, XenSource Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -#include "xen_internal.h" -#include "xen_driver_type.h" -#include "xen_driver_type_internal.h" - - -/* - * Maintain this in the same order as the enum declaration! - */ -static const char *lookup_table[] = -{ - "ioemu", - "paravirtualised" -}; - - -extern xen_driver_type_set * -xen_driver_type_set_alloc(size_t size) -{ - return calloc(1, sizeof(xen_driver_type_set) + - size * sizeof(enum xen_driver_type)); -} - - -extern void -xen_driver_type_set_free(xen_driver_type_set *set) -{ - free(set); -} - - -const char * -xen_driver_type_to_string(enum xen_driver_type val) -{ - return lookup_table[val]; -} - - -extern enum xen_driver_type -xen_driver_type_from_string(xen_session *session, const char *str) -{ - return ENUM_LOOKUP(session, str, lookup_table); -} - - -const abstract_type xen_driver_type_abstract_type_ = - { - .typename = ENUM, - .enum_marshaller = - (const char *(*)(int))&xen_driver_type_to_string, - .enum_demarshaller = - (int (*)(xen_session *, const char *))&xen_driver_type_from_string - }; - - -const abstract_type xen_driver_type_set_abstract_type_ = - { - .typename = SET, - .child = &xen_driver_type_abstract_type_ - }; - -