[java] [PATCH] JNA: add missing flags parameter to wrapped functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some functions of the Libvirt interface were missing a required flags
parameter as defined by the libvirt C API, namely:

 * virInterfaceCreate
 * virInterfaceDestroy
 * virNodeDeviceGetXMLDesc

Calling these functions without the flags parameter would result in
undefined behaviour, at best in an "unsupported flags" error.
---
Reported by Matt Russell via personal email. Thanks, Matt!

Pushing under the trivial rule.

 src/main/java/org/libvirt/Device.java      | 2 +-
 src/main/java/org/libvirt/Interface.java   | 4 ++--
 src/main/java/org/libvirt/jna/Libvirt.java | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/libvirt/Device.java b/src/main/java/org/libvirt/Device.java
index a3b20b8..3c876c6 100644
--- a/src/main/java/org/libvirt/Device.java
+++ b/src/main/java/org/libvirt/Device.java
@@ -118,7 +118,7 @@ public class Device {
      * @throws LibvirtException
      */
     public String getXMLDescription() throws LibvirtException {
-        return processError(libvirt.virNodeDeviceGetXMLDesc(VDP));
+        return processError(libvirt.virNodeDeviceGetXMLDesc(VDP, 0));
     }
 
     /**
diff --git a/src/main/java/org/libvirt/Interface.java b/src/main/java/org/libvirt/Interface.java
index e0ddc3f..4c9670c 100644
--- a/src/main/java/org/libvirt/Interface.java
+++ b/src/main/java/org/libvirt/Interface.java
@@ -52,7 +52,7 @@ public class Interface {
      * @throws LibvirtException
      */
     public int create() throws LibvirtException {
-        return processError(libvirt.virInterfaceCreate(VIP));
+        return processError(libvirt.virInterfaceCreate(VIP, 0));
     }
 
     /**
@@ -71,7 +71,7 @@ public class Interface {
      * @throws LibvirtException
      */
     public int destroy() throws LibvirtException {
-        return processError(libvirt.virInterfaceDestroy(VIP));
+        return processError(libvirt.virInterfaceDestroy(VIP, 0));
     }
 
     @Override
diff --git a/src/main/java/org/libvirt/jna/Libvirt.java b/src/main/java/org/libvirt/jna/Libvirt.java
index 4d76071..a17bfc7 100644
--- a/src/main/java/org/libvirt/jna/Libvirt.java
+++ b/src/main/java/org/libvirt/jna/Libvirt.java
@@ -350,7 +350,7 @@ public interface Libvirt extends Library {
     String virNodeDeviceGetParent(DevicePointer virDevicePointer);
     int virNodeDeviceNumOfCaps(DevicePointer virDevicePointer);
     int virNodeDeviceListCaps(DevicePointer virDevicePointer, Pointer[] names, int maxNames);
-    String virNodeDeviceGetXMLDesc(DevicePointer virDevicePointer);
+    String virNodeDeviceGetXMLDesc(DevicePointer virDevicePointer, int flags);
     int virNodeDeviceFree(DevicePointer virDevicePointer);
     int virNodeDeviceDettach(DevicePointer virDevicePointer);
     int virNodeDeviceReAttach(DevicePointer virDevicePointer);
@@ -402,9 +402,9 @@ public interface Libvirt extends Library {
     int virStorageVolResize(StorageVolPointer storageVolPtr, long capacity, int flags);
 
     // Interface Methods
-    int virInterfaceCreate(InterfacePointer virDevicePointer);
+    int virInterfaceCreate(InterfacePointer virDevicePointer, int flags);
     InterfacePointer virInterfaceDefineXML(ConnectionPointer virConnectPtr, String xml, int flags);
-    int virInterfaceDestroy(InterfacePointer virDevicePointer);
+    int virInterfaceDestroy(InterfacePointer virDevicePointer, int flags);
     int virInterfaceFree(InterfacePointer virDevicePointer);
     String virInterfaceGetName(InterfacePointer virInterfacePtr);
     String virInterfaceGetMACString(InterfacePointer virInterfacePtr);
-- 
2.2.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]