direct-io.hg

changeset 12153:8f090c551b09

Implement new PIF-based network model, and match movement of I/O-statistics.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Thu Oct 26 15:59:51 2006 +0100 (2006-10-26)
parents de31d79add5e
children d0d6f230f1d4
files tools/libxen/include/xen_host.h tools/libxen/include/xen_network.h tools/libxen/include/xen_pif.h tools/libxen/include/xen_pif_decl.h tools/libxen/include/xen_vbd.h tools/libxen/include/xen_vif.h tools/libxen/src/xen_host.c tools/libxen/src/xen_network.c tools/libxen/src/xen_pif.c tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vif.c
line diff
     1.1 --- a/tools/libxen/include/xen_host.h	Thu Oct 26 15:57:29 2006 +0100
     1.2 +++ b/tools/libxen/include/xen_host.h	Thu Oct 26 15:59:51 2006 +0100
     1.3 @@ -22,6 +22,7 @@
     1.4  #include "xen_common.h"
     1.5  #include "xen_host_cpu_decl.h"
     1.6  #include "xen_host_decl.h"
     1.7 +#include "xen_pif_decl.h"
     1.8  #include "xen_string_string_map.h"
     1.9  #include "xen_vm_decl.h"
    1.10  
    1.11 @@ -69,6 +70,7 @@ typedef struct xen_host_record
    1.12      char *name_description;
    1.13      xen_string_string_map *software_version;
    1.14      struct xen_vm_record_opt_set *resident_vms;
    1.15 +    struct xen_pif_record_opt_set *pifs;
    1.16      struct xen_host_cpu_record_opt_set *host_cpus;
    1.17  } xen_host_record;
    1.18  
    1.19 @@ -215,6 +217,13 @@ xen_host_get_resident_vms(xen_session *s
    1.20  
    1.21  
    1.22  /**
    1.23 + * Get the PIFs field of the given host.
    1.24 + */
    1.25 +extern bool
    1.26 +xen_host_get_pifs(xen_session *session, xen_pif *result, xen_host host);
    1.27 +
    1.28 +
    1.29 +/**
    1.30   * Get the host_CPUs field of the given host.
    1.31   */
    1.32  extern bool
     2.1 --- a/tools/libxen/include/xen_network.h	Thu Oct 26 15:57:29 2006 +0100
     2.2 +++ b/tools/libxen/include/xen_network.h	Thu Oct 26 15:59:51 2006 +0100
     2.3 @@ -21,6 +21,7 @@
     2.4  
     2.5  #include "xen_common.h"
     2.6  #include "xen_network_decl.h"
     2.7 +#include "xen_pif_decl.h"
     2.8  #include "xen_vif_decl.h"
     2.9  
    2.10  
    2.11 @@ -66,8 +67,7 @@ typedef struct xen_network_record
    2.12      char *name_label;
    2.13      char *name_description;
    2.14      struct xen_vif_record_opt_set *vifs;
    2.15 -    char *nic;
    2.16 -    char *vlan;
    2.17 +    struct xen_pif_record_opt_set *pifs;
    2.18      char *default_gateway;
    2.19      char *default_netmask;
    2.20  } xen_network_record;
    2.21 @@ -208,17 +208,10 @@ xen_network_get_vifs(xen_session *sessio
    2.22  
    2.23  
    2.24  /**
    2.25 - * Get the NIC field of the given network.
    2.26 + * Get the PIFs field of the given network.
    2.27   */
    2.28  extern bool
    2.29 -xen_network_get_nic(xen_session *session, char **result, xen_network network);
    2.30 -
    2.31 -
    2.32 -/**
    2.33 - * Get the VLAN field of the given network.
    2.34 - */
    2.35 -extern bool
    2.36 -xen_network_get_vlan(xen_session *session, char **result, xen_network network);
    2.37 +xen_network_get_pifs(xen_session *session, xen_pif *result, xen_network network);
    2.38  
    2.39  
    2.40  /**
    2.41 @@ -250,20 +243,6 @@ xen_network_set_name_description(xen_ses
    2.42  
    2.43  
    2.44  /**
    2.45 - * Set the NIC field of the given network.
    2.46 - */
    2.47 -extern bool
    2.48 -xen_network_set_nic(xen_session *session, xen_network xen_network, char *nic);
    2.49 -
    2.50 -
    2.51 -/**
    2.52 - * Set the VLAN field of the given network.
    2.53 - */
    2.54 -extern bool
    2.55 -xen_network_set_vlan(xen_session *session, xen_network xen_network, char *vlan);
    2.56 -
    2.57 -
    2.58 -/**
    2.59   * Set the default_gateway field of the given network.
    2.60   */
    2.61  extern bool
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/libxen/include/xen_pif.h	Thu Oct 26 15:59:51 2006 +0100
     3.3 @@ -0,0 +1,283 @@
     3.4 +/*
     3.5 + * Copyright (c) 2006, XenSource Inc.
     3.6 + *
     3.7 + * This library is free software; you can redistribute it and/or
     3.8 + * modify it under the terms of the GNU Lesser General Public
     3.9 + * License as published by the Free Software Foundation; either
    3.10 + * version 2.1 of the License, or (at your option) any later version.
    3.11 + *
    3.12 + * This library is distributed in the hope that it will be useful,
    3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    3.15 + * Lesser General Public License for more details.
    3.16 + *
    3.17 + * You should have received a copy of the GNU Lesser General Public
    3.18 + * License along with this library; if not, write to the Free Software
    3.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    3.20 + */
    3.21 +
    3.22 +#ifndef XEN_PIF_H
    3.23 +#define XEN_PIF_H
    3.24 +
    3.25 +#include "xen_common.h"
    3.26 +#include "xen_host_decl.h"
    3.27 +#include "xen_network_decl.h"
    3.28 +#include "xen_pif_decl.h"
    3.29 +
    3.30 +
    3.31 +/*
    3.32 + * The PIF class. 
    3.33 + *  
    3.34 + * A physical network interface (note separate VLANs are represented as
    3.35 + * several PIFs).
    3.36 + */
    3.37 +
    3.38 +
    3.39 +/**
    3.40 + * Free the given xen_pif.  The given handle must have been allocated
    3.41 + * by this library.
    3.42 + */
    3.43 +extern void
    3.44 +xen_pif_free(xen_pif pif);
    3.45 +
    3.46 +
    3.47 +typedef struct xen_pif_set
    3.48 +{
    3.49 +    size_t size;
    3.50 +    xen_pif *contents[];
    3.51 +} xen_pif_set;
    3.52 +
    3.53 +/**
    3.54 + * Allocate a xen_pif_set of the given size.
    3.55 + */
    3.56 +extern xen_pif_set *
    3.57 +xen_pif_set_alloc(size_t size);
    3.58 +
    3.59 +/**
    3.60 + * Free the given xen_pif_set.  The given set must have been allocated
    3.61 + * by this library.
    3.62 + */
    3.63 +extern void
    3.64 +xen_pif_set_free(xen_pif_set *set);
    3.65 +
    3.66 +
    3.67 +typedef struct xen_pif_record
    3.68 +{
    3.69 +    xen_pif handle;
    3.70 +    char *uuid;
    3.71 +    char *name;
    3.72 +    struct xen_network_record_opt *network;
    3.73 +    struct xen_host_record_opt *host;
    3.74 +    char *mac;
    3.75 +    uint64_t mtu;
    3.76 +    char *vlan;
    3.77 +    double io_read_kbs;
    3.78 +    double io_write_kbs;
    3.79 +} xen_pif_record;
    3.80 +
    3.81 +/**
    3.82 + * Allocate a xen_pif_record.
    3.83 + */
    3.84 +extern xen_pif_record *
    3.85 +xen_pif_record_alloc(void);
    3.86 +
    3.87 +/**
    3.88 + * Free the given xen_pif_record, and all referenced values.  The given
    3.89 + * record must have been allocated by this library.
    3.90 + */
    3.91 +extern void
    3.92 +xen_pif_record_free(xen_pif_record *record);
    3.93 +
    3.94 +
    3.95 +typedef struct xen_pif_record_opt
    3.96 +{
    3.97 +    bool is_record;
    3.98 +    union
    3.99 +    {
   3.100 +        xen_pif handle;
   3.101 +        xen_pif_record *record;
   3.102 +    } u;
   3.103 +} xen_pif_record_opt;
   3.104 +
   3.105 +/**
   3.106 + * Allocate a xen_pif_record_opt.
   3.107 + */
   3.108 +extern xen_pif_record_opt *
   3.109 +xen_pif_record_opt_alloc(void);
   3.110 +
   3.111 +/**
   3.112 + * Free the given xen_pif_record_opt, and all referenced values.  The
   3.113 + * given record_opt must have been allocated by this library.
   3.114 + */
   3.115 +extern void
   3.116 +xen_pif_record_opt_free(xen_pif_record_opt *record_opt);
   3.117 +
   3.118 +
   3.119 +typedef struct xen_pif_record_set
   3.120 +{
   3.121 +    size_t size;
   3.122 +    xen_pif_record *contents[];
   3.123 +} xen_pif_record_set;
   3.124 +
   3.125 +/**
   3.126 + * Allocate a xen_pif_record_set of the given size.
   3.127 + */
   3.128 +extern xen_pif_record_set *
   3.129 +xen_pif_record_set_alloc(size_t size);
   3.130 +
   3.131 +/**
   3.132 + * Free the given xen_pif_record_set, and all referenced values.  The
   3.133 + * given set must have been allocated by this library.
   3.134 + */
   3.135 +extern void
   3.136 +xen_pif_record_set_free(xen_pif_record_set *set);
   3.137 +
   3.138 +
   3.139 +
   3.140 +typedef struct xen_pif_record_opt_set
   3.141 +{
   3.142 +    size_t size;
   3.143 +    xen_pif_record_opt *contents[];
   3.144 +} xen_pif_record_opt_set;
   3.145 +
   3.146 +/**
   3.147 + * Allocate a xen_pif_record_opt_set of the given size.
   3.148 + */
   3.149 +extern xen_pif_record_opt_set *
   3.150 +xen_pif_record_opt_set_alloc(size_t size);
   3.151 +
   3.152 +/**
   3.153 + * Free the given xen_pif_record_opt_set, and all referenced values. 
   3.154 + * The given set must have been allocated by this library.
   3.155 + */
   3.156 +extern void
   3.157 +xen_pif_record_opt_set_free(xen_pif_record_opt_set *set);
   3.158 +
   3.159 +
   3.160 +/**
   3.161 + * Get the current state of the given PIF.  !!!
   3.162 + */
   3.163 +extern bool
   3.164 +xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif);
   3.165 +
   3.166 +
   3.167 +/**
   3.168 + * Get a reference to the object with the specified UUID.  !!!
   3.169 + */
   3.170 +extern bool
   3.171 +xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid);
   3.172 +
   3.173 +
   3.174 +/**
   3.175 + * Create a new PIF instance, and return its handle.
   3.176 + */
   3.177 +extern bool
   3.178 +xen_pif_create(xen_session *session, xen_pif *result, xen_pif_record *record);
   3.179 +
   3.180 +
   3.181 +/**
   3.182 + * Get the uuid field of the given PIF.
   3.183 + */
   3.184 +extern bool
   3.185 +xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif);
   3.186 +
   3.187 +
   3.188 +/**
   3.189 + * Get the name field of the given PIF.
   3.190 + */
   3.191 +extern bool
   3.192 +xen_pif_get_name(xen_session *session, char **result, xen_pif pif);
   3.193 +
   3.194 +
   3.195 +/**
   3.196 + * Get the network field of the given PIF.
   3.197 + */
   3.198 +extern bool
   3.199 +xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif);
   3.200 +
   3.201 +
   3.202 +/**
   3.203 + * Get the host field of the given PIF.
   3.204 + */
   3.205 +extern bool
   3.206 +xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif);
   3.207 +
   3.208 +
   3.209 +/**
   3.210 + * Get the MAC field of the given PIF.
   3.211 + */
   3.212 +extern bool
   3.213 +xen_pif_get_mac(xen_session *session, char **result, xen_pif pif);
   3.214 +
   3.215 +
   3.216 +/**
   3.217 + * Get the MTU field of the given PIF.
   3.218 + */
   3.219 +extern bool
   3.220 +xen_pif_get_mtu(xen_session *session, uint64_t *result, xen_pif pif);
   3.221 +
   3.222 +
   3.223 +/**
   3.224 + * Get the VLAN field of the given PIF.
   3.225 + */
   3.226 +extern bool
   3.227 +xen_pif_get_vlan(xen_session *session, char **result, xen_pif pif);
   3.228 +
   3.229 +
   3.230 +/**
   3.231 + * Get the io/read_kbs field of the given PIF.
   3.232 + */
   3.233 +extern bool
   3.234 +xen_pif_get_io_read_kbs(xen_session *session, double *result, xen_pif pif);
   3.235 +
   3.236 +
   3.237 +/**
   3.238 + * Get the io/write_kbs field of the given PIF.
   3.239 + */
   3.240 +extern bool
   3.241 +xen_pif_get_io_write_kbs(xen_session *session, double *result, xen_pif pif);
   3.242 +
   3.243 +
   3.244 +/**
   3.245 + * Set the name field of the given PIF.
   3.246 + */
   3.247 +extern bool
   3.248 +xen_pif_set_name(xen_session *session, xen_pif xen_pif, char *name);
   3.249 +
   3.250 +
   3.251 +/**
   3.252 + * Set the network field of the given PIF.
   3.253 + */
   3.254 +extern bool
   3.255 +xen_pif_set_network(xen_session *session, xen_pif xen_pif, xen_network network);
   3.256 +
   3.257 +
   3.258 +/**
   3.259 + * Set the host field of the given PIF.
   3.260 + */
   3.261 +extern bool
   3.262 +xen_pif_set_host(xen_session *session, xen_pif xen_pif, xen_host host);
   3.263 +
   3.264 +
   3.265 +/**
   3.266 + * Set the MAC field of the given PIF.
   3.267 + */
   3.268 +extern bool
   3.269 +xen_pif_set_mac(xen_session *session, xen_pif xen_pif, char *mac);
   3.270 +
   3.271 +
   3.272 +/**
   3.273 + * Set the MTU field of the given PIF.
   3.274 + */
   3.275 +extern bool
   3.276 +xen_pif_set_mtu(xen_session *session, xen_pif xen_pif, uint64_t mtu);
   3.277 +
   3.278 +
   3.279 +/**
   3.280 + * Set the VLAN field of the given PIF.
   3.281 + */
   3.282 +extern bool
   3.283 +xen_pif_set_vlan(xen_session *session, xen_pif xen_pif, char *vlan);
   3.284 +
   3.285 +
   3.286 +#endif
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/libxen/include/xen_pif_decl.h	Thu Oct 26 15:59:51 2006 +0100
     4.3 @@ -0,0 +1,30 @@
     4.4 +/*
     4.5 + * Copyright (c) 2006, XenSource Inc.
     4.6 + *
     4.7 + * This library is free software; you can redistribute it and/or
     4.8 + * modify it under the terms of the GNU Lesser General Public
     4.9 + * License as published by the Free Software Foundation; either
    4.10 + * version 2.1 of the License, or (at your option) any later version.
    4.11 + *
    4.12 + * This library is distributed in the hope that it will be useful,
    4.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    4.15 + * Lesser General Public License for more details.
    4.16 + *
    4.17 + * You should have received a copy of the GNU Lesser General Public
    4.18 + * License along with this library; if not, write to the Free Software
    4.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    4.20 + */
    4.21 +
    4.22 +#ifndef XEN_PIF_DECL_H
    4.23 +#define XEN_PIF_DECL_H
    4.24 +
    4.25 +typedef void *xen_pif;
    4.26 +
    4.27 +struct xen_pif_set;
    4.28 +struct xen_pif_record;
    4.29 +struct xen_pif_record_set;
    4.30 +struct xen_pif_record_opt;
    4.31 +struct xen_pif_record_opt_set;
    4.32 +
    4.33 +#endif
     5.1 --- a/tools/libxen/include/xen_vbd.h	Thu Oct 26 15:57:29 2006 +0100
     5.2 +++ b/tools/libxen/include/xen_vbd.h	Thu Oct 26 15:59:51 2006 +0100
     5.3 @@ -71,8 +71,8 @@ typedef struct xen_vbd_record
     5.4      char *device;
     5.5      enum xen_vbd_mode mode;
     5.6      enum xen_driver_type driver;
     5.7 -    double io_bandwidth_incoming_kbs;
     5.8 -    double io_bandwidth_outgoing_kbs;
     5.9 +    double io_read_kbs;
    5.10 +    double io_write_kbs;
    5.11  } xen_vbd_record;
    5.12  
    5.13  /**
    5.14 @@ -218,17 +218,17 @@ xen_vbd_get_driver(xen_session *session,
    5.15  
    5.16  
    5.17  /**
    5.18 - * Get the IO_bandwidth/incoming_kbs field of the given VBD.
    5.19 + * Get the io/read_kbs field of the given VBD.
    5.20   */
    5.21  extern bool
    5.22 -xen_vbd_get_io_bandwidth_incoming_kbs(xen_session *session, double *result, xen_vbd vbd);
    5.23 +xen_vbd_get_io_read_kbs(xen_session *session, double *result, xen_vbd vbd);
    5.24  
    5.25  
    5.26  /**
    5.27 - * Get the IO_bandwidth/outgoing_kbs field of the given VBD.
    5.28 + * Get the io/write_kbs field of the given VBD.
    5.29   */
    5.30  extern bool
    5.31 -xen_vbd_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result, xen_vbd vbd);
    5.32 +xen_vbd_get_io_write_kbs(xen_session *session, double *result, xen_vbd vbd);
    5.33  
    5.34  
    5.35  /**
    5.36 @@ -266,4 +266,12 @@ extern bool
    5.37  xen_vbd_set_driver(xen_session *session, xen_vbd xen_vbd, enum xen_driver_type driver);
    5.38  
    5.39  
    5.40 +/**
    5.41 + * Change the media in the device for CDROM-like devices only. For
    5.42 + * other devices, detach the VBD and attach a new one
    5.43 + */
    5.44 +extern bool
    5.45 +xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi);
    5.46 +
    5.47 +
    5.48  #endif
     6.1 --- a/tools/libxen/include/xen_vif.h	Thu Oct 26 15:57:29 2006 +0100
     6.2 +++ b/tools/libxen/include/xen_vif.h	Thu Oct 26 15:59:51 2006 +0100
     6.3 @@ -72,10 +72,8 @@ typedef struct xen_vif_record
     6.4      struct xen_vm_record_opt *vm;
     6.5      char *mac;
     6.6      uint64_t mtu;
     6.7 -    double network_read_kbs;
     6.8 -    double network_write_kbs;
     6.9 -    double io_bandwidth_incoming_kbs;
    6.10 -    double io_bandwidth_outgoing_kbs;
    6.11 +    double io_read_kbs;
    6.12 +    double io_write_kbs;
    6.13  } xen_vif_record;
    6.14  
    6.15  /**
    6.16 @@ -235,31 +233,17 @@ xen_vif_get_mtu(xen_session *session, ui
    6.17  
    6.18  
    6.19  /**
    6.20 - * Get the network_read_kbs field of the given VIF.
    6.21 + * Get the io/read_kbs field of the given VIF.
    6.22   */
    6.23  extern bool
    6.24 -xen_vif_get_network_read_kbs(xen_session *session, double *result, xen_vif vif);
    6.25 +xen_vif_get_io_read_kbs(xen_session *session, double *result, xen_vif vif);
    6.26  
    6.27  
    6.28  /**
    6.29 - * Get the network_write_kbs field of the given VIF.
    6.30 + * Get the io/write_kbs field of the given VIF.
    6.31   */
    6.32  extern bool
    6.33 -xen_vif_get_network_write_kbs(xen_session *session, double *result, xen_vif vif);
    6.34 -
    6.35 -
    6.36 -/**
    6.37 - * Get the IO_bandwidth/incoming_kbs field of the given VIF.
    6.38 - */
    6.39 -extern bool
    6.40 -xen_vif_get_io_bandwidth_incoming_kbs(xen_session *session, double *result, xen_vif vif);
    6.41 -
    6.42 -
    6.43 -/**
    6.44 - * Get the IO_bandwidth/outgoing_kbs field of the given VIF.
    6.45 - */
    6.46 -extern bool
    6.47 -xen_vif_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result, xen_vif vif);
    6.48 +xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif);
    6.49  
    6.50  
    6.51  /**
     7.1 --- a/tools/libxen/src/xen_host.c	Thu Oct 26 15:57:29 2006 +0100
     7.2 +++ b/tools/libxen/src/xen_host.c	Thu Oct 26 15:59:51 2006 +0100
     7.3 @@ -24,6 +24,7 @@
     7.4  #include "xen_host.h"
     7.5  #include "xen_host_cpu.h"
     7.6  #include "xen_internal.h"
     7.7 +#include "xen_pif.h"
     7.8  #include "xen_string_string_map.h"
     7.9  #include "xen_vm.h"
    7.10  
    7.11 @@ -54,6 +55,9 @@ static const struct_member xen_host_reco
    7.12          { .key = "resident_vms",
    7.13            .type = &abstract_type_ref_set,
    7.14            .offset = offsetof(xen_host_record, resident_vms) },
    7.15 +        { .key = "pifs",
    7.16 +          .type = &abstract_type_ref_set,
    7.17 +          .offset = offsetof(xen_host_record, pifs) },
    7.18          { .key = "host_cpus",
    7.19            .type = &abstract_type_ref_set,
    7.20            .offset = offsetof(xen_host_record, host_cpus) }
    7.21 @@ -78,6 +82,7 @@ xen_host_record_free(xen_host_record *re
    7.22      free(record->name_description);
    7.23      xen_string_string_map_free(record->software_version);
    7.24      xen_vm_record_opt_set_free(record->resident_vms);
    7.25 +    xen_pif_record_opt_set_free(record->pifs);
    7.26      xen_host_cpu_record_opt_set_free(record->host_cpus);
    7.27      free(record);
    7.28  }
    7.29 @@ -226,6 +231,23 @@ xen_host_get_resident_vms(xen_session *s
    7.30  
    7.31  
    7.32  bool
    7.33 +xen_host_get_pifs(xen_session *session, xen_pif *result, xen_host host)
    7.34 +{
    7.35 +    abstract_value param_values[] =
    7.36 +        {
    7.37 +            { .type = &abstract_type_string,
    7.38 +              .u.string_val = host }
    7.39 +        };
    7.40 +
    7.41 +    abstract_type result_type = abstract_type_string_set;
    7.42 +
    7.43 +    *result = NULL;
    7.44 +    XEN_CALL_("host.get_pifs");
    7.45 +    return session->ok;
    7.46 +}
    7.47 +
    7.48 +
    7.49 +bool
    7.50  xen_host_get_host_cpus(xen_session *session, xen_host_cpu *result, xen_host host)
    7.51  {
    7.52      abstract_value param_values[] =
     8.1 --- a/tools/libxen/src/xen_network.c	Thu Oct 26 15:57:29 2006 +0100
     8.2 +++ b/tools/libxen/src/xen_network.c	Thu Oct 26 15:59:51 2006 +0100
     8.3 @@ -23,6 +23,7 @@
     8.4  #include "xen_common.h"
     8.5  #include "xen_internal.h"
     8.6  #include "xen_network.h"
     8.7 +#include "xen_pif.h"
     8.8  #include "xen_vif.h"
     8.9  
    8.10  
    8.11 @@ -49,12 +50,9 @@ static const struct_member xen_network_r
    8.12          { .key = "vifs",
    8.13            .type = &abstract_type_ref_set,
    8.14            .offset = offsetof(xen_network_record, vifs) },
    8.15 -        { .key = "nic",
    8.16 -          .type = &abstract_type_string,
    8.17 -          .offset = offsetof(xen_network_record, nic) },
    8.18 -        { .key = "vlan",
    8.19 -          .type = &abstract_type_string,
    8.20 -          .offset = offsetof(xen_network_record, vlan) },
    8.21 +        { .key = "pifs",
    8.22 +          .type = &abstract_type_ref_set,
    8.23 +          .offset = offsetof(xen_network_record, pifs) },
    8.24          { .key = "default_gateway",
    8.25            .type = &abstract_type_string,
    8.26            .offset = offsetof(xen_network_record, default_gateway) },
    8.27 @@ -81,8 +79,7 @@ xen_network_record_free(xen_network_reco
    8.28      free(record->name_label);
    8.29      free(record->name_description);
    8.30      xen_vif_record_opt_set_free(record->vifs);
    8.31 -    free(record->nic);
    8.32 -    free(record->vlan);
    8.33 +    xen_pif_record_opt_set_free(record->pifs);
    8.34      free(record->default_gateway);
    8.35      free(record->default_netmask);
    8.36      free(record);
    8.37 @@ -215,7 +212,7 @@ xen_network_get_vifs(xen_session *sessio
    8.38  
    8.39  
    8.40  bool
    8.41 -xen_network_get_nic(xen_session *session, char **result, xen_network network)
    8.42 +xen_network_get_pifs(xen_session *session, xen_pif *result, xen_network network)
    8.43  {
    8.44      abstract_value param_values[] =
    8.45          {
    8.46 @@ -223,27 +220,10 @@ xen_network_get_nic(xen_session *session
    8.47                .u.string_val = network }
    8.48          };
    8.49  
    8.50 -    abstract_type result_type = abstract_type_string;
    8.51 +    abstract_type result_type = abstract_type_string_set;
    8.52  
    8.53      *result = NULL;
    8.54 -    XEN_CALL_("network.get_nic");
    8.55 -    return session->ok;
    8.56 -}
    8.57 -
    8.58 -
    8.59 -bool
    8.60 -xen_network_get_vlan(xen_session *session, char **result, xen_network network)
    8.61 -{
    8.62 -    abstract_value param_values[] =
    8.63 -        {
    8.64 -            { .type = &abstract_type_string,
    8.65 -              .u.string_val = network }
    8.66 -        };
    8.67 -
    8.68 -    abstract_type result_type = abstract_type_string;
    8.69 -
    8.70 -    *result = NULL;
    8.71 -    XEN_CALL_("network.get_vlan");
    8.72 +    XEN_CALL_("network.get_pifs");
    8.73      return session->ok;
    8.74  }
    8.75  
    8.76 @@ -315,38 +295,6 @@ xen_network_set_name_description(xen_ses
    8.77  
    8.78  
    8.79  bool
    8.80 -xen_network_set_nic(xen_session *session, xen_network xen_network, char *nic)
    8.81 -{
    8.82 -    abstract_value param_values[] =
    8.83 -        {
    8.84 -            { .type = &abstract_type_string,
    8.85 -              .u.string_val = xen_network },
    8.86 -            { .type = &abstract_type_string,
    8.87 -              .u.string_val = nic }
    8.88 -        };
    8.89 -
    8.90 -    xen_call_(session, "network.set_nic", param_values, 2, NULL, NULL);
    8.91 -    return session->ok;
    8.92 -}
    8.93 -
    8.94 -
    8.95 -bool
    8.96 -xen_network_set_vlan(xen_session *session, xen_network xen_network, char *vlan)
    8.97 -{
    8.98 -    abstract_value param_values[] =
    8.99 -        {
   8.100 -            { .type = &abstract_type_string,
   8.101 -              .u.string_val = xen_network },
   8.102 -            { .type = &abstract_type_string,
   8.103 -              .u.string_val = vlan }
   8.104 -        };
   8.105 -
   8.106 -    xen_call_(session, "network.set_vlan", param_values, 2, NULL, NULL);
   8.107 -    return session->ok;
   8.108 -}
   8.109 -
   8.110 -
   8.111 -bool
   8.112  xen_network_set_default_gateway(xen_session *session, xen_network xen_network, char *default_gateway)
   8.113  {
   8.114      abstract_value param_values[] =
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/libxen/src/xen_pif.c	Thu Oct 26 15:59:51 2006 +0100
     9.3 @@ -0,0 +1,385 @@
     9.4 +/*
     9.5 + * Copyright (c) 2006, XenSource Inc.
     9.6 + *
     9.7 + * This library is free software; you can redistribute it and/or
     9.8 + * modify it under the terms of the GNU Lesser General Public
     9.9 + * License as published by the Free Software Foundation; either
    9.10 + * version 2.1 of the License, or (at your option) any later version.
    9.11 + *
    9.12 + * This library is distributed in the hope that it will be useful,
    9.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    9.15 + * Lesser General Public License for more details.
    9.16 + *
    9.17 + * You should have received a copy of the GNU Lesser General Public
    9.18 + * License along with this library; if not, write to the Free Software
    9.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    9.20 + */
    9.21 +
    9.22 +
    9.23 +#include <stddef.h>
    9.24 +#include <stdlib.h>
    9.25 +
    9.26 +#include "xen_common.h"
    9.27 +#include "xen_host.h"
    9.28 +#include "xen_internal.h"
    9.29 +#include "xen_network.h"
    9.30 +#include "xen_pif.h"
    9.31 +
    9.32 +
    9.33 +XEN_FREE(xen_pif)
    9.34 +XEN_SET_ALLOC_FREE(xen_pif)
    9.35 +XEN_ALLOC(xen_pif_record)
    9.36 +XEN_SET_ALLOC_FREE(xen_pif_record)
    9.37 +XEN_ALLOC(xen_pif_record_opt)
    9.38 +XEN_RECORD_OPT_FREE(xen_pif)
    9.39 +XEN_SET_ALLOC_FREE(xen_pif_record_opt)
    9.40 +
    9.41 +
    9.42 +static const struct_member xen_pif_record_struct_members[] =
    9.43 +    {
    9.44 +        { .key = "uuid",
    9.45 +          .type = &abstract_type_string,
    9.46 +          .offset = offsetof(xen_pif_record, uuid) },
    9.47 +        { .key = "name",
    9.48 +          .type = &abstract_type_string,
    9.49 +          .offset = offsetof(xen_pif_record, name) },
    9.50 +        { .key = "network",
    9.51 +          .type = &abstract_type_ref,
    9.52 +          .offset = offsetof(xen_pif_record, network) },
    9.53 +        { .key = "host",
    9.54 +          .type = &abstract_type_ref,
    9.55 +          .offset = offsetof(xen_pif_record, host) },
    9.56 +        { .key = "mac",
    9.57 +          .type = &abstract_type_string,
    9.58 +          .offset = offsetof(xen_pif_record, mac) },
    9.59 +        { .key = "mtu",
    9.60 +          .type = &abstract_type_int,
    9.61 +          .offset = offsetof(xen_pif_record, mtu) },
    9.62 +        { .key = "vlan",
    9.63 +          .type = &abstract_type_string,
    9.64 +          .offset = offsetof(xen_pif_record, vlan) },
    9.65 +        { .key = "io_read_kbs",
    9.66 +          .type = &abstract_type_float,
    9.67 +          .offset = offsetof(xen_pif_record, io_read_kbs) },
    9.68 +        { .key = "io_write_kbs",
    9.69 +          .type = &abstract_type_float,
    9.70 +          .offset = offsetof(xen_pif_record, io_write_kbs) }
    9.71 +    };
    9.72 +
    9.73 +const abstract_type xen_pif_record_abstract_type_ =
    9.74 +    {
    9.75 +       .typename = STRUCT,
    9.76 +       .struct_size = sizeof(xen_pif_record),
    9.77 +       .member_count =
    9.78 +           sizeof(xen_pif_record_struct_members) / sizeof(struct_member),
    9.79 +       .members = xen_pif_record_struct_members
    9.80 +    };
    9.81 +
    9.82 +
    9.83 +void
    9.84 +xen_pif_record_free(xen_pif_record *record)
    9.85 +{
    9.86 +    free(record->handle);
    9.87 +    free(record->uuid);
    9.88 +    free(record->name);
    9.89 +    xen_network_record_opt_free(record->network);
    9.90 +    xen_host_record_opt_free(record->host);
    9.91 +    free(record->mac);
    9.92 +    free(record->vlan);
    9.93 +    free(record);
    9.94 +}
    9.95 +
    9.96 +
    9.97 +bool
    9.98 +xen_pif_get_record(xen_session *session, xen_pif_record **result, xen_pif pif)
    9.99 +{
   9.100 +    abstract_value param_values[] =
   9.101 +        {
   9.102 +            { .type = &abstract_type_string,
   9.103 +              .u.string_val = pif }
   9.104 +        };
   9.105 +
   9.106 +    abstract_type result_type = xen_pif_record_abstract_type_;
   9.107 +
   9.108 +    *result = NULL;
   9.109 +    XEN_CALL_("PIF.get_record");
   9.110 +
   9.111 +    if (session->ok)
   9.112 +    {
   9.113 +       (*result)->handle = xen_strdup_((*result)->uuid);
   9.114 +    }
   9.115 +
   9.116 +    return session->ok;
   9.117 +}
   9.118 +
   9.119 +
   9.120 +bool
   9.121 +xen_pif_get_by_uuid(xen_session *session, xen_pif *result, char *uuid)
   9.122 +{
   9.123 +    abstract_value param_values[] =
   9.124 +        {
   9.125 +            { .type = &abstract_type_string,
   9.126 +              .u.string_val = uuid }
   9.127 +        };
   9.128 +
   9.129 +    abstract_type result_type = abstract_type_string;
   9.130 +
   9.131 +    *result = NULL;
   9.132 +    XEN_CALL_("PIF.get_by_uuid");
   9.133 +    return session->ok;
   9.134 +}
   9.135 +
   9.136 +
   9.137 +bool
   9.138 +xen_pif_create(xen_session *session, xen_pif *result, xen_pif_record *record)
   9.139 +{
   9.140 +    abstract_value param_values[] =
   9.141 +        {
   9.142 +            { .type = &xen_pif_record_abstract_type_,
   9.143 +              .u.struct_val = record }
   9.144 +        };
   9.145 +
   9.146 +    abstract_type result_type = abstract_type_string;
   9.147 +
   9.148 +    *result = NULL;
   9.149 +    XEN_CALL_("PIF.create");
   9.150 +    return session->ok;
   9.151 +}
   9.152 +
   9.153 +
   9.154 +bool
   9.155 +xen_pif_get_name(xen_session *session, char **result, xen_pif pif)
   9.156 +{
   9.157 +    abstract_value param_values[] =
   9.158 +        {
   9.159 +            { .type = &abstract_type_string,
   9.160 +              .u.string_val = pif }
   9.161 +        };
   9.162 +
   9.163 +    abstract_type result_type = abstract_type_string;
   9.164 +
   9.165 +    *result = NULL;
   9.166 +    XEN_CALL_("PIF.get_name");
   9.167 +    return session->ok;
   9.168 +}
   9.169 +
   9.170 +
   9.171 +bool
   9.172 +xen_pif_get_network(xen_session *session, xen_network *result, xen_pif pif)
   9.173 +{
   9.174 +    abstract_value param_values[] =
   9.175 +        {
   9.176 +            { .type = &abstract_type_string,
   9.177 +              .u.string_val = pif }
   9.178 +        };
   9.179 +
   9.180 +    abstract_type result_type = abstract_type_string;
   9.181 +
   9.182 +    *result = NULL;
   9.183 +    XEN_CALL_("PIF.get_network");
   9.184 +    return session->ok;
   9.185 +}
   9.186 +
   9.187 +
   9.188 +bool
   9.189 +xen_pif_get_host(xen_session *session, xen_host *result, xen_pif pif)
   9.190 +{
   9.191 +    abstract_value param_values[] =
   9.192 +        {
   9.193 +            { .type = &abstract_type_string,
   9.194 +              .u.string_val = pif }
   9.195 +        };
   9.196 +
   9.197 +    abstract_type result_type = abstract_type_string;
   9.198 +
   9.199 +    *result = NULL;
   9.200 +    XEN_CALL_("PIF.get_host");
   9.201 +    return session->ok;
   9.202 +}
   9.203 +
   9.204 +
   9.205 +bool
   9.206 +xen_pif_get_mac(xen_session *session, char **result, xen_pif pif)
   9.207 +{
   9.208 +    abstract_value param_values[] =
   9.209 +        {
   9.210 +            { .type = &abstract_type_string,
   9.211 +              .u.string_val = pif }
   9.212 +        };
   9.213 +
   9.214 +    abstract_type result_type = abstract_type_string;
   9.215 +
   9.216 +    *result = NULL;
   9.217 +    XEN_CALL_("PIF.get_mac");
   9.218 +    return session->ok;
   9.219 +}
   9.220 +
   9.221 +
   9.222 +bool
   9.223 +xen_pif_get_mtu(xen_session *session, uint64_t *result, xen_pif pif)
   9.224 +{
   9.225 +    abstract_value param_values[] =
   9.226 +        {
   9.227 +            { .type = &abstract_type_string,
   9.228 +              .u.string_val = pif }
   9.229 +        };
   9.230 +
   9.231 +    abstract_type result_type = abstract_type_int;
   9.232 +
   9.233 +    XEN_CALL_("PIF.get_mtu");
   9.234 +    return session->ok;
   9.235 +}
   9.236 +
   9.237 +
   9.238 +bool
   9.239 +xen_pif_get_vlan(xen_session *session, char **result, xen_pif pif)
   9.240 +{
   9.241 +    abstract_value param_values[] =
   9.242 +        {
   9.243 +            { .type = &abstract_type_string,
   9.244 +              .u.string_val = pif }
   9.245 +        };
   9.246 +
   9.247 +    abstract_type result_type = abstract_type_string;
   9.248 +
   9.249 +    *result = NULL;
   9.250 +    XEN_CALL_("PIF.get_vlan");
   9.251 +    return session->ok;
   9.252 +}
   9.253 +
   9.254 +
   9.255 +bool
   9.256 +xen_pif_get_io_read_kbs(xen_session *session, double *result, xen_pif pif)
   9.257 +{
   9.258 +    abstract_value param_values[] =
   9.259 +        {
   9.260 +            { .type = &abstract_type_string,
   9.261 +              .u.string_val = pif }
   9.262 +        };
   9.263 +
   9.264 +    abstract_type result_type = abstract_type_float;
   9.265 +
   9.266 +    XEN_CALL_("PIF.get_io_read_kbs");
   9.267 +    return session->ok;
   9.268 +}
   9.269 +
   9.270 +
   9.271 +bool
   9.272 +xen_pif_get_io_write_kbs(xen_session *session, double *result, xen_pif pif)
   9.273 +{
   9.274 +    abstract_value param_values[] =
   9.275 +        {
   9.276 +            { .type = &abstract_type_string,
   9.277 +              .u.string_val = pif }
   9.278 +        };
   9.279 +
   9.280 +    abstract_type result_type = abstract_type_float;
   9.281 +
   9.282 +    XEN_CALL_("PIF.get_io_write_kbs");
   9.283 +    return session->ok;
   9.284 +}
   9.285 +
   9.286 +
   9.287 +bool
   9.288 +xen_pif_set_name(xen_session *session, xen_pif xen_pif, char *name)
   9.289 +{
   9.290 +    abstract_value param_values[] =
   9.291 +        {
   9.292 +            { .type = &abstract_type_string,
   9.293 +              .u.string_val = xen_pif },
   9.294 +            { .type = &abstract_type_string,
   9.295 +              .u.string_val = name }
   9.296 +        };
   9.297 +
   9.298 +    xen_call_(session, "PIF.set_name", param_values, 2, NULL, NULL);
   9.299 +    return session->ok;
   9.300 +}
   9.301 +
   9.302 +
   9.303 +bool
   9.304 +xen_pif_set_network(xen_session *session, xen_pif xen_pif, xen_network network)
   9.305 +{
   9.306 +    abstract_value param_values[] =
   9.307 +        {
   9.308 +            { .type = &abstract_type_string,
   9.309 +              .u.string_val = xen_pif },
   9.310 +            { .type = &abstract_type_string,
   9.311 +              .u.string_val = network }
   9.312 +        };
   9.313 +
   9.314 +    xen_call_(session, "PIF.set_network", param_values, 2, NULL, NULL);
   9.315 +    return session->ok;
   9.316 +}
   9.317 +
   9.318 +
   9.319 +bool
   9.320 +xen_pif_set_host(xen_session *session, xen_pif xen_pif, xen_host host)
   9.321 +{
   9.322 +    abstract_value param_values[] =
   9.323 +        {
   9.324 +            { .type = &abstract_type_string,
   9.325 +              .u.string_val = xen_pif },
   9.326 +            { .type = &abstract_type_string,
   9.327 +              .u.string_val = host }
   9.328 +        };
   9.329 +
   9.330 +    xen_call_(session, "PIF.set_host", param_values, 2, NULL, NULL);
   9.331 +    return session->ok;
   9.332 +}
   9.333 +
   9.334 +
   9.335 +bool
   9.336 +xen_pif_set_mac(xen_session *session, xen_pif xen_pif, char *mac)
   9.337 +{
   9.338 +    abstract_value param_values[] =
   9.339 +        {
   9.340 +            { .type = &abstract_type_string,
   9.341 +              .u.string_val = xen_pif },
   9.342 +            { .type = &abstract_type_string,
   9.343 +              .u.string_val = mac }
   9.344 +        };
   9.345 +
   9.346 +    xen_call_(session, "PIF.set_mac", param_values, 2, NULL, NULL);
   9.347 +    return session->ok;
   9.348 +}
   9.349 +
   9.350 +
   9.351 +bool
   9.352 +xen_pif_set_mtu(xen_session *session, xen_pif xen_pif, uint64_t mtu)
   9.353 +{
   9.354 +    abstract_value param_values[] =
   9.355 +        {
   9.356 +            { .type = &abstract_type_string,
   9.357 +              .u.string_val = xen_pif },
   9.358 +            { .type = &abstract_type_int,
   9.359 +              .u.int_val = mtu }
   9.360 +        };
   9.361 +
   9.362 +    xen_call_(session, "PIF.set_mtu", param_values, 2, NULL, NULL);
   9.363 +    return session->ok;
   9.364 +}
   9.365 +
   9.366 +
   9.367 +bool
   9.368 +xen_pif_set_vlan(xen_session *session, xen_pif xen_pif, char *vlan)
   9.369 +{
   9.370 +    abstract_value param_values[] =
   9.371 +        {
   9.372 +            { .type = &abstract_type_string,
   9.373 +              .u.string_val = xen_pif },
   9.374 +            { .type = &abstract_type_string,
   9.375 +              .u.string_val = vlan }
   9.376 +        };
   9.377 +
   9.378 +    xen_call_(session, "PIF.set_vlan", param_values, 2, NULL, NULL);
   9.379 +    return session->ok;
   9.380 +}
   9.381 +
   9.382 +
   9.383 +bool
   9.384 +xen_pif_get_uuid(xen_session *session, char **result, xen_pif pif)
   9.385 +{
   9.386 +    *result = session->ok ? xen_strdup_((char *)pif) : NULL;
   9.387 +    return session->ok;
   9.388 +}
    10.1 --- a/tools/libxen/src/xen_vbd.c	Thu Oct 26 15:57:29 2006 +0100
    10.2 +++ b/tools/libxen/src/xen_vbd.c	Thu Oct 26 15:59:51 2006 +0100
    10.3 @@ -58,12 +58,12 @@ static const struct_member xen_vbd_recor
    10.4          { .key = "driver",
    10.5            .type = &xen_driver_type_abstract_type_,
    10.6            .offset = offsetof(xen_vbd_record, driver) },
    10.7 -        { .key = "io_bandwidth_incoming_kbs",
    10.8 +        { .key = "io_read_kbs",
    10.9            .type = &abstract_type_float,
   10.10 -          .offset = offsetof(xen_vbd_record, io_bandwidth_incoming_kbs) },
   10.11 -        { .key = "io_bandwidth_outgoing_kbs",
   10.12 +          .offset = offsetof(xen_vbd_record, io_read_kbs) },
   10.13 +        { .key = "io_write_kbs",
   10.14            .type = &abstract_type_float,
   10.15 -          .offset = offsetof(xen_vbd_record, io_bandwidth_outgoing_kbs) }
   10.16 +          .offset = offsetof(xen_vbd_record, io_write_kbs) }
   10.17      };
   10.18  
   10.19  const abstract_type xen_vbd_record_abstract_type_ =
   10.20 @@ -231,7 +231,7 @@ xen_vbd_get_driver(xen_session *session,
   10.21  
   10.22  
   10.23  bool
   10.24 -xen_vbd_get_io_bandwidth_incoming_kbs(xen_session *session, double *result, xen_vbd vbd)
   10.25 +xen_vbd_get_io_read_kbs(xen_session *session, double *result, xen_vbd vbd)
   10.26  {
   10.27      abstract_value param_values[] =
   10.28          {
   10.29 @@ -241,13 +241,13 @@ xen_vbd_get_io_bandwidth_incoming_kbs(xe
   10.30  
   10.31      abstract_type result_type = abstract_type_float;
   10.32  
   10.33 -    XEN_CALL_("VBD.get_io_bandwidth_incoming_kbs");
   10.34 +    XEN_CALL_("VBD.get_io_read_kbs");
   10.35      return session->ok;
   10.36  }
   10.37  
   10.38  
   10.39  bool
   10.40 -xen_vbd_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result, xen_vbd vbd)
   10.41 +xen_vbd_get_io_write_kbs(xen_session *session, double *result, xen_vbd vbd)
   10.42  {
   10.43      abstract_value param_values[] =
   10.44          {
   10.45 @@ -257,7 +257,7 @@ xen_vbd_get_io_bandwidth_outgoing_kbs(xe
   10.46  
   10.47      abstract_type result_type = abstract_type_float;
   10.48  
   10.49 -    XEN_CALL_("VBD.get_io_bandwidth_outgoing_kbs");
   10.50 +    XEN_CALL_("VBD.get_io_write_kbs");
   10.51      return session->ok;
   10.52  }
   10.53  
   10.54 @@ -343,6 +343,22 @@ xen_vbd_set_driver(xen_session *session,
   10.55  
   10.56  
   10.57  bool
   10.58 +xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
   10.59 +{
   10.60 +    abstract_value param_values[] =
   10.61 +        {
   10.62 +            { .type = &abstract_type_string,
   10.63 +              .u.string_val = vbd },
   10.64 +            { .type = &abstract_type_string,
   10.65 +              .u.string_val = vdi }
   10.66 +        };
   10.67 +
   10.68 +    xen_call_(session, "VBD.media_change", param_values, 2, NULL, NULL);
   10.69 +    return session->ok;
   10.70 +}
   10.71 +
   10.72 +
   10.73 +bool
   10.74  xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd)
   10.75  {
   10.76      *result = session->ok ? xen_strdup_((char *)vbd) : NULL;
    11.1 --- a/tools/libxen/src/xen_vif.c	Thu Oct 26 15:57:29 2006 +0100
    11.2 +++ b/tools/libxen/src/xen_vif.c	Thu Oct 26 15:59:51 2006 +0100
    11.3 @@ -63,18 +63,12 @@ static const struct_member xen_vif_recor
    11.4          { .key = "mtu",
    11.5            .type = &abstract_type_int,
    11.6            .offset = offsetof(xen_vif_record, mtu) },
    11.7 -        { .key = "network_read_kbs",
    11.8 -          .type = &abstract_type_float,
    11.9 -          .offset = offsetof(xen_vif_record, network_read_kbs) },
   11.10 -        { .key = "network_write_kbs",
   11.11 +        { .key = "io_read_kbs",
   11.12            .type = &abstract_type_float,
   11.13 -          .offset = offsetof(xen_vif_record, network_write_kbs) },
   11.14 -        { .key = "io_bandwidth_incoming_kbs",
   11.15 +          .offset = offsetof(xen_vif_record, io_read_kbs) },
   11.16 +        { .key = "io_write_kbs",
   11.17            .type = &abstract_type_float,
   11.18 -          .offset = offsetof(xen_vif_record, io_bandwidth_incoming_kbs) },
   11.19 -        { .key = "io_bandwidth_outgoing_kbs",
   11.20 -          .type = &abstract_type_float,
   11.21 -          .offset = offsetof(xen_vif_record, io_bandwidth_outgoing_kbs) }
   11.22 +          .offset = offsetof(xen_vif_record, io_write_kbs) }
   11.23      };
   11.24  
   11.25  const abstract_type xen_vif_record_abstract_type_ =
   11.26 @@ -277,23 +271,7 @@ xen_vif_get_mtu(xen_session *session, ui
   11.27  
   11.28  
   11.29  bool
   11.30 -xen_vif_get_network_read_kbs(xen_session *session, double *result, xen_vif vif)
   11.31 -{
   11.32 -    abstract_value param_values[] =
   11.33 -        {
   11.34 -            { .type = &abstract_type_string,
   11.35 -              .u.string_val = vif }
   11.36 -        };
   11.37 -
   11.38 -    abstract_type result_type = abstract_type_float;
   11.39 -
   11.40 -    XEN_CALL_("VIF.get_network_read_kbs");
   11.41 -    return session->ok;
   11.42 -}
   11.43 -
   11.44 -
   11.45 -bool
   11.46 -xen_vif_get_network_write_kbs(xen_session *session, double *result, xen_vif vif)
   11.47 +xen_vif_get_io_read_kbs(xen_session *session, double *result, xen_vif vif)
   11.48  {
   11.49      abstract_value param_values[] =
   11.50          {
   11.51 @@ -303,13 +281,13 @@ xen_vif_get_network_write_kbs(xen_sessio
   11.52  
   11.53      abstract_type result_type = abstract_type_float;
   11.54  
   11.55 -    XEN_CALL_("VIF.get_network_write_kbs");
   11.56 +    XEN_CALL_("VIF.get_io_read_kbs");
   11.57      return session->ok;
   11.58  }
   11.59  
   11.60  
   11.61  bool
   11.62 -xen_vif_get_io_bandwidth_incoming_kbs(xen_session *session, double *result, xen_vif vif)
   11.63 +xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif)
   11.64  {
   11.65      abstract_value param_values[] =
   11.66          {
   11.67 @@ -319,23 +297,7 @@ xen_vif_get_io_bandwidth_incoming_kbs(xe
   11.68  
   11.69      abstract_type result_type = abstract_type_float;
   11.70  
   11.71 -    XEN_CALL_("VIF.get_io_bandwidth_incoming_kbs");
   11.72 -    return session->ok;
   11.73 -}
   11.74 -
   11.75 -
   11.76 -bool
   11.77 -xen_vif_get_io_bandwidth_outgoing_kbs(xen_session *session, double *result, xen_vif vif)
   11.78 -{
   11.79 -    abstract_value param_values[] =
   11.80 -        {
   11.81 -            { .type = &abstract_type_string,
   11.82 -              .u.string_val = vif }
   11.83 -        };
   11.84 -
   11.85 -    abstract_type result_type = abstract_type_float;
   11.86 -
   11.87 -    XEN_CALL_("VIF.get_io_bandwidth_outgoing_kbs");
   11.88 +    XEN_CALL_("VIF.get_io_write_kbs");
   11.89      return session->ok;
   11.90  }
   11.91