Commit 5ec94099 authored by Michael Corcoran's avatar Michael Corcoran Committed by Michal Privoznik

Replace U64 with struct counter64 to fix build

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's avatarMichael Corcoran <tracer@outlook.co.nz>
Signed-off-by: 's avatarMichal Privoznik <mprivozn@redhat.com>
parent 53709438
......@@ -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
......
......@@ -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 struct counter64.
*/
/*---------------------------------------------------------------------
* LIBVIRT-MIB::libvirtGuestEntry.libvirtGuestRowStatus
......
......@@ -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/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
......
......@@ -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 struct counter64.
*/
/**
* Extract the current value of the libvirtGuestCpuTime data.
......@@ -452,14 +452,14 @@ The CPU time used by the virtual guest, in nanoseconds.
* @param rowreq_ctx
* Pointer to the row request context.
* @param libvirtGuestCpuTime_val_ptr
* Pointer to storage for a U64 variable
* Pointer to storage for a struct counter64 variable
*
* @retval MFD_SUCCESS : success
* @retval MFD_SKIP : skip this node (no value for now)
* @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 );
......
......@@ -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 );
......
......@@ -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);
......
......@@ -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/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/struct counter64//l/A/w/e/r/d/h */
case COLUMN_LIBVIRTGUESTCPUTIME:
rc = SNMP_ERR_NOTWRITABLE;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment