From fb0ddeafbc3334a5d7acff44e8f32887b3ee8cc6 Mon Sep 17 00:00:00 2001 From: Matthew Fioravante Date: Fri, 5 Oct 2012 14:34:27 +0100 Subject: libxl: make devid a type so it is initialized properly Previously device ids in libxl were treated as integers meaning they were being initialized to 0, which is a valid device id. This patch makes devid its own type in libxl and initializes it to -1, an invalid value. This fixes a bug where if you try to do a xl DEV-attach multiple time it will continuously try to reattach device 0 instead of generating a new device id. Signed-off-by: Matthew Fioravante Reviewed-by: George Dunlap Acked-by: Ian Campbell Committed-by: Ian Campbell --- tools/python/xen/lowlevel/xl/xl.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools/python') diff --git a/tools/python/xen/lowlevel/xl/xl.c b/tools/python/xen/lowlevel/xl/xl.c index 0551c7636f..32f982ac2d 100644 --- a/tools/python/xen/lowlevel/xl/xl.c +++ b/tools/python/xen/lowlevel/xl/xl.c @@ -281,6 +281,11 @@ int attrib__libxl_domid_set(PyObject *v, libxl_domid *domid) { return 0; } +int attrib__libxl_devid_set(PyObject *v, libxl_devid *devid) { + *devid = PyInt_AsLong(v); + return 0; +} + int attrib__struct_in_addr_set(PyObject *v, struct in_addr *pptr) { PyErr_SetString(PyExc_NotImplementedError, "Setting in_addr"); @@ -342,6 +347,10 @@ PyObject *attrib__libxl_domid_get(libxl_domid *domid) { return PyInt_FromLong(*domid); } +PyObject *attrib__libxl_devid_get(libxl_devid *devid) { + return PyInt_FromLong(*devid); +} + PyObject *attrib__struct_in_addr_get(struct in_addr *pptr) { PyErr_SetString(PyExc_NotImplementedError, "Getting in_addr"); -- cgit v1.2.3