[snmp PATCH 1/2] Replace U64 with struct counter64 to fix build

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

 



Upstream net-snmp removed the U64 typedef in 2016 as it clashed with a
name in Perl, thus all usages of U64 must be replaced by struct counter64 to
compile against recent versions of net-snmp.

The replacements were made by hand, while referencing diff with new
source generated by the mib2c tool. net-snmp have a mib2c-update tool
which supposedly assists with updating existing (modified) source code
but I was unable to get it to work.

Signed-off-by: Michael Corcoran <tracer@xxxxxxxxxxxxx>
---
 src/defaults/node-libvirtGuestCpuTime.m2d          | 2 +-
 src/libvirtGuestTable-README-libvirtGuestTable.txt | 2 +-
 src/libvirtGuestTable.h                            | 4 ++--
 src/libvirtGuestTable_data_get.c                   | 4 ++--
 src/libvirtGuestTable_data_get.h                   | 2 +-
 src/libvirtGuestTable_data_set.h                   | 4 ++--
 src/libvirtGuestTable_interface.c                  | 8 ++++----
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/defaults/node-libvirtGuestCpuTime.m2d b/src/defaults/node-libvirtGuestCpuTime.m2d
index 795f697..fc93506 100644
--- a/src/defaults/node-libvirtGuestCpuTime.m2d
+++ b/src/defaults/node-libvirtGuestCpuTime.m2d
@@ -11,7 +11,7 @@
 ## If you do, it is likely to break lots of generated code that
 ## you will have to fix.
 ##
-## @eval $m2c_decl = U64@
+## @eval $m2c_decl = "struct counter64"@
 ##
 ########################################################################
 ## Generate/use mapping functions? Useful if the MIB defines
diff --git a/src/libvirtGuestTable-README-libvirtGuestTable.txt b/src/libvirtGuestTable-README-libvirtGuestTable.txt
index 5a74dae..74e2274 100644
--- a/src/libvirtGuestTable-README-libvirtGuestTable.txt
+++ b/src/libvirtGuestTable-README-libvirtGuestTable.txt
@@ -722,7 +722,7 @@ The CPU time used by the virtual guest, in nanoseconds.
  *
  *
  * Its syntax is COUNTER64 (based on perltype COUNTER64)
- * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (struct counter64)
  */
 /*---------------------------------------------------------------------
  * LIBVIRT-MIB::libvirtGuestEntry.libvirtGuestRowStatus
diff --git a/src/libvirtGuestTable.h b/src/libvirtGuestTable.h
index ca27abd..6762238 100644
--- a/src/libvirtGuestTable.h
+++ b/src/libvirtGuestTable.h
@@ -119,9 +119,9 @@ typedef struct libvirtGuestTable_data_s {
    u_long   libvirtGuestMemoryLimit;
 
         /*
-         * libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h
+         * libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(struct counter64)//l/A/w/e/r/d/h
          */
-   U64   libvirtGuestCpuTime;
+   struct counter64   libvirtGuestCpuTime;
 
         /*
          * libvirtGuestRowStatus(9)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
diff --git a/src/libvirtGuestTable_data_get.c b/src/libvirtGuestTable_data_get.c
index b252bdd..08ddb4a 100644
--- a/src/libvirtGuestTable_data_get.c
+++ b/src/libvirtGuestTable_data_get.c
@@ -442,7 +442,7 @@ The CPU time used by the virtual guest, in nanoseconds.
  *
  *
  * Its syntax is COUNTER64 (based on perltype COUNTER64)
- * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (U64)
+ * The net-snmp type is ASN_COUNTER64. The C type decl is U64 (struct counter64)
  */
 /**
  * Extract the current value of the libvirtGuestCpuTime data.
@@ -459,7 +459,7 @@ The CPU time used by the virtual guest, in nanoseconds.
  * @retval MFD_ERROR           : Any other error
  */
 int
