[java PATCH] Fix build with jna >= 3.5.0

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

 



Since jna-3.5.0, all subclasses of com.sun.jna.Structure are required to
implement getFieldOrder method which is supposed to return a list of
fields the wrapped structure contains.
---
 src/main/java/org/libvirt/jna/virConnectAuth.java          | 5 +++++
 src/main/java/org/libvirt/jna/virConnectCredential.java    | 6 ++++++
 src/main/java/org/libvirt/jna/virDomainBlockInfo.java      | 4 ++++
 src/main/java/org/libvirt/jna/virDomainBlockStats.java     | 5 +++++
 src/main/java/org/libvirt/jna/virDomainInfo.java           | 5 +++++
 src/main/java/org/libvirt/jna/virDomainInterfaceStats.java | 5 +++++
 src/main/java/org/libvirt/jna/virDomainJobInfo.java        | 7 +++++++
 src/main/java/org/libvirt/jna/virDomainMemoryStats.java    | 4 ++++
 src/main/java/org/libvirt/jna/virError.java                | 6 ++++++
 src/main/java/org/libvirt/jna/virNodeInfo.java             | 8 +++++++-
 src/main/java/org/libvirt/jna/virSchedParameter.java       | 5 +++++
 src/main/java/org/libvirt/jna/virStoragePoolInfo.java      | 5 +++++
 src/main/java/org/libvirt/jna/virStorageVolInfo.java       | 6 +++++-
 src/main/java/org/libvirt/jna/virVcpuInfo.java             | 4 ++++
 14 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/libvirt/jna/virConnectAuth.java b/src/main/java/org/libvirt/jna/virConnectAuth.java
