ia64/xen-unstable

changeset 1436:64c28f73f702

bitkeeper revision 1.939 (40c58e4fzvuzE1QaJup7OdkdA6xDqg)

Xend fixes for ngio.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jun 08 10:00:47 2004 +0000 (2004-06-08)
parents 79da98e3f9aa
children 3ee528275c75 9ca65dc5f7af
files tools/xend/lib/blkif.py tools/xend/lib/utils.c
line diff
     1.1 --- a/tools/xend/lib/blkif.py	Fri Jun 04 15:51:58 2004 +0000
     1.2 +++ b/tools/xend/lib/blkif.py	Tue Jun 08 10:00:47 2004 +0000
     1.3 @@ -64,7 +64,7 @@ def backend_rx_rsp(port, msg):
     1.4                                   { 'domid' : dom, 'blkif_handle' : 0,
     1.5                                     'vdevice' : vdev,
     1.6                                     'extent.sector_start' : start_sect,
     1.7 -                                   'extent.sector.length' : nr_sect,
     1.8 +                                   'extent.sector_length' : nr_sect,
     1.9                                     'extent.device' : pdev })
    1.10          backend_tx_req(msg)
    1.11      elif subtype == CMSG_BLKIF_BE_VBD_GROW:
     2.1 --- a/tools/xend/lib/utils.c	Fri Jun 04 15:51:58 2004 +0000
     2.2 +++ b/tools/xend/lib/utils.c	Tue Jun 08 10:00:47 2004 +0000
     2.3 @@ -236,18 +236,29 @@ static PyTypeObject xu_notifier_type = {
     2.4   */
     2.5  
     2.6  #define TYPE(_x,_y) (((_x)<<8)|(_y))
     2.7 -#define P2C(_struct, _field, _pytype, _ctype1, _ctype2)                   \
     2.8 +#define P2C(_struct, _field, _ctype)                                      \
     2.9      do {                                                                  \
    2.10          PyObject *obj;                                                    \
    2.11 -        if ( ((obj = PyDict_GetItemString(payload, #_field)) != NULL) &&  \
    2.12 -             Py ## _pytype ## _Check(obj) )                               \
    2.13 -            ((_struct *)&xum->msg.msg[0])->_field =                       \
    2.14 -                (_ctype2)Py ## _pytype ## _As ## _ctype1(obj);            \
    2.15 +        if ( (obj = PyDict_GetItemString(payload, #_field)) != NULL )     \
    2.16 +        {                                                                 \
    2.17 +            if ( PyInt_Check(obj) )                                       \
    2.18 +            {                                                             \
    2.19 +                ((_struct *)&xum->msg.msg[0])->_field =                   \
    2.20 +                  (_ctype)PyInt_AsLong(obj);                              \
    2.21 +                dict_items_parsed++;                                      \
    2.22 +            }                                                             \
    2.23 +            else if ( PyLong_Check(obj) )                                 \
    2.24 +            {                                                             \
    2.25 +                ((_struct *)&xum->msg.msg[0])->_field =                   \
    2.26 +                  (_ctype)PyLong_AsUnsignedLongLong(obj);                 \
    2.27 +                dict_items_parsed++;                                      \
    2.28 +            }                                                             \
    2.29 +        }                                                                 \
    2.30          xum->msg.length = sizeof(_struct);                                \
    2.31      } while ( 0 )
    2.32 -#define C2P(_struct, _field, _pytype, _ctype1, _ctype2)                   \
    2.33 +#define C2P(_struct, _field, _pytype, _ctype)                             \
    2.34      do {                                                                  \
    2.35 -        PyObject *obj = Py ## _pytype ## _From ## _ctype1                 \
    2.36 +        PyObject *obj = Py ## _pytype ## _From ## _ctype                  \
    2.37                          (((_struct *)&xum->msg.msg[0])->_field);          \
    2.38          if ( dict == NULL ) dict = PyDict_New();                          \
    2.39          PyDict_SetItemString(dict, #_field, obj);                         \
    2.40 @@ -284,20 +295,33 @@ static PyObject *xu_message_set_response
    2.41  {
    2.42      xu_message_object *xum = (xu_message_object *)self;
    2.43      PyObject *payload;
    2.44 +    int dict_items_parsed = 0;
    2.45  
    2.46      if ( !PyArg_ParseTuple(args, "O", &payload) )
    2.47          return NULL;
    2.48  
    2.49 +    if ( !PyDict_Check(payload) )
    2.50 +    {
    2.51 +        PyErr_SetString(PyExc_TypeError, "payload is not a dictionary");
    2.52 +        return NULL;
    2.53 +    }
    2.54 +
    2.55      switch ( TYPE(xum->msg.type, xum->msg.subtype) )
    2.56      {
    2.57      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED):
    2.58 -        P2C(blkif_fe_driver_status_changed_t, nr_interfaces, Int, Long, u32);
    2.59 +        P2C(blkif_fe_driver_status_changed_t, nr_interfaces, u32);
    2.60          break;
    2.61      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED):
    2.62 -        P2C(netif_fe_driver_status_changed_t, nr_interfaces, Int, Long, u32);
    2.63 +        P2C(netif_fe_driver_status_changed_t, nr_interfaces, u32);
    2.64          break;
    2.65      }
    2.66  
    2.67 +    if ( dict_items_parsed != PyDict_Size(payload) )
    2.68 +    {
    2.69 +        PyErr_SetString(PyExc_TypeError, "payload contains bad items");
    2.70 +        return NULL;
    2.71 +    }
    2.72 +
    2.73      Py_INCREF(Py_None);
    2.74      return Py_None;
    2.75  }
    2.76 @@ -313,117 +337,116 @@ static PyObject *xu_message_get_payload(
    2.77      switch ( TYPE(xum->msg.type, xum->msg.subtype) )
    2.78      {
    2.79      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED):
    2.80 -        C2P(blkif_fe_interface_status_changed_t, handle, Int, Long, u32);
    2.81 -        C2P(blkif_fe_interface_status_changed_t, status, Int, Long, u32);
    2.82 -        C2P(blkif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
    2.83 +        C2P(blkif_fe_interface_status_changed_t, handle, Int, Long);
    2.84 +        C2P(blkif_fe_interface_status_changed_t, status, Int, Long);
    2.85 +        C2P(blkif_fe_interface_status_changed_t, evtchn, Int, Long);
    2.86          return dict;
    2.87      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_DRIVER_STATUS_CHANGED):
    2.88 -        C2P(blkif_fe_driver_status_changed_t, status, Int, Long, u32);
    2.89 +        C2P(blkif_fe_driver_status_changed_t, status, Int, Long);
    2.90          return dict;
    2.91      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_CONNECT):
    2.92 -        C2P(blkif_fe_interface_connect_t, handle,      Int, Long, u32);
    2.93 -        C2P(blkif_fe_interface_connect_t, shmem_frame, Int, Long, memory_t);
    2.94 +        C2P(blkif_fe_interface_connect_t, handle,      Int, Long);
    2.95 +        C2P(blkif_fe_interface_connect_t, shmem_frame, Int, Long);
    2.96          return dict;
    2.97      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_DISCONNECT):
    2.98 -        C2P(blkif_fe_interface_disconnect_t, handle, Int, Long, u32);
    2.99 +        C2P(blkif_fe_interface_disconnect_t, handle, Int, Long);
   2.100          return dict;
   2.101      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE):
   2.102 -        C2P(blkif_be_create_t, domid,        Int, Long, u32);
   2.103 -        C2P(blkif_be_create_t, blkif_handle, Int, Long, u32);
   2.104 -        C2P(blkif_be_create_t, status, Int, Long, u32);
   2.105 +        C2P(blkif_be_create_t, domid,        Int, Long);
   2.106 +        C2P(blkif_be_create_t, blkif_handle, Int, Long);
   2.107 +        C2P(blkif_be_create_t, status,       Int, Long);
   2.108          return dict;
   2.109      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY):
   2.110 -        C2P(blkif_be_destroy_t, domid,        Int, Long, u32);
   2.111 -        C2P(blkif_be_destroy_t, blkif_handle, Int, Long, u32);
   2.112 -        C2P(blkif_be_destroy_t, status, Int, Long, u32);
   2.113 +        C2P(blkif_be_destroy_t, domid,        Int, Long);
   2.114 +        C2P(blkif_be_destroy_t, blkif_handle, Int, Long);
   2.115 +        C2P(blkif_be_destroy_t, status,       Int, Long);
   2.116          return dict;
   2.117      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CONNECT):
   2.118 -        C2P(blkif_be_connect_t, domid,        Int, Long, u32);
   2.119 -        C2P(blkif_be_connect_t, blkif_handle, Int, Long, u32);
   2.120 -        C2P(blkif_be_connect_t, shmem_frame,  Int, Long, memory_t);
   2.121 -        C2P(blkif_be_connect_t, evtchn,       Int, Long, u16);
   2.122 -        C2P(blkif_be_connect_t, status, Int, Long, u32);
   2.123 +        C2P(blkif_be_connect_t, domid,        Int, Long);
   2.124 +        C2P(blkif_be_connect_t, blkif_handle, Int, Long);
   2.125 +        C2P(blkif_be_connect_t, shmem_frame,  Int, Long);
   2.126 +        C2P(blkif_be_connect_t, evtchn,       Int, Long);
   2.127 +        C2P(blkif_be_connect_t, status,       Int, Long);
   2.128          return dict;
   2.129      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DISCONNECT):
   2.130 -        C2P(blkif_be_disconnect_t, domid,        Int, Long, u32);
   2.131 -        C2P(blkif_be_disconnect_t, blkif_handle, Int, Long, u32);
   2.132 -        C2P(blkif_be_disconnect_t, status, Int, Long, u32);
   2.133 +        C2P(blkif_be_disconnect_t, domid,        Int, Long);
   2.134 +        C2P(blkif_be_disconnect_t, blkif_handle, Int, Long);
   2.135 +        C2P(blkif_be_disconnect_t, status,       Int, Long);
   2.136          return dict;
   2.137      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
   2.138 -        C2P(blkif_be_vbd_create_t, domid,        Int, Long, u32);
   2.139 -        C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long, u32);
   2.140 -        C2P(blkif_be_vbd_create_t, vdevice,      Int, Long, blkif_vdev_t);
   2.141 -        C2P(blkif_be_vbd_create_t, readonly,     Int, Long, u16);
   2.142 -        C2P(blkif_be_vbd_create_t, status, Int, Long, u32);
   2.143 +        C2P(blkif_be_vbd_create_t, domid,        Int, Long);
   2.144 +        C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long);
   2.145 +        C2P(blkif_be_vbd_create_t, vdevice,      Int, Long);
   2.146 +        C2P(blkif_be_vbd_create_t, readonly,     Int, Long);
   2.147 +        C2P(blkif_be_vbd_create_t, status,       Int, Long);
   2.148          return dict;
   2.149      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_DESTROY):
   2.150 -        C2P(blkif_be_vbd_destroy_t, domid,        Int, Long, u32);
   2.151 -        C2P(blkif_be_vbd_destroy_t, blkif_handle, Int, Long, u32);
   2.152 -        C2P(blkif_be_vbd_destroy_t, vdevice,      Int, Long, blkif_vdev_t);
   2.153 -        C2P(blkif_be_vbd_destroy_t, status, Int, Long, u32);
   2.154 +        C2P(blkif_be_vbd_destroy_t, domid,        Int, Long);
   2.155 +        C2P(blkif_be_vbd_destroy_t, blkif_handle, Int, Long);
   2.156 +        C2P(blkif_be_vbd_destroy_t, vdevice,      Int, Long);
   2.157 +        C2P(blkif_be_vbd_destroy_t, status,       Int, Long);
   2.158          return dict;
   2.159      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
   2.160 -        C2P(blkif_be_vbd_grow_t, domid,        Int, Long, u32);
   2.161 -        C2P(blkif_be_vbd_grow_t, blkif_handle, Int, Long, u32);
   2.162 -        C2P(blkif_be_vbd_grow_t, vdevice,      Int, Long, blkif_vdev_t);
   2.163 +        C2P(blkif_be_vbd_grow_t, domid,         Int, Long);
   2.164 +        C2P(blkif_be_vbd_grow_t, blkif_handle,  Int, Long);
   2.165 +        C2P(blkif_be_vbd_grow_t, vdevice,       Int, Long);
   2.166          C2P(blkif_be_vbd_grow_t, extent.sector_start, 
   2.167 -             Long, UnsignedLongLong, blkif_sector_t);
   2.168 +             Long, UnsignedLongLong);
   2.169          C2P(blkif_be_vbd_grow_t, extent.sector_length, 
   2.170 -             Long, UnsignedLongLong, blkif_sector_t);
   2.171 -        C2P(blkif_be_vbd_grow_t, extent.device, 
   2.172 -             Int, Long, blkif_pdev_t);
   2.173 -        C2P(blkif_be_vbd_grow_t, status, Int, Long, u32);
   2.174 +             Long, UnsignedLongLong);
   2.175 +        C2P(blkif_be_vbd_grow_t, extent.device, Int, Long);
   2.176 +        C2P(blkif_be_vbd_grow_t, status,        Int, Long);
   2.177          return dict;
   2.178      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
   2.179 -        C2P(blkif_be_vbd_shrink_t, domid,        Int, Long, u32);
   2.180 -        C2P(blkif_be_vbd_shrink_t, blkif_handle, Int, Long, u32);
   2.181 -        C2P(blkif_be_vbd_shrink_t, vdevice,      Int, Long, blkif_vdev_t);
   2.182 -        C2P(blkif_be_vbd_shrink_t, status, Int, Long, u32);
   2.183 +        C2P(blkif_be_vbd_shrink_t, domid,        Int, Long);
   2.184 +        C2P(blkif_be_vbd_shrink_t, blkif_handle, Int, Long);
   2.185 +        C2P(blkif_be_vbd_shrink_t, vdevice,      Int, Long);
   2.186 +        C2P(blkif_be_vbd_shrink_t, status,       Int, Long);
   2.187          return dict;
   2.188      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED):
   2.189 -        C2P(blkif_be_driver_status_changed_t, status, Int, Long, u32);
   2.190 +        C2P(blkif_be_driver_status_changed_t, status, Int, Long);
   2.191          return dict;
   2.192      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED):
   2.193 -        C2P(netif_fe_interface_status_changed_t, handle, Int, Long, u32);
   2.194 -        C2P(netif_fe_interface_status_changed_t, status, Int, Long, u32);
   2.195 -        C2P(netif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
   2.196 +        C2P(netif_fe_interface_status_changed_t, handle, Int, Long);
   2.197 +        C2P(netif_fe_interface_status_changed_t, status, Int, Long);
   2.198 +        C2P(netif_fe_interface_status_changed_t, evtchn, Int, Long);
   2.199          return dict;
   2.200      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_DRIVER_STATUS_CHANGED):
   2.201 -        C2P(netif_fe_driver_status_changed_t, status, Int, Long, u32);
   2.202 +        C2P(netif_fe_driver_status_changed_t, status, Int, Long);
   2.203          return dict;
   2.204      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_CONNECT):
   2.205 -        C2P(netif_fe_interface_connect_t, handle,         Int, Long, u32);
   2.206 -        C2P(netif_fe_interface_connect_t, tx_shmem_frame, Int, Long, memory_t);
   2.207 -        C2P(netif_fe_interface_connect_t, rx_shmem_frame, Int, Long, memory_t);
   2.208 +        C2P(netif_fe_interface_connect_t, handle,         Int, Long);
   2.209 +        C2P(netif_fe_interface_connect_t, tx_shmem_frame, Int, Long);
   2.210 +        C2P(netif_fe_interface_connect_t, rx_shmem_frame, Int, Long);
   2.211          return dict;
   2.212      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_DISCONNECT):
   2.213 -        C2P(netif_fe_interface_disconnect_t, handle, Int, Long, u32);
   2.214 +        C2P(netif_fe_interface_disconnect_t, handle, Int, Long);
   2.215          return dict;
   2.216      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE):
   2.217 -        C2P(netif_be_create_t, domid,        Int, Long, u32);
   2.218 -        C2P(netif_be_create_t, netif_handle, Int, Long, u32);
   2.219 -        C2P(netif_be_create_t, status, Int, Long, u32);
   2.220 +        C2P(netif_be_create_t, domid,        Int, Long);
   2.221 +        C2P(netif_be_create_t, netif_handle, Int, Long);
   2.222 +        C2P(netif_be_create_t, status,       Int, Long);
   2.223          return dict;
   2.224      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
   2.225 -        C2P(netif_be_destroy_t, domid,        Int, Long, u32);
   2.226 -        C2P(netif_be_destroy_t, netif_handle, Int, Long, u32);
   2.227 -        C2P(netif_be_destroy_t, status, Int, Long, u32);
   2.228 +        C2P(netif_be_destroy_t, domid,        Int, Long);
   2.229 +        C2P(netif_be_destroy_t, netif_handle, Int, Long);
   2.230 +        C2P(netif_be_destroy_t, status,       Int, Long);
   2.231          return dict;
   2.232      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CONNECT):
   2.233 -        C2P(netif_be_connect_t, domid,          Int, Long, u32);
   2.234 -        C2P(netif_be_connect_t, netif_handle,   Int, Long, u32);
   2.235 -        C2P(netif_be_connect_t, tx_shmem_frame, Int, Long, memory_t);
   2.236 -        C2P(netif_be_connect_t, rx_shmem_frame, Int, Long, memory_t);
   2.237 -        C2P(netif_be_connect_t, evtchn,         Int, Long, u16);
   2.238 -        C2P(netif_be_connect_t, status, Int, Long, u32);
   2.239 +        C2P(netif_be_connect_t, domid,          Int, Long);
   2.240 +        C2P(netif_be_connect_t, netif_handle,   Int, Long);
   2.241 +        C2P(netif_be_connect_t, tx_shmem_frame, Int, Long);
   2.242 +        C2P(netif_be_connect_t, rx_shmem_frame, Int, Long);
   2.243 +        C2P(netif_be_connect_t, evtchn,         Int, Long);
   2.244 +        C2P(netif_be_connect_t, status,         Int, Long);
   2.245          return dict;
   2.246      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
   2.247 -        C2P(netif_be_disconnect_t, domid,        Int, Long, u32);
   2.248 -        C2P(netif_be_disconnect_t, netif_handle, Int, Long, u32);
   2.249 -        C2P(netif_be_disconnect_t, status, Int, Long, u32);
   2.250 +        C2P(netif_be_disconnect_t, domid,        Int, Long);
   2.251 +        C2P(netif_be_disconnect_t, netif_handle, Int, Long);
   2.252 +        C2P(netif_be_disconnect_t, status,       Int, Long);
   2.253          return dict;
   2.254      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DRIVER_STATUS_CHANGED):
   2.255 -        C2P(netif_be_driver_status_changed_t, status, Int, Long, u32);
   2.256 +        C2P(netif_be_driver_status_changed_t, status, Int, Long);
   2.257          return dict;
   2.258      }
   2.259  
   2.260 @@ -472,7 +495,7 @@ staticforward PyTypeObject xu_message_ty
   2.261  static PyObject *xu_message_new(PyObject *self, PyObject *args)
   2.262  {
   2.263      xu_message_object *xum;
   2.264 -    int type, subtype, id;
   2.265 +    int type, subtype, id, dict_items_parsed = 0;
   2.266      PyObject *payload = NULL;
   2.267  
   2.268      if ( !PyArg_ParseTuple(args, "iii|O", &type, &subtype, &id, &payload) )
   2.269 @@ -498,93 +521,97 @@ static PyObject *xu_message_new(PyObject
   2.270      switch ( TYPE(type, subtype) )
   2.271      {
   2.272      case TYPE(CMSG_BLKIF_FE, CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED):
   2.273 -        P2C(blkif_fe_interface_status_changed_t, handle, Int, Long, u32);
   2.274 -        P2C(blkif_fe_interface_status_changed_t, status, Int, Long, u32);
   2.275 -        P2C(blkif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
   2.276 +        P2C(blkif_fe_interface_status_changed_t, handle, u32);
   2.277 +        P2C(blkif_fe_interface_status_changed_t, status, u32);
   2.278 +        P2C(blkif_fe_interface_status_changed_t, evtchn, u16);
   2.279          break;
   2.280      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CREATE):
   2.281 -        P2C(blkif_be_create_t, domid,        Int, Long, u32);
   2.282 -        P2C(blkif_be_create_t, blkif_handle, Int, Long, u32);
   2.283 +        P2C(blkif_be_create_t, domid,        u32);
   2.284 +        P2C(blkif_be_create_t, blkif_handle, u32);
   2.285          break;
   2.286      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DESTROY):
   2.287 -        P2C(blkif_be_destroy_t, domid,        Int, Long, u32);
   2.288 -        P2C(blkif_be_destroy_t, blkif_handle, Int, Long, u32);
   2.289 +        P2C(blkif_be_destroy_t, domid,        u32);
   2.290 +        P2C(blkif_be_destroy_t, blkif_handle, u32);
   2.291          break;
   2.292      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_CONNECT):
   2.293 -        P2C(blkif_be_connect_t, domid,        Int, Long, u32);
   2.294 -        P2C(blkif_be_connect_t, blkif_handle, Int, Long, u32);
   2.295 -        P2C(blkif_be_connect_t, shmem_frame,  Int, Long, memory_t);
   2.296 -        P2C(blkif_be_connect_t, evtchn,       Int, Long, u16);
   2.297 +        P2C(blkif_be_connect_t, domid,        u32);
   2.298 +        P2C(blkif_be_connect_t, blkif_handle, u32);
   2.299 +        P2C(blkif_be_connect_t, shmem_frame,  memory_t);
   2.300 +        P2C(blkif_be_connect_t, evtchn,       u16);
   2.301          break;
   2.302      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_DISCONNECT):
   2.303 -        P2C(blkif_be_disconnect_t, domid,        Int, Long, u32);
   2.304 -        P2C(blkif_be_disconnect_t, blkif_handle, Int, Long, u32);
   2.305 +        P2C(blkif_be_disconnect_t, domid,        u32);
   2.306 +        P2C(blkif_be_disconnect_t, blkif_handle, u32);
   2.307          break;
   2.308      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE):
   2.309 -        P2C(blkif_be_vbd_create_t, domid,        Int, Long, u32);
   2.310 -        P2C(blkif_be_vbd_create_t, blkif_handle, Int, Long, u32);
   2.311 -        P2C(blkif_be_vbd_create_t, vdevice,      Int, Long, blkif_vdev_t);
   2.312 -        P2C(blkif_be_vbd_create_t, readonly,     Int, Long, u16);
   2.313 +        P2C(blkif_be_vbd_create_t, domid,        u32);
   2.314 +        P2C(blkif_be_vbd_create_t, blkif_handle, u32);
   2.315 +        P2C(blkif_be_vbd_create_t, vdevice,      blkif_vdev_t);
   2.316 +        P2C(blkif_be_vbd_create_t, readonly,     u16);
   2.317          break;
   2.318      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_DESTROY):
   2.319 -        P2C(blkif_be_vbd_destroy_t, domid,        Int, Long, u32);
   2.320 -        P2C(blkif_be_vbd_destroy_t, blkif_handle, Int, Long, u32);
   2.321 -        P2C(blkif_be_vbd_destroy_t, vdevice,      Int, Long, blkif_vdev_t);
   2.322 +        P2C(blkif_be_vbd_destroy_t, domid,        u32);
   2.323 +        P2C(blkif_be_vbd_destroy_t, blkif_handle, u32);
   2.324 +        P2C(blkif_be_vbd_destroy_t, vdevice,      blkif_vdev_t);
   2.325          break;
   2.326      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_GROW):
   2.327 -        P2C(blkif_be_vbd_grow_t, domid,        Int, Long, u32);
   2.328 -        P2C(blkif_be_vbd_grow_t, blkif_handle, Int, Long, u32);
   2.329 -        P2C(blkif_be_vbd_grow_t, vdevice,      Int, Long, blkif_vdev_t);
   2.330 -        P2C(blkif_be_vbd_grow_t, extent.sector_start, 
   2.331 -             Long, UnsignedLongLong, blkif_sector_t);
   2.332 -        P2C(blkif_be_vbd_grow_t, extent.sector_length, 
   2.333 -             Long, UnsignedLongLong, blkif_sector_t);
   2.334 -        P2C(blkif_be_vbd_grow_t, extent.device, 
   2.335 -             Int, Long, blkif_pdev_t);
   2.336 +        P2C(blkif_be_vbd_grow_t, domid,                u32);
   2.337 +        P2C(blkif_be_vbd_grow_t, blkif_handle,         u32);
   2.338 +        P2C(blkif_be_vbd_grow_t, vdevice,              blkif_vdev_t);
   2.339 +        P2C(blkif_be_vbd_grow_t, extent.sector_start,  blkif_sector_t);
   2.340 +        P2C(blkif_be_vbd_grow_t, extent.sector_length, blkif_sector_t);
   2.341 +        P2C(blkif_be_vbd_grow_t, extent.device,        blkif_pdev_t);
   2.342          break;
   2.343      case TYPE(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_SHRINK):
   2.344 -        P2C(blkif_be_vbd_shrink_t, domid,        Int, Long, u32);
   2.345 -        P2C(blkif_be_vbd_shrink_t, blkif_handle, Int, Long, u32);
   2.346 -        P2C(blkif_be_vbd_shrink_t, vdevice,      Int, Long, blkif_vdev_t);
   2.347 +        P2C(blkif_be_vbd_shrink_t, domid,        u32);
   2.348 +        P2C(blkif_be_vbd_shrink_t, blkif_handle, u32);
   2.349 +        P2C(blkif_be_vbd_shrink_t, vdevice,      blkif_vdev_t);
   2.350          break;
   2.351      case TYPE(CMSG_NETIF_FE, CMSG_NETIF_FE_INTERFACE_STATUS_CHANGED):
   2.352 -        P2C(netif_fe_interface_status_changed_t, handle, Int, Long, u32);
   2.353 -        P2C(netif_fe_interface_status_changed_t, status, Int, Long, u32);
   2.354 -        P2C(netif_fe_interface_status_changed_t, evtchn, Int, Long, u16);
   2.355 -        P2C(netif_fe_interface_status_changed_t, mac[0], Int, Long, u8);
   2.356 -        P2C(netif_fe_interface_status_changed_t, mac[1], Int, Long, u8);
   2.357 -        P2C(netif_fe_interface_status_changed_t, mac[2], Int, Long, u8);
   2.358 -        P2C(netif_fe_interface_status_changed_t, mac[3], Int, Long, u8);
   2.359 -        P2C(netif_fe_interface_status_changed_t, mac[4], Int, Long, u8);
   2.360 -        P2C(netif_fe_interface_status_changed_t, mac[5], Int, Long, u8);
   2.361 +        P2C(netif_fe_interface_status_changed_t, handle, u32);
   2.362 +        P2C(netif_fe_interface_status_changed_t, status, u32);
   2.363 +        P2C(netif_fe_interface_status_changed_t, evtchn, u16);
   2.364 +        P2C(netif_fe_interface_status_changed_t, mac[0], u8);
   2.365 +        P2C(netif_fe_interface_status_changed_t, mac[1], u8);
   2.366 +        P2C(netif_fe_interface_status_changed_t, mac[2], u8);
   2.367 +        P2C(netif_fe_interface_status_changed_t, mac[3], u8);
   2.368 +        P2C(netif_fe_interface_status_changed_t, mac[4], u8);
   2.369 +        P2C(netif_fe_interface_status_changed_t, mac[5], u8);
   2.370          break;
   2.371      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CREATE):
   2.372 -        P2C(netif_be_create_t, domid,        Int, Long, u32);
   2.373 -        P2C(netif_be_create_t, netif_handle, Int, Long, u32);
   2.374 -        P2C(netif_be_create_t, mac[0],       Int, Long, u8);
   2.375 -        P2C(netif_be_create_t, mac[1],       Int, Long, u8);
   2.376 -        P2C(netif_be_create_t, mac[2],       Int, Long, u8);
   2.377 -        P2C(netif_be_create_t, mac[3],       Int, Long, u8);
   2.378 -        P2C(netif_be_create_t, mac[4],       Int, Long, u8);
   2.379 -        P2C(netif_be_create_t, mac[5],       Int, Long, u8);
   2.380 +        P2C(netif_be_create_t, domid,        u32);
   2.381 +        P2C(netif_be_create_t, netif_handle, u32);
   2.382 +        P2C(netif_be_create_t, mac[0],       u8);
   2.383 +        P2C(netif_be_create_t, mac[1],       u8);
   2.384 +        P2C(netif_be_create_t, mac[2],       u8);
   2.385 +        P2C(netif_be_create_t, mac[3],       u8);
   2.386 +        P2C(netif_be_create_t, mac[4],       u8);
   2.387 +        P2C(netif_be_create_t, mac[5],       u8);
   2.388          break;
   2.389      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DESTROY):
   2.390 -        P2C(netif_be_destroy_t, domid,        Int, Long, u32);
   2.391 -        P2C(netif_be_destroy_t, netif_handle, Int, Long, u32);
   2.392 +        P2C(netif_be_destroy_t, domid,        u32);
   2.393 +        P2C(netif_be_destroy_t, netif_handle, u32);
   2.394          break;
   2.395      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_CONNECT):
   2.396 -        P2C(netif_be_connect_t, domid,          Int, Long, u32);
   2.397 -        P2C(netif_be_connect_t, netif_handle,   Int, Long, u32);
   2.398 -        P2C(netif_be_connect_t, tx_shmem_frame, Int, Long, memory_t);
   2.399 -        P2C(netif_be_connect_t, rx_shmem_frame, Int, Long, memory_t);
   2.400 -        P2C(netif_be_connect_t, evtchn,         Int, Long, u16);
   2.401 +        P2C(netif_be_connect_t, domid,          u32);
   2.402 +        P2C(netif_be_connect_t, netif_handle,   u32);
   2.403 +        P2C(netif_be_connect_t, tx_shmem_frame, memory_t);
   2.404 +        P2C(netif_be_connect_t, rx_shmem_frame, memory_t);
   2.405 +        P2C(netif_be_connect_t, evtchn,         u16);
   2.406          break;
   2.407      case TYPE(CMSG_NETIF_BE, CMSG_NETIF_BE_DISCONNECT):
   2.408 -        P2C(netif_be_disconnect_t, domid,        Int, Long, u32);
   2.409 -        P2C(netif_be_disconnect_t, netif_handle, Int, Long, u32);
   2.410 +        P2C(netif_be_disconnect_t, domid,        u32);
   2.411 +        P2C(netif_be_disconnect_t, netif_handle, u32);
   2.412          break;
   2.413      }
   2.414  
   2.415 +    if ( dict_items_parsed != PyDict_Size(payload) )
   2.416 +    {
   2.417 +        PyErr_SetString(PyExc_TypeError, "payload contains bad items");
   2.418 +        PyObject_Del((PyObject *)xum);
   2.419 +        return NULL;
   2.420 +    }
   2.421 +
   2.422      return (PyObject *)xum;
   2.423  }
   2.424