-libvirtGuestCpuTime_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, U64 * libvirtGuestCpuTime_val_ptr )
+libvirtGuestCpuTime_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, struct counter64 * libvirtGuestCpuTime_val_ptr )
 {
    /** we should have a non-NULL pointer */
    netsnmp_assert( NULL != libvirtGuestCpuTime_val_ptr );
diff --git a/src/libvirtGuestTable_data_get.h b/src/libvirtGuestTable_data_get.h
index 450d112..6a0e7ff 100644
--- a/src/libvirtGuestTable_data_get.h
+++ b/src/libvirtGuestTable_data_get.h
@@ -55,7 +55,7 @@ extern "C" {
     int libvirtGuestCpuCount_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long * libvirtGuestCpuCount_val_ptr );
     int libvirtGuestMemoryCurrent_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long * libvirtGuestMemoryCurrent_val_ptr );
     int libvirtGuestMemoryLimit_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long * libvirtGuestMemoryLimit_val_ptr );
-    int libvirtGuestCpuTime_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, U64 * libvirtGuestCpuTime_val_ptr );
+    int libvirtGuestCpuTime_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, struct counter64 * libvirtGuestCpuTime_val_ptr );
     int libvirtGuestRowStatus_get( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long * libvirtGuestRowStatus_val_ptr );
 
 
diff --git a/src/libvirtGuestTable_data_set.h b/src/libvirtGuestTable_data_set.h
index cce0fe7..873f9f5 100644
--- a/src/libvirtGuestTable_data_set.h
+++ b/src/libvirtGuestTable_data_set.h
@@ -80,9 +80,9 @@ int libvirtGuestMemoryLimit_undo_setup( libvirtGuestTable_rowreq_ctx *rowreq_ctx
 int libvirtGuestMemoryLimit_set( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long libvirtGuestMemoryLimit_val );
 int libvirtGuestMemoryLimit_undo( libvirtGuestTable_rowreq_ctx *rowreq_ctx );
 
-int libvirtGuestCpuTime_check_value( libvirtGuestTable_rowreq_ctx *rowreq_ctx, U64 libvirtGuestCpuTime_val);
+int libvirtGuestCpuTime_check_value( libvirtGuestTable_rowreq_ctx *rowreq_ctx, struct counter64 libvirtGuestCpuTime_val);
 int libvirtGuestCpuTime_undo_setup( libvirtGuestTable_rowreq_ctx *rowreq_ctx );
-int libvirtGuestCpuTime_set( libvirtGuestTable_rowreq_ctx *rowreq_ctx, U64 libvirtGuestCpuTime_val );
+int libvirtGuestCpuTime_set( libvirtGuestTable_rowreq_ctx *rowreq_ctx, struct counter64 libvirtGuestCpuTime_val );
 int libvirtGuestCpuTime_undo( libvirtGuestTable_rowreq_ctx *rowreq_ctx );
 
 int libvirtGuestRowStatus_check_value( libvirtGuestTable_rowreq_ctx *rowreq_ctx, u_long libvirtGuestRowStatus_val);
diff --git a/src/libvirtGuestTable_interface.c b/src/libvirtGuestTable_interface.c
index ce29c3b..ee48291 100644
--- a/src/libvirtGuestTable_interface.c
+++ b/src/libvirtGuestTable_interface.c
@@ -842,11 +842,11 @@ rc = libvirtGuestMemoryCurrent_get(rowreq_ctx, (u_long *)var->val.string );
 rc = libvirtGuestMemoryLimit_get(rowreq_ctx, (u_long *)var->val.string );
         break;
 
-    /* libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h */
+    /* libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(struct counter64)//l/A/w/e/r/d/h */
     case COLUMN_LIBVIRTGUESTCPUTIME:
-    var->val_len = sizeof(U64);
+    var->val_len = sizeof(struct counter64);
     var->type = ASN_COUNTER64;
-rc = libvirtGuestCpuTime_get(rowreq_ctx, (U64 *)var->val.string );
+rc = libvirtGuestCpuTime_get(rowreq_ctx, (struct counter64 *)var->val.string );
         break;
 
     /* libvirtGuestRowStatus(9)/RowStatus/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h */
@@ -1022,7 +1022,7 @@ _libvirtGuestTable_check_column( libvirtGuestTable_rowreq_ctx *rowreq_ctx,
         rc = SNMP_ERR_NOTWRITABLE;
         break;
 
-    /* libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(U64)//l/A/w/e/r/d/h */
+    /* libvirtGuestCpuTime(7)/COUNTER64/ASN_COUNTER64/U64(struct counter64)//l/A/w/e/r/d/h */
     case COLUMN_LIBVIRTGUESTCPUTIME:
         rc = SNMP_ERR_NOTWRITABLE;
         break;

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

  Powered by Linux