summaryrefslogtreecommitdiff
path: root/typewrappers.h
Commit message (Collapse)AuthorAgeFilesLines
* Replace uint with unsigned intBastian Germann2022-09-091-1/+1
| | | | | | Mingw-w64 target does not support uint definition. Signed-off-by: Bastian Germann <bage@linutronix.de>
* Avoid use of thread function deprecated in 3.9Daniel P. Berrangé2020-11-121-4/+24
| | | | | | | | PyEval_ThreadsInitialized was deprecated in 3.9, with deletion targetted for 3.11. Furthermore since 3.7 it is guaranteed that threads are always initialized by Py_Initialize(), so checking it is redundant. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* debug: Fix bit-rot in debug outputPhilipp Hahn2020-07-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-5/+0
| | | | | | | | | 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>
* Define virDomainCheckpointPtr typedef on old libvirtEric Blake2019-07-291-0/+3
| | | | | | Needed prior to 5.6.0 Signed-off-by: Eric Blake <eblake@redhat.com>
* Add virDomainCheckpoint APIsEric Blake2019-07-291-0/+10
| | | | | | | | | Copies heavily from existing virDomainSnapshot handling, regarding what special cases the generator has to be taught and what overrides need to be written. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
* Define virNetworkPortPtr typedef on old libvirtDaniel P. Berrangé2019-06-201-0/+3
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Add support for virNetworkPort object & APIsDaniel P. Berrangé2019-06-201-0/+10
| | | | | | | | | Define the various rules in the generator to wire up methods into the virNetwork class and create the new virNetworkPort class. Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* fix build with older libvirt missing virNWFilterBindingPtrDaniel P. Berrangé2018-07-161-0/+4
| | | | | | | | | | While we correctly disable all public API bindings that rely on virNWFilterBindingPtr, the generator is still creating a helper function that needs it - libvirt_virNWFilterBinding_pointer. Making this helper conditional is a little hairy, so just provide a trivial typedef to keep it happy. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Add support for nwfilter binding objects / apisDaniel P. Berrangé2018-06-281-0/+10
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* override: Switch virStreamSend wrapper to use libvirt_charPtrSizeUnwrapDaniel P. Berrange2013-12-111-0/+1
| | | | | | | | Instead of using a 'z#i' format string to receive byte array, use 'O' and then libvirt_charPtrSizeUnwrap. This lets us hide the Python 3 vs 2 differences in typewrappers.c Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace Py{Int,Long}_FromLong with helpersDaniel P. Berrange2013-12-111-0/+1
| | | | | | | | | Replace use of the PyInt_FromLong and PyLong_FromLongLong with libvirt_{int,uint,longlong,ulonglong}Wrap helpers. This isolates the need for Python3 specific code in one place. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Replace PyString_AsString with libvirt_charPtrUnwrapDaniel P. Berrange2013-12-111-0/+1
| | | | | | | | | | | Replace calls to PyString_AsString with the helper method libvirt_charPtrUnwrap. This isolates the code that will change in Python3. In making this change, all callers now have responsibility for free'ing the string. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Add missing binding of security model/label APIsv1.2.0-rc2Daniel P. Berrange2013-11-271-0/+1
| | | | | | | | The virNodeGetSecurityModel, virDomainGetSecurityLabel and virDomainGetSecurityLabelList methods were disabled in the python binding for inexplicable reasons. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* 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.
* python: Add new helper functions for python to C integral conversionGuannan Ren2012-03-281-0/+9
| | | | | | | | | | | int libvirt_intUnwrap(PyObject *obj, int *val); int libvirt_uintUnwrap(PyObject *obj, unsigned int *val); int libvirt_longUnwrap(PyObject *obj, long *val); int libvirt_ulongUnwrap(PyObject *obj, unsigned long *val); int libvirt_longlongUnwrap(PyObject *obj, long long *val); int libvirt_ulonglongUnwrap(PyObject *obj, unsigned long long *val); int libvirt_doubleUnwrap(PyObject *obj, double *val); int libvirt_boolUnwrap(PyObject *obj, bool *val);
* python: drop redundant functionEric Blake2012-02-031-2/+1
| | | | | | | | | I noticed some redundant code while preparing my next patch. * python/generator.py (py_types): Fix 'const char *' mapping. * python/typewrappers.h (libvirt_charPtrConstWrap): Drop. * python/typewrappers.c (libvirt_charPtrConstWrap): Delete, since it is identical to libvirt_constcharPtrWrap.
* python: Don't declare Py_ssize_t for Python 2.6v0.9.3-rc2v0.9.3-rc1Matthias Bolte2011-06-241-1/+1
| | | | | | | | Commit cd48c3f4e95597 added a Py_ssize_t typedef for Python < 2.7. But Py_ssize_t was added in Python 2.5. This makes the build fail for Python 2.6. Adjust the check to match Python < 2.5 to fix this.
* build: avoid python 2.4 build failureEric Blake2011-06-241-1/+6
| | | | | | | | I'm not sure when Py_ssize_t was introduced; but Fedora 14 Python 2.7 has it, while RHEL 5 Python 2.4 lacks it. It should be easy enough to adjust if someone runs into problems. * python/typewrappers.h (Py_ssize_t): Define for older python.
* python: Implement virStreamSend/RecvCole Robinson2011-06-211-0/+1
| | | | | | | The return values for the python version are different that the C version of virStreamSend: on success we return a string, an error raises an exception, and if the stream would block we return int(-2). We need to do this since strings aren't passed by reference in python.
* python: Implement bindings for virStreamEventAddCallbackCole Robinson2011-06-201-1/+0
| | | | | v2: Don't generate virStreamFree
* nwfilter: python bindings for nwfilterStefan Berger2010-04-291-0/+9
| | | | | I have primarily followed the pattern of the 'secret' driver to provide support for the missing python bindings for the network filter API.
* Snapshot API framework.Chris Lalancette2010-04-051-0/+10
| | | | Signed-off-by: Chris Lalancette <clalance@redhat.com>
* build: consistently indent preprocessor directivesEric Blake2010-03-091-7/+7
| | | | | | | * global: patch created by running: for f in $(git ls-files '*.[ch]') ; do cppi $f > $f.t && mv $f.t $f done
* Introduce public API for domain async job handlingv0.7.7Daniel P. Berrange2010-03-021-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new public API that provides a way to get progress info on currently running jobs on a virDomainpPtr. APIs that are initially within scope of this idea are virDomainMigrate virDomainMigrateToURI virDomainSave virDomainRestore virDomainCoreDump These all take a potentially long time and benefit from monitoring. The virDomainJobInfo struct allows for various pieces of information to be reported - Percentage completion - Time - Overall data - Guest memory data - Guest disk/file data * include/libvirt/libvirt.h.in: Add virDomainGetJobInfo * python/generator.py, python/libvirt-override-api.xml, python/libvirt-override.c: Override for virDomainGetJobInfo API * python/typewrappers.c, python/typewrappers.h: Introduce wrapper for unsigned long long type
* Add public API definition for data stream handlingDaniel P. Berrange2009-09-291-0/+10
| | | | | | | | | | | | | | | | | | | * include/libvirt/libvirt.h.in: Public API contract for virStreamPtr object * src/libvirt_public.syms: Export data stream APIs * src/libvirt_private.syms: Export internal helper APIs * src/libvirt.c: Data stream API driver dispatch * src/datatypes.h, src/datatypes.c: Internal helpers for virStreamPtr object * src/driver.h: Define internal driver API for streams * .x-sc_avoid_write: Ignore src/libvirt.c because it trips up on comments including write() * python/Makefile.am: Add libvirt-override-virStream.py * python/generator.py: Add rules for virStreamPtr class * python/typewrappers.h, python/typewrappers.c: Wrapper for virStreamPtr * docs/libvirt-api.xml, docs/libvirt-refs.xml: Regenerate with new APIs
* Re-arrange python generator to make it clear what's auto-generatedDaniel P. Berrange2009-09-211-0/+196
* README: New file describing what each file is used for * livvirt-override.c, libvirt-override.py, libvirt-override-api.xml, libvirt-override-virConnect.py: Manually written code overriding the generator * typewrappers.c, typewrappers.h: Data type wrappers * generator.py: Automatically pre-prend contents of libvirt-override.py to generated libvirt.py. Output into libvirt.py directly instead of libvirtclass.py. Don't generate libvirtclass.txt at all. Write C files into libvirt.c/.h directly * Makefile.am: Remove rule for creating libvirt.py from libvirt-override.py and libvirtclass.py, since generator.py does it directly