summaryrefslogtreecommitdiff
path: root/libvirt-qemu-override.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix sign compare offendersv9.1.0Michal Privoznik2023-02-131-1/+1
| | | | | | | | | | | | | | In a few places we compare signed and unsigned integers. In majority of cases it's because the iteration variable is declared as ssize_t but then in the for() loop it's compared against an unsigned int. But there is one case where the opposite happens (libvirt_virDomainSendKey()), or where an UINT_MAX (which is inherently unsigned) is compared against signed long. Also, use this opportunity to decrease scope of 'j' variable inside of libvirt_virDomainInterfaceAddresses(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Implement virDomainQemuMonitorCommandWithFiles() overrideMichal Privoznik2022-03-101-0/+118
| | | | | | | | | | | With libvirt-8.2.0 there's a new API: virDomainQemuMonitorCommandWithFiles(). Since the API has both input and output arguments we need to provide an alternative implementation. Moreover, since FD passing works only on UNIX-like systems we can query the returned FDs for their flags and construct mode for python File object. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* debug: Fix bit-rot in debug outputPhilipp Hahn2020-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the compiler optimize out the printf() call instead of doing it with the pre-processor as the later does not catch format string errors or the following case, where NULLSTR() is used but not defined: > libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’: > libvirt-qemu-override.c:271:34: warning: implicit declaration of function ‘NULLSTR’; did you mean ‘NULL’? [-Wimplicit-function-declaration] > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ^~~~~~~ > libvirt-qemu-override.c:39:28: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~~~~~~~~~ > libvirt-qemu-override.c:270:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=] > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ~~~~~~~~~~~~~~ > | | > | int > libvirt-qemu-override.c:39:23: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~ > libvirt-qemu-override.c:270:73: note: format string is defined here > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ~^ > | | > | char * > | %d Copy the definition of NULLSTR from libvirt/src/internal.h to typewrappers.h Signed-off-by: Philipp Hahn <hahn@univention.de>
* Drop support for python 2Daniel P. Berrangé2019-12-041-41/+10
| | | | | | | | | python2 will be end of life by the time of the next libvirt release. All our supported build targets, including CentOS7, have a python3 build available. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* PyArg_ParseTuple: Provide correct function namesv2.2.0Michal Privoznik2016-08-241-1/+2
| | | | | | | | | | At the end of the format string we put :virFunctionName where ':' says "this is the end of argument list", and virFunctionName is the prefix for error messages then. However, in some cases we have had wrong names there. Some of them are actually quite funny: xmlRegisterErrorHandler. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Return NULL if python exception is setPavel Hrdina2015-10-051-4/+2
| | | | | | | There is a rule, python API fails, it also in those cases sets an exception. We should follow those rules and in those cases return NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* fix indentationPavel Hrdina2015-10-051-21/+20
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* indent labels by one spacePavel Hrdina2015-10-051-1/+1
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* cleanup functions definitionPavel Hrdina2015-10-051-2/+4
| | | | | | Follow the libvirt hacking guide and make the code consistent. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Move utils and shared code into libvirt-utilsPavel Hrdina2015-10-051-7/+0
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Fix rest of unsigned integer handlingPeter Krempa2014-10-221-2/+2
| | | | | As in the previous patch, fix all places where 'flags' is converted as a signed argument to unsigned including the python code generator.
* build: Fix build warning on libvirt-pythonMo Yuxiang2014-08-191-1/+2
| | | | | | | | | | | | | | On compiling libvirt-python, we get such a warning: libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’: libvirt-qemu-override.c:304: warning: suggest explicit braces to avoid ambiguous ‘else’ Py_DECREF is a macro using if/else on older Python releases. The solution is to add braces. Python 2.7 and newer has the macro wrapped in a do { } while(0) block. Signed-off-by: Mo Yuxiang <Moyuxiang@huawei.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* qemu: support arbitrary monitor eventsEric Blake2014-03-251-1/+222
| | | | | | | | | | | | | | | | | | | | | | Wrap the new virConnectDomainQemuMonitorEventRegister function added in libvirt 1.2.3. This patch copies heavily from network events (commit 6ea5be0) and from event loop callbacks in libvirt-override.c, since in the libvirt_qemu module, we must expose top-level functions rather than class members. * generator.py (qemu_skip_function): Don't generate event code. (qemuBuildWrappers): Delay manual portion until after imports. * libvirt-qemu-override.py (qemuMonitorEventRegister) (qemuMonitorEventDeregister): New file. * libvirt-qemu-override.c (libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc) (libvirt_qemu_virConnectDomainQemuMonitorEventCallback) (libvirt_qemu_virConnectDomainQemuMonitorEventRegister) (libvirt_qemu_virConnectDomainQemuMonitorEventDeregister) (libvirt_qemu_lookupPythonFunc, getLibvirtQemuDictObject) (getLibvirtQemuModuleObject): New functions. Signed-off-by: Eric Blake <eblake@redhat.com>
* override: Replace PyString_FromString with libvirt_constcharPtrWrapDaniel P. Berrange2013-12-111-2/+2
| | | | | | | | Make use of libvirt_constcharPtrWrap in all override code, to match generated code. This will isolate Python3 specific changes in one place. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Fix native module registration to work with Python3Daniel P. Berrange2013-12-111-18/+55
| | | | | | | The way native modules are registered has completely changed, so the code must be #ifdef'd for Python2 & 3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* virDomainQemuAgentCommand appeared in 0.10.0Daniel P. Berrange2013-11-221-0/+5
| | | | Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import VIR_ALLOC / VIR_ALLOC_N / VIR_REALLOC_N functionsDaniel P. Berrange2013-11-221-0/+1
| | | | | | | Import the libvirt memory allocation functions, stripping the OOM testing and error reporting pieces. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Update header file includesDaniel P. Berrange2013-11-221-5/+2
| | | | | | | | We're no longer using automake, so <config.h> files are not required. Also remove of all libvirt internal util header files. Reference generated header files in build/ subdir. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix leaks in python bindingsCVE-2013-4297Ján Tomko2013-09-031-0/+3
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1003828
* syntax-check: Only allows to include public headers in external toolsOsier Yang2013-04-181-2/+2
| | | | | | With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
* agent: add python module supportv0.10.1v0.10.0-rc2v0.10.0MATSUDA Daiki2012-08-231-0/+29
| | | | | | Add virDomainQemuAgentCommand() support function to python module. Signed-off-by: MATSUDA Daiki <matsudadik@intellilink.co.jp>
* Cleanup for a return statement in source filesMartin Kletzander2012-03-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | Return statements with parameter enclosed in parentheses were modified and parentheses were removed. The whole change was scripted, here is how: List of files was obtained using this command: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' Found files were modified with this command: sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_' Then checked for nonsense. The whole command looks like this: git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \ grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \ 's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \ -e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
* python: drop unused functionv0.9.10-rc2Eric Blake2012-02-071-15/+1
| | | | | | Gcc warned about an unused static function. * python/libvirt-qemu-override.c (py_str): Delete.
* qemu_api: Add override XML and C files for QEMU APIsOsier Yang2011-09-141-0/+136
There is only one function (virDomainQemuMonitorCommand) need to be hand-craft.