本文整理匯總了Golang中C.virTypedParamsFree函數的典型用法代碼示例。如果您正苦於以下問題:Golang virTypedParamsFree函數的具體用法?Golang virTypedParamsFree怎麽用?Golang virTypedParamsFree使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了virTypedParamsFree函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: BlockStatsFlags
func (d *VirDomain) BlockStatsFlags(disk string, params *VirTypedParameters, nParams int, flags uint32) (int, error) {
var cParams C.virTypedParameterPtr
cDisk := C.CString(disk)
defer C.free(unsafe.Pointer(cDisk))
cParamsLen := C.int(nParams)
if params != nil && nParams > 0 {
cParams = (C.virTypedParameterPtr)(C.calloc(C.size_t(nParams), C.size_t(unsafe.Sizeof(C.struct__virTypedParameter{}))))
defer C.virTypedParamsFree(cParams, cParamsLen)
} else {
cParams = nil
}
result := int(C.virDomainBlockStatsFlags(d.ptr, cDisk, (C.virTypedParameterPtr)(cParams), &cParamsLen, C.uint(flags)))
if result == -1 {
return result, GetLastError()
}
if cParamsLen > 0 && params != nil {
params.loadFromCPtr(cParams, nParams)
}
return int(cParamsLen), nil
}
示例2: GetCPUStats
func (d *VirDomain) GetCPUStats(params *VirTypedParameters, nParams int, startCpu int, nCpus uint32, flags uint32) (int, error) {
var cParams C.virTypedParameterPtr
var cParamsLen int
cParamsLen = int(nCpus) * nParams
if params != nil && cParamsLen > 0 {
cParams = (C.virTypedParameterPtr)(C.calloc(C.size_t(cParamsLen), C.size_t(unsafe.Sizeof(C.struct__virTypedParameter{}))))
defer C.virTypedParamsFree(cParams, C.int(cParamsLen))
} else {
cParamsLen = 0
cParams = nil
}
result := int(C.virDomainGetCPUStats(d.ptr, (C.virTypedParameterPtr)(cParams), C.uint(nParams), C.int(startCpu), C.uint(nCpus), C.uint(flags)))
if result == -1 {
return result, GetLastError()
}
if cParamsLen > 0 {
params.loadFromCPtr(cParams, cParamsLen)
}
return result, nil
}
示例3: BlockCopy
func (d *VirDomain) BlockCopy(disk string, destXML string, params VirTypedParameters, flags uint32) error {
cDisk := C.CString(disk)
defer C.free(unsafe.Pointer(cDisk))
cDestXML := C.CString(destXML)
defer C.free(unsafe.Pointer(cDestXML))
if cParams, cnParams, err := params.loadToCPtr(); err != nil {
C.virTypedParamsFree(cParams, cnParams)
return err
} else {
defer C.virTypedParamsFree(cParams, cnParams)
result := int(C.virDomainBlockCopy(d.ptr, cDisk, cDestXML, cParams, cnParams, C.uint(flags)))
if result == -1 {
return GetLastError()
}
}
return nil
}
示例4: NewTypedParameters
func NewTypedParameters(nparams int) *TypedParameters {
t := new(TypedParameters)
if nparams > 0 {
t.cptr = C.virTypedParameterAllocate(C.int(nparams))
t.capacity = C.int(nparams)
}
runtime.SetFinalizer(t, func(t *TypedParameters) {
if t.cptr != nil {
C.virTypedParamsFree(t.cptr, t.length)
}
})
return t
}
示例5: GetInterfaceParameters
// Warning: No test written for this function
func (d *VirDomain) GetInterfaceParameters(device string, params *VirTypedParameters, nParams *int, flags uint32) (int, error) {
var cParams C.virTypedParameterPtr
if params != nil && *nParams > 0 {
cParams = (C.virTypedParameterPtr)(C.calloc(C.size_t(*nParams), C.size_t(unsafe.Sizeof(C.struct__virTypedParameter{}))))
defer C.virTypedParamsFree(cParams, C.int(*nParams))
} else {
cParams = nil
}
result := int(C.virDomainGetInterfaceParameters(d.ptr, C.CString(device), (C.virTypedParameterPtr)(cParams), (*C.int)(unsafe.Pointer(nParams)), C.uint(flags)))
if result == -1 {
return result, GetLastError()
}
if params != nil && *nParams > 0 {
params.loadFromCPtr(cParams, *nParams)
}
return result, nil
}