index 74dd65c..369d2e5 100644
--- a/src/main/java/org/libvirt/jna/virConnectAuth.java
+++ b/src/main/java/org/libvirt/jna/virConnectAuth.java
@@ -1,14 +1,19 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Pointer;
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virConnectAuth structure
  */
 public class virConnectAuth extends Structure {
     public Pointer credtype;
     public int ncredtype;
     public Libvirt.VirConnectAuthCallback cb;
     public Pointer cbdata;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "credtype", "ncredtype", "cb", "cbdata" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virConnectCredential.java b/src/main/java/org/libvirt/jna/virConnectCredential.java
index ba47482..dbfc38e 100644
--- a/src/main/java/org/libvirt/jna/virConnectCredential.java
+++ b/src/main/java/org/libvirt/jna/virConnectCredential.java
@@ -1,16 +1,22 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virConnectCredential structure
  */
 public class virConnectCredential extends Structure implements Structure.ByReference {
     public int type;
     public String prompt;
     public String challenge;
     public String defresult;
     // public Pointer result;
     public String result;
     public int resultlen;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "type", "prompt", "challenge", "defresult",
+            "result", "resultlen" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainBlockInfo.java b/src/main/java/org/libvirt/jna/virDomainBlockInfo.java
index 234a381..cbd7385 100644
--- a/src/main/java/org/libvirt/jna/virDomainBlockInfo.java
+++ b/src/main/java/org/libvirt/jna/virDomainBlockInfo.java
@@ -1,10 +1,14 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 public class virDomainBlockInfo extends Structure {
     public long capacity;
     public long allocation;
     public long physical;
 
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "capacity", "allocation", "physical" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainBlockStats.java b/src/main/java/org/libvirt/jna/virDomainBlockStats.java
index f29dba0..71041cc 100644
--- a/src/main/java/org/libvirt/jna/virDomainBlockStats.java
+++ b/src/main/java/org/libvirt/jna/virDomainBlockStats.java
@@ -1,19 +1,24 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virDomainBlockStats structure
  */
 public class virDomainBlockStats extends Structure {
     public long rd_req; // this is a long long in the code, so a long mapping is
     // correct
     public long rd_bytes;// this is a long long in the code, so a long mapping
     // is correct
     public long wr_req; // this is a long long in the code, so a long mapping is
     // correct
     public long wr_bytes;// this is a long long in the code, so a long mapping
     // is correct
     public long errs; // this is a long long in the code, so a long mapping is
     // correct
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "rd_req", "rd_bytes", "wr_req", "wr_bytes", "errs" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainInfo.java b/src/main/java/org/libvirt/jna/virDomainInfo.java
index a93c0a5..994042a 100644
--- a/src/main/java/org/libvirt/jna/virDomainInfo.java
+++ b/src/main/java/org/libvirt/jna/virDomainInfo.java
@@ -1,15 +1,20 @@
 package org.libvirt.jna;
 
 import com.sun.jna.NativeLong;
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virDomainInfo structure
  */
 public class virDomainInfo extends Structure {
     public int state;
     public NativeLong maxMem;
     public NativeLong memory;
     public short nrVirtCpu;
     public long cpuTime;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "state", "maxMem", "memory", "nrVirtCpu", "cpuTime" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainInterfaceStats.java b/src/main/java/org/libvirt/jna/virDomainInterfaceStats.java
index 1cb0e66..dcdd529 100644
--- a/src/main/java/org/libvirt/jna/virDomainInterfaceStats.java
+++ b/src/main/java/org/libvirt/jna/virDomainInterfaceStats.java
@@ -8,19 +8,24 @@ import com.sun.jna.Structure;
 public class virDomainInterfaceStats extends Structure {
     public long rx_bytes; // this is a long long in the code, so a long mapping
     // is correct
     public long rx_packets; // this is a long long in the code, so a long
     // mapping is correct
     public long rx_errs; // this is a long long in the code, so a long mapping
     // is correct
     public long rx_drop; // this is a long long in the code, so a long mapping
     // is correct
     public long tx_bytes; // this is a long long in the code, so a long mapping
     // is correct
     public long tx_packets; // this is a long long in the code, so a long
     // mapping is correct
     public long tx_errs; // this is a long long in the code, so a long mapping
     // is correct
     public long tx_drop; // this is a long long in the code, so a long mapping
     // is correct
 
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "rx_bytes", "rx_packets", "rx_errs", "rx_drop",
+            "tx_bytes", "tx_packets", "tx_errs", "tx_drop" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainJobInfo.java b/src/main/java/org/libvirt/jna/virDomainJobInfo.java
index 98b4f59..af934ad 100644
--- a/src/main/java/org/libvirt/jna/virDomainJobInfo.java
+++ b/src/main/java/org/libvirt/jna/virDomainJobInfo.java
@@ -1,18 +1,25 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 public class virDomainJobInfo extends Structure {
     public int type;
     public long timeElapsed;
     public long timeRemaining;
     public long dataTotal;
     public long dataProcessed;
     public long dataRemaining;
     public long memTotal;
     public long memProcessed;
     public long memRemaining;
     public long fileTotal;
     public long fileProcessed;
     public long fileRemaining;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "type", "timeElapsed", "timeRemaining", "dataTotal",
+            "dataProcessed", "dataRemaining", "memTotal", "memProcessed",
+            "memRemaining", "fileTotal", "fileProcessed", "fileRemaining" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virDomainMemoryStats.java b/src/main/java/org/libvirt/jna/virDomainMemoryStats.java
index 7a9f5d2..ec7b29e 100644
--- a/src/main/java/org/libvirt/jna/virDomainMemoryStats.java
+++ b/src/main/java/org/libvirt/jna/virDomainMemoryStats.java
@@ -1,8 +1,12 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 public class virDomainMemoryStats extends Structure {
     public int tag ;
     public long val ;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] { "tag", "val" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virError.java b/src/main/java/org/libvirt/jna/virError.java
index e2580dd..9009280 100644
--- a/src/main/java/org/libvirt/jna/virError.java
+++ b/src/main/java/org/libvirt/jna/virError.java
@@ -4,19 +4,25 @@ import com.sun.jna.Pointer;
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virError structure
  */
 public class virError extends Structure {
     public int code;
     public int domain;
     public String message;
     public int level;
     public ConnectionPointer conn;
     public DomainPointer dom;
     public String str1;
     public String str2;
     public String str3;
     public int int1;
     public int int2;
     public NetworkPointer net;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "code", "domain", "message", "level", "conn", "dom",
+            "str1", "str2", "str3", "int1", "int2", "net" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virNodeInfo.java b/src/main/java/org/libvirt/jna/virNodeInfo.java
index 532aad9..f13eddc 100644
--- a/src/main/java/org/libvirt/jna/virNodeInfo.java
+++ b/src/main/java/org/libvirt/jna/virNodeInfo.java
@@ -6,19 +6,25 @@ import com.sun.jna.Structure;
 /**
  * JNA mapping for the virNodeInfo structure
  */
 public class virNodeInfo extends Structure {
     public class ByReference extends virNodeInfo implements Structure.ByReference {
     };
 
     public class ByValue extends virNodeInfo implements Structure.ByValue {
     };
 
     public byte model[] = new byte[32];
     public NativeLong memory;
     public int cpus;
     public int mhz;
     public int nodes;
     public int sockets;
     public int cores;
     public int threads;
-}
\ No newline at end of file
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "model", "memory", "cpus", "mhz", "nodes",
+            "sockets", "cores", "threads" });
+    }
+}
diff --git a/src/main/java/org/libvirt/jna/virSchedParameter.java b/src/main/java/org/libvirt/jna/virSchedParameter.java
index 0013fff..9496121 100644
--- a/src/main/java/org/libvirt/jna/virSchedParameter.java
+++ b/src/main/java/org/libvirt/jna/virSchedParameter.java
@@ -1,12 +1,17 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virSchedParameter structure
  */
 public class virSchedParameter extends Structure {
     public byte field[] = new byte[Libvirt.VIR_DOMAIN_SCHED_FIELD_LENGTH];
     public int type;
     public virSchedParameterValue value;
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "field", "type", "value" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virStoragePoolInfo.java b/src/main/java/org/libvirt/jna/virStoragePoolInfo.java
index 5a98e08..7f370cd 100644
--- a/src/main/java/org/libvirt/jna/virStoragePoolInfo.java
+++ b/src/main/java/org/libvirt/jna/virStoragePoolInfo.java
@@ -1,16 +1,21 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virStoragePoolInfo structure
  */
 public class virStoragePoolInfo extends Structure {
     public int state;
     public long capacity; // this is a long long in the code, so a long mapping
     // is correct
     public long allocation; // this is a long long in the code, so a long
     // mapping is correct
     public long available; // this is a long long in the code, so a long mapping
     // is correct
+
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "state", "capacity", "allocation", "available" });
+    }
 }
diff --git a/src/main/java/org/libvirt/jna/virStorageVolInfo.java b/src/main/java/org/libvirt/jna/virStorageVolInfo.java
index db8a5bd..a02219e 100644
--- a/src/main/java/org/libvirt/jna/virStorageVolInfo.java
+++ b/src/main/java/org/libvirt/jna/virStorageVolInfo.java
@@ -1,15 +1,19 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virStorageVolInfo structure
  */
 public class virStorageVolInfo extends Structure {
     public int type;
     public long capacity; // this is a long long in the code, so a long mapping
     // is correct
     public long allocation; // this is a long long in the code, so a long
     // mapping is correct
 
-}
\ No newline at end of file
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "type", "capacity", "allocation" });
+    }
+}
diff --git a/src/main/java/org/libvirt/jna/virVcpuInfo.java b/src/main/java/org/libvirt/jna/virVcpuInfo.java
index 16f237d..e5f4363 100644
--- a/src/main/java/org/libvirt/jna/virVcpuInfo.java
+++ b/src/main/java/org/libvirt/jna/virVcpuInfo.java
@@ -1,15 +1,19 @@
 package org.libvirt.jna;
 
 import com.sun.jna.Structure;
 
 /**
  * JNA mapping for the virVcpuInfo structure
  */
 public class virVcpuInfo extends Structure {
     public int number;
     public int state;
     public long cpuTime; // this is a long long in the code, so a long mapping
     // is correct
     public int cpu;
 
+    protected java.util.List getFieldOrder() {
+        return java.util.Arrays.asList(new String[] {
+            "number", "state", "cpuTime", "cpu" });
+    }
 }
-- 
1.8.0

--
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]