diff options
author | Matthew Fioravante <matthew.fioravante@jhuapl.edu> | 2012-10-05 14:34:27 +0100 |
---|---|---|
committer | Matthew Fioravante <matthew.fioravante@jhuapl.edu> | 2012-10-05 14:34:27 +0100 |
commit | fb0ddeafbc3334a5d7acff44e8f32887b3ee8cc6 (patch) | |
tree | 8476524e8b13e7a737102885be9667aa10b374fc /tools/python | |
parent | 45f57813f646967f93ddadf28a1eb7b2464d35a7 (diff) | |
download | xen-fb0ddeafbc3334a5d7acff44e8f32887b3ee8cc6.tar.gz xen-fb0ddeafbc3334a5d7acff44e8f32887b3ee8cc6.tar.bz2 xen-fb0ddeafbc3334a5d7acff44e8f32887b3ee8cc6.zip |
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 <matthew.fioravante@jhuapl.edu>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/python')
-rw-r--r-- | tools/python/xen/lowlevel/xl/xl.c | 9 |
1 files changed, 9 insertions, 0 deletions
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"); |