Skip to content

Commit

Permalink
Add BlockStatsFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Akins authored and Alex Zorin committed Aug 2, 2014
1 parent a618ae6 commit 30c04da
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,3 +473,29 @@ func (d *VirDomain) SendKey(codeset, holdtime uint, keycodes []uint, flags uint)

return nil
}

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, errors.New(GetLastError())
}

if cParamsLen > 0 && params != nil {
params.loadFromCPtr(cParams, nParams)
}

return int(cParamsLen), nil
}

0 comments on commit 30c04da

Please sign in to comment.