[go PATCH 5/8] Use 'cnparams' for virTypedParameters array length variables

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

 



Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
---
 connect.go       |  50 +++++------
 domain.go        | 224 +++++++++++++++++++++++------------------------
 domain_events.go |  20 ++---
 3 files changed, 147 insertions(+), 147 deletions(-)

diff --git a/connect.go b/connect.go
index e2ff88a..11a6a8c 100644
--- a/connect.go
+++ b/connect.go
@@ -1738,22 +1738,22 @@ type NodeCPUStats struct {
 
 // See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetCPUStats
 func (c *Connect) GetCPUStats(cpuNum int, flags uint32) (*NodeCPUStats, error) {
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), nil, &nparams, C.uint(0), &err)
+	ret := C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), nil, &cnparams, C.uint(0), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	params := make([]C.virNodeCPUStats, nparams)
-	ret = C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), (*C.virNodeCPUStats)(unsafe.Pointer(&params[0])), &nparams, C.uint(flags), &err)
+	params := make([]C.virNodeCPUStats, cnparams)
+	ret = C.virNodeGetCPUStatsWrapper(c.ptr, C.int(cpuNum), (*C.virNodeCPUStats)(unsafe.Pointer(&params[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
 	stats := &NodeCPUStats{}
-	for i := 0; i < int(nparams); i++ {
+	for i := 0; i < int(cnparams); i++ {
 		param := params[i]
 		field := C.GoString((*C.char)(unsafe.Pointer(&param.field)))
 		switch field {
@@ -1897,21 +1897,21 @@ func (c *Connect) GetMemoryParameters(flags uint32) (*NodeMemoryParameters, erro
 	params := &NodeMemoryParameters{}
 	info := getMemoryParameterFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, C.uint(0), &err)
+	ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &cnparams, C.uint(0), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -1934,22 +1934,22 @@ type NodeMemoryStats struct {
 
 // See also https://libvirt.org/html/libvirt-libvirt-host.html#virNodeGetMemoryStats
 func (c *Connect) GetMemoryStats(cellNum int, flags uint32) (*NodeMemoryStats, error) {
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), nil, &nparams, 0, &err)
+	ret := C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	params := make([]C.virNodeMemoryStats, nparams)
-	ret = C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), (*C.virNodeMemoryStats)(unsafe.Pointer(&params[0])), &nparams, C.uint(flags), &err)
+	params := make([]C.virNodeMemoryStats, cnparams)
+	ret = C.virNodeGetMemoryStatsWrapper(c.ptr, C.int(cellNum), (*C.virNodeMemoryStats)(unsafe.Pointer(&params[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
 	stats := &NodeMemoryStats{}
-	for i := 0; i < int(nparams); i++ {
+	for i := 0; i < int(cnparams); i++ {
 		param := params[i]
 		field := C.GoString((*C.char)(unsafe.Pointer(&param.field)))
 		switch field {
@@ -1995,28 +1995,28 @@ func (c *Connect) GetSecurityModel() (*NodeSecurityModel, error) {
 func (c *Connect) SetMemoryParameters(params *NodeMemoryParameters, flags uint32) error {
 	info := getMemoryParameterFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &nparams, 0, &err)
+	ret := C.virNodeGetMemoryParametersWrapper(c.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virNodeGetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virNodeSetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virNodeSetMemoryParametersWrapper(c.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -2967,17 +2967,17 @@ func (c *Connect) GetSEVInfo(flags uint32) (*NodeSEVParameters, error) {
 	info := getNodeSEVFieldInfo(params)
 
 	var cparams *C.virTypedParameter
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virNodeGetSEVInfoWrapper(c.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+	ret := C.virNodeGetSEVInfoWrapper(c.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsFree(cparams, nparams)
+	defer C.virTypedParamsFree(cparams, cnparams)
 
-	_, gerr := typedParamsUnpackLen(cparams, nparams, info)
+	_, gerr := typedParamsUnpackLen(cparams, cnparams, info)
 	if gerr != nil {
 		return nil, gerr
 	}
diff --git a/domain.go b/domain.go
index 09d6a71..6c40f10 100644
--- a/domain.go
+++ b/domain.go
@@ -1173,17 +1173,17 @@ func (d *Domain) GetCPUStats(startCpu int, nCpus uint, flags uint32) ([]DomainCP
 	if ret == -1 {
 		return []DomainCPUStats{}, makeError(&err)
 	}
-	nparams := uint(ret)
+	cnparams := uint(ret)
 
 	var cparams []C.virTypedParameter
 	var nallocparams uint
 	if startCpu == -1 {
-		nallocparams = nparams
+		nallocparams = cnparams
 	} else {
-		nallocparams = nparams * nCpus
+		nallocparams = cnparams * nCpus
 	}
 	cparams = make([]C.virTypedParameter, nallocparams)
-	ret = C.virDomainGetCPUStatsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), C.uint(nparams), C.int(startCpu), C.uint(nCpus), C.uint(flags), &err)
+	ret = C.virDomainGetCPUStatsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), C.uint(cnparams), C.int(startCpu), C.uint(nCpus), C.uint(flags), &err)
 	if ret == -1 {
 		return []DomainCPUStats{}, makeError(&err)
 	}
@@ -1192,7 +1192,7 @@ func (d *Domain) GetCPUStats(startCpu int, nCpus uint, flags uint32) ([]DomainCP
 
 	stats := make([]DomainCPUStats, nCpus)
 	for i := 0; i < int(nCpus); i++ {
-		offset := i * int(nparams)
+		offset := i * int(cnparams)
 		info := getCPUStatsFieldInfo(&stats[i])
 		cparamscpu := cparams[offset : offset+int(ret)]
 		_, gerr := typedParamsUnpack(cparamscpu, info)
@@ -1258,23 +1258,23 @@ func (d *Domain) GetInterfaceParameters(device string, flags DomainModificationI
 	params := &DomainInterfaceParameters{}
 	info := getInterfaceParameterFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	cdevice := C.CString(device)
 	defer C.free(unsafe.Pointer(cdevice))
 	var err C.virError
-	ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &nparams, C.uint(0), &err)
+	ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &cnparams, C.uint(0), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -1288,30 +1288,30 @@ func (d *Domain) GetInterfaceParameters(device string, flags DomainModificationI
 func (d *Domain) SetInterfaceParameters(device string, params *DomainInterfaceParameters, flags DomainModificationImpact) error {
 	info := getInterfaceParameterFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	cdevice := C.CString(device)
 	defer C.free(unsafe.Pointer(cdevice))
 	var err C.virError
-	ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &nparams, 0, &err)
+	ret := C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetInterfaceParametersWrapper(d.ptr, cdevice, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -1661,23 +1661,23 @@ func (d *Domain) BlockStatsFlags(disk string, flags uint32) (*DomainBlockStats,
 	params := &DomainBlockStats{}
 	info := getBlockStatsFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	cdisk := C.CString(disk)
 	defer C.free(unsafe.Pointer(cdisk))
 	var err C.virError
-	ret := C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, nil, &nparams, C.uint(0), &err)
+	ret := C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, nil, &cnparams, C.uint(0), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainBlockStatsFlagsWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -2609,20 +2609,20 @@ func (d *Domain) GetBlkioParameters(flags DomainModificationImpact) (*DomainBlki
 	params := &DomainBlkioParameters{}
 	info := getBlkioParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -2636,28 +2636,28 @@ func (d *Domain) GetBlkioParameters(flags DomainModificationImpact) (*DomainBlki
 func (d *Domain) SetBlkioParameters(params *DomainBlkioParameters, flags DomainModificationImpact) error {
 	info := getBlkioParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetBlkioParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetBlkioParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -2801,20 +2801,20 @@ func (d *Domain) GetBlockIoTune(disk string, flags DomainModificationImpact) (*D
 	params := &DomainBlockIoTuneParameters{}
 	info := getBlockIoTuneParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &nparams, 0, &err)
+	ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -2831,28 +2831,28 @@ func (d *Domain) SetBlockIoTune(disk string, params *DomainBlockIoTuneParameters
 
 	info := getBlockIoTuneParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &nparams, 0, &err)
+	ret := C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetBlockIoTuneWrapper(d.ptr, cdisk, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -3195,19 +3195,19 @@ func getDomainJobInfoFieldInfo(params *DomainJobInfo) map[string]typedParamsFiel
 // See also https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainGetJobStats
 func (d *Domain) GetJobStats(flags DomainGetJobStatsFlags) (*DomainJobInfo, error) {
 	var cparams *C.virTypedParameter
-	var nparams C.int
+	var cnparams C.int
 	var jobtype C.int
 	var err C.virError
-	ret := C.virDomainGetJobStatsWrapper(d.ptr, &jobtype, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+	ret := C.virDomainGetJobStatsWrapper(d.ptr, &jobtype, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
-	defer C.virTypedParamsFree(cparams, nparams)
+	defer C.virTypedParamsFree(cparams, cnparams)
 
 	params := DomainJobInfo{}
 	info := getDomainJobInfoFieldInfo(&params)
 
-	_, gerr := typedParamsUnpackLen(cparams, nparams, info)
+	_, gerr := typedParamsUnpackLen(cparams, cnparams, info)
 	if gerr != nil {
 		return nil, gerr
 	}
@@ -3287,20 +3287,20 @@ func (d *Domain) GetMemoryParameters(flags DomainModificationImpact) (*DomainMem
 	params := &DomainMemoryParameters{}
 	info := getDomainMemoryParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -3314,28 +3314,28 @@ func (d *Domain) GetMemoryParameters(flags DomainModificationImpact) (*DomainMem
 func (d *Domain) SetMemoryParameters(params *DomainMemoryParameters, flags DomainModificationImpact) error {
 	info := getDomainMemoryParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetMemoryParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetMemoryParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -3368,20 +3368,20 @@ func (d *Domain) GetNumaParameters(flags DomainModificationImpact) (*DomainNumaP
 	params := &DomainNumaParameters{}
 	info := getDomainNumaParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -3395,28 +3395,28 @@ func (d *Domain) GetNumaParameters(flags DomainModificationImpact) (*DomainNumaP
 func (d *Domain) SetNumaParameters(params *DomainNumaParameters, flags DomainModificationImpact) error {
 	info := getDomainNumaParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &nparams, 0, &err)
+	ret := C.virDomainGetNumaParametersWrapper(d.ptr, nil, &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret = C.virDomainGetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetNumaParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -3576,16 +3576,16 @@ func (d *Domain) GetPerfEvents(flags DomainModificationImpact) (*DomainPerfEvent
 	info := getDomainPerfEventsFieldInfo(params)
 
 	var cparams *C.virTypedParameter
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+	ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsFree(cparams, nparams)
+	defer C.virTypedParamsFree(cparams, cnparams)
 
-	_, gerr := typedParamsUnpackLen(cparams, nparams, info)
+	_, gerr := typedParamsUnpackLen(cparams, cnparams, info)
 	if gerr != nil {
 		return nil, gerr
 	}
@@ -3602,21 +3602,21 @@ func (d *Domain) SetPerfEvents(params *DomainPerfEvents, flags DomainModificatio
 	info := getDomainPerfEventsFieldInfo(params)
 
 	var cparams *C.virTypedParameter
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+	ret := C.virDomainGetPerfEventsWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
 
-	defer C.virTypedParamsFree(cparams, nparams)
+	defer C.virTypedParamsFree(cparams, cnparams)
 
-	gerr := typedParamsPackLen(cparams, int(nparams), info)
+	gerr := typedParamsPackLen(cparams, int(cnparams), info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetPerfEventsWrapper(d.ptr, cparams, nparams, C.uint(flags), &err)
+	ret = C.virDomainSetPerfEventsWrapper(d.ptr, cparams, cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -3722,26 +3722,26 @@ func (d *Domain) GetSchedulerParameters() (*DomainSchedulerParameters, error) {
 	params := &DomainSchedulerParameters{}
 	info := getDomainSchedulerParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &cnparams, &err)
 	if schedtype == nil {
 		return nil, makeError(&err)
 	}
 
 	defer C.free(unsafe.Pointer(schedtype))
-	if nparams == 0 {
+	if cnparams == 0 {
 		return &DomainSchedulerParameters{
 			Type: C.GoString(schedtype),
 		}, nil
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -3756,26 +3756,26 @@ func (d *Domain) GetSchedulerParametersFlags(flags DomainModificationImpact) (*D
 	params := &DomainSchedulerParameters{}
 	info := getDomainSchedulerParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &cnparams, &err)
 	if schedtype == nil {
 		return nil, makeError(&err)
 	}
 
 	defer C.free(unsafe.Pointer(schedtype))
-	if nparams == 0 {
+	if cnparams == 0 {
 		return &DomainSchedulerParameters{
 			Type: C.GoString(schedtype),
 		}, nil
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, C.uint(flags), &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	_, gerr := typedParamsUnpack(cparams, info)
 	if gerr != nil {
@@ -3789,31 +3789,31 @@ func (d *Domain) GetSchedulerParametersFlags(flags DomainModificationImpact) (*D
 func (d *Domain) SetSchedulerParameters(params *DomainSchedulerParameters) error {
 	info := getDomainSchedulerParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &cnparams, &err)
 	if schedtype == nil {
 		return makeError(&err)
 	}
 
 	defer C.free(unsafe.Pointer(schedtype))
-	if nparams == 0 {
+	if cnparams == 0 {
 		return nil
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret := C.virDomainGetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, &err)
+	ret = C.virDomainSetSchedulerParametersWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -3825,31 +3825,31 @@ func (d *Domain) SetSchedulerParameters(params *DomainSchedulerParameters) error
 func (d *Domain) SetSchedulerParametersFlags(params *DomainSchedulerParameters, flags DomainModificationImpact) error {
 	info := getDomainSchedulerParametersFieldInfo(params)
 
-	var nparams C.int
+	var cnparams C.int
 	var err C.virError
-	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &nparams, &err)
+	schedtype := C.virDomainGetSchedulerTypeWrapper(d.ptr, &cnparams, &err)
 	if schedtype == nil {
 		return makeError(&err)
 	}
 
 	defer C.free(unsafe.Pointer(schedtype))
-	if nparams == 0 {
+	if cnparams == 0 {
 		return nil
 	}
 
-	cparams := make([]C.virTypedParameter, nparams)
-	ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &nparams, 0, &err)
+	cparams := make([]C.virTypedParameter, cnparams)
+	ret := C.virDomainGetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), &cnparams, 0, &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
-	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams)
+	defer C.virTypedParamsClear((*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams)
 
 	gerr := typedParamsPack(cparams, info)
 	if gerr != nil {
 		return gerr
 	}
 
-	ret = C.virDomainSetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), nparams, C.uint(flags), &err)
+	ret = C.virDomainSetSchedulerParametersFlagsWrapper(d.ptr, (*C.virTypedParameter)(unsafe.Pointer(&cparams[0])), cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return makeError(&err)
 	}
@@ -4635,16 +4635,16 @@ func (d *Domain) GetGuestVcpus(flags uint32) (*DomainGuestVcpus, error) {
 	info := getDomainGuestVcpusParametersFieldInfo(vcpus, &VcpusStr, &OnlineStr, &OfflinableStr)
 
 	var cparams C.virTypedParameterPtr
-	var nparams C.uint
+	var cnparams C.uint
 	var err C.virError
-	ret := C.virDomainGetGuestVcpusWrapper(d.ptr, &cparams, &nparams, C.uint(flags), &err)
+	ret := C.virDomainGetGuestVcpusWrapper(d.ptr, &cparams, &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsFree(cparams, C.int(nparams))
+	defer C.virTypedParamsFree(cparams, C.int(cnparams))
 
-	_, gerr := typedParamsUnpackLen(cparams, C.int(nparams), info)
+	_, gerr := typedParamsUnpackLen(cparams, C.int(cnparams), info)
 	if gerr != nil {
 		return nil, gerr
 	}
@@ -4851,17 +4851,17 @@ func (d *Domain) GetLaunchSecurityInfo(flags uint32) (*DomainLaunchSecurityParam
 	info := getDomainLaunchSecurityFieldInfo(params)
 
 	var cparams *C.virTypedParameter
-	var nparams C.int
+	var cnparams C.int
 
 	var err C.virError
-	ret := C.virDomainGetLaunchSecurityInfoWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &nparams, C.uint(flags), &err)
+	ret := C.virDomainGetLaunchSecurityInfoWrapper(d.ptr, (*C.virTypedParameterPtr)(unsafe.Pointer(&cparams)), &cnparams, C.uint(flags), &err)
 	if ret == -1 {
 		return nil, makeError(&err)
 	}
 
-	defer C.virTypedParamsFree(cparams, nparams)
+	defer C.virTypedParamsFree(cparams, cnparams)
 
-	_, gerr := typedParamsUnpackLen(cparams, nparams, info)
+	_, gerr := typedParamsUnpackLen(cparams, cnparams, info)
 	if gerr != nil {
 		return nil, gerr
 	}
diff --git a/domain_events.go b/domain_events.go
index b4bff7b..7e72313 100644
--- a/domain_events.go
+++ b/domain_events.go
@@ -758,12 +758,12 @@ func countPinInfo(cparams C.virTypedParameterPtr, nparams C.int) (int, int) {
 	return maxvcpus + 1, maxiothreads + 1
 }
 
-func domainEventTunableGetPin(params C.virTypedParameterPtr, nparams C.int) *DomainEventTunableCpuPin {
+func domainEventTunableGetPin(params C.virTypedParameterPtr, cnparams C.int) *DomainEventTunableCpuPin {
 	var pin domainEventTunablePinTemp
-	numvcpus, numiothreads := countPinInfo(params, nparams)
+	numvcpus, numiothreads := countPinInfo(params, cnparams)
 	pinInfo := getDomainPinTempFieldInfo(numvcpus, numiothreads, &pin)
 
-	num, err := typedParamsUnpackLen(params, nparams, pinInfo)
+	num, err := typedParamsUnpackLen(params, cnparams, pinInfo)
 	if num == 0 || err != nil {
 		return nil
 	}
@@ -806,13 +806,13 @@ func domainEventTunableGetPin(params C.virTypedParameterPtr, nparams C.int) *Dom
 }
 
 //export domainEventTunableCallback
-func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, nparams C.int, goCallbackId int) {
+func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, cnparams C.int, goCallbackId int) {
 	domain := &Domain{ptr: d}
 	connection := &Connect{ptr: c}
 
 	eventDetails := &DomainEventTunable{}
 
-	pin := domainEventTunableGetPin(params, nparams)
+	pin := domainEventTunableGetPin(params, cnparams)
 	if pin != nil {
 		eventDetails.CpuPin = pin
 	}
@@ -820,7 +820,7 @@ func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.vi
 	var sched DomainSchedulerParameters
 	schedInfo := getDomainTuneSchedulerParametersFieldInfo(&sched)
 
-	num, _ := typedParamsUnpackLen(params, nparams, schedInfo)
+	num, _ := typedParamsUnpackLen(params, cnparams, schedInfo)
 	if num > 0 {
 		eventDetails.CpuSched = &sched
 	}
@@ -831,12 +831,12 @@ func domainEventTunableCallback(c C.virConnectPtr, d C.virDomainPtr, params C.vi
 			s:   &eventDetails.BlkdevDisk,
 		},
 	}
-	typedParamsUnpackLen(params, nparams, blknameInfo)
+	typedParamsUnpackLen(params, cnparams, blknameInfo)
 
 	var blktune DomainBlockIoTuneParameters
 	blktuneInfo := getTuneBlockIoTuneParametersFieldInfo(&blktune)
 
-	num, _ = typedParamsUnpackLen(params, nparams, blktuneInfo)
+	num, _ = typedParamsUnpackLen(params, cnparams, blktuneInfo)
 	if num > 0 {
 		eventDetails.BlkdevTune = &blktune
 	}
@@ -903,14 +903,14 @@ func domainEventMigrationIterationCallback(c C.virConnectPtr, d C.virDomainPtr,
 }
 
 //export domainEventJobCompletedCallback
-func domainEventJobCompletedCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, nparams C.int, goCallbackId int) {
+func domainEventJobCompletedCallback(c C.virConnectPtr, d C.virDomainPtr, params C.virTypedParameterPtr, cnparams C.int, goCallbackId int) {
 	domain := &Domain{ptr: d}
 	connection := &Connect{ptr: c}
 
 	eventDetails := &DomainEventJobCompleted{}
 	info := getDomainJobInfoFieldInfo(&eventDetails.Info)
 
-	typedParamsUnpackLen(params, nparams, info)
+	typedParamsUnpackLen(params, cnparams, info)
 
 	callbackFunc := getCallbackId(goCallbackId)
 	callback, ok := callbackFunc.(DomainEventJobCompletedCallback)
-- 
2.20.1

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