Commit ddcdb1fd authored by Daniel P. Berrange's avatar Daniel P. Berrange

Rename VirNWFilter to NWFilter

Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
parent caaedb90
......@@ -1055,37 +1055,37 @@ func (c *VirConnection) LookupStoragePoolByUUID(uuid []byte) (*VirStoragePool, e
return &VirStoragePool{ptr: ptr}, nil
}
func (c *VirConnection) NWFilterDefineXML(xmlConfig string) (*VirNWFilter, error) {
func (c *VirConnection) NWFilterDefineXML(xmlConfig string) (*NWFilter, error) {
cXml := C.CString(string(xmlConfig))
defer C.free(unsafe.Pointer(cXml))
ptr := C.virNWFilterDefineXML(c.ptr, cXml)
if ptr == nil {
return nil, GetLastError()
}
return &VirNWFilter{ptr: ptr}, nil
return &NWFilter{ptr: ptr}, nil
}
func (c *VirConnection) LookupNWFilterByName(name string) (*VirNWFilter, error) {
func (c *VirConnection) LookupNWFilterByName(name string) (*NWFilter, error) {
cName := C.CString(name)
defer C.free(unsafe.Pointer(cName))
ptr := C.virNWFilterLookupByName(c.ptr, cName)
if ptr == nil {
return nil, GetLastError()
}
return &VirNWFilter{ptr: ptr}, nil
return &NWFilter{ptr: ptr}, nil
}
func (c *VirConnection) LookupNWFilterByUUIDString(uuid string) (*VirNWFilter, error) {
func (c *VirConnection) LookupNWFilterByUUIDString(uuid string) (*NWFilter, error) {
cUuid := C.CString(uuid)
defer C.free(unsafe.Pointer(cUuid))
ptr := C.virNWFilterLookupByUUIDString(c.ptr, cUuid)
if ptr == nil {
return nil, GetLastError()
}
return &VirNWFilter{ptr: ptr}, nil
return &NWFilter{ptr: ptr}, nil
}
func (c *VirConnection) LookupNWFilterByUUID(uuid []byte) (*VirNWFilter, error) {
func (c *VirConnection) LookupNWFilterByUUID(uuid []byte) (*NWFilter, error) {
if len(uuid) != C.VIR_UUID_BUFLEN {
return nil, fmt.Errorf("UUID must be exactly %d bytes in size",
int(C.VIR_UUID_BUFLEN))
......@@ -1096,7 +1096,7 @@ func (c *VirConnection) LookupNWFilterByUUID(uuid []byte) (*VirNWFilter, error)
if ptr == nil {
return nil, GetLastError()
}
return &VirNWFilter{ptr: ptr}, nil
return &NWFilter{ptr: ptr}, nil
}
func (c *VirConnection) LookupStorageVolByKey(key string) (*VirStorageVol, error) {
......@@ -1255,7 +1255,7 @@ func (c *VirConnection) ListAllDomains(flags VirConnectListAllDomainsFlags) ([]D
return domains, nil
}
func (c *VirConnection) ListAllNWFilters(flags uint32) ([]VirNWFilter, error) {
func (c *VirConnection) ListAllNWFilters(flags uint32) ([]NWFilter, error) {
var cList *C.virNWFilterPtr
numNWFilters := C.virConnectListAllNWFilters(c.ptr, (**C.virNWFilterPtr)(&cList), C.uint(flags))
if numNWFilters == -1 {
......@@ -1266,10 +1266,10 @@ func (c *VirConnection) ListAllNWFilters(flags uint32) ([]VirNWFilter, error) {
Len: int(numNWFilters),
Cap: int(numNWFilters),
}
var filters []VirNWFilter
var filters []NWFilter
slice := *(*[]C.virNWFilterPtr)(unsafe.Pointer(&hdr))
for _, ptr := range slice {
filters = append(filters, VirNWFilter{ptr})
filters = append(filters, NWFilter{ptr})
}
C.free(unsafe.Pointer(cList))
return filters, nil
......
......@@ -1057,7 +1057,7 @@ func TestIntergrationListAllNWFilters(t *testing.T) {
filters, err := conn.ListAllNWFilters(0)
if len(filters) == 0 {
t.Fatal("length of []VirNWFilter shouldn't be 0")
t.Fatal("length of []NWFilter shouldn't be 0")
}
found := false
......
......@@ -12,11 +12,11 @@ import (
"unsafe"
)
type VirNWFilter struct {
type NWFilter struct {
ptr C.virNWFilterPtr
}
func (f *VirNWFilter) Free() error {
func (f *NWFilter) Free() error {
if result := C.virNWFilterFree(f.ptr); result != 0 {
return GetLastError()
}
......@@ -24,7 +24,7 @@ func (f *VirNWFilter) Free() error {
return nil
}
func (f *VirNWFilter) GetName() (string, error) {
func (f *NWFilter) GetName() (string, error) {
name := C.virNWFilterGetName(f.ptr)
if name == nil {
return "", GetLastError()
......@@ -32,7 +32,7 @@ func (f *VirNWFilter) GetName() (string, error) {
return C.GoString(name), nil
}
func (f *VirNWFilter) Undefine() error {
func (f *NWFilter) Undefine() error {
result := C.virNWFilterUndefine(f.ptr)
if result == -1 {
return GetLastError()
......@@ -40,7 +40,7 @@ func (f *VirNWFilter) Undefine() error {
return nil
}
func (f *VirNWFilter) GetUUID() ([]byte, error) {
func (f *NWFilter) GetUUID() ([]byte, error) {
var cUuid [C.VIR_UUID_BUFLEN](byte)
cuidPtr := unsafe.Pointer(&cUuid)
result := C.virNWFilterGetUUID(f.ptr, (*C.uchar)(cuidPtr))
......@@ -50,7 +50,7 @@ func (f *VirNWFilter) GetUUID() ([]byte, error) {
return C.GoBytes(cuidPtr, C.VIR_UUID_BUFLEN), nil
}
func (f *VirNWFilter) GetUUIDString() (string, error) {
func (f *NWFilter) GetUUIDString() (string, error) {
var cUuid [C.VIR_UUID_STRING_BUFLEN](C.char)
cuidPtr := unsafe.Pointer(&cUuid)
result := C.virNWFilterGetUUIDString(f.ptr, (*C.char)(cuidPtr))
......@@ -60,7 +60,7 @@ func (f *VirNWFilter) GetUUIDString() (string, error) {
return C.GoString((*C.char)(cuidPtr)), nil
}
func (f *VirNWFilter) GetXMLDesc(flags uint32) (string, error) {
func (f *NWFilter) GetXMLDesc(flags uint32) (string, error) {
result := C.virNWFilterGetXMLDesc(f.ptr, C.uint(flags))
if result == nil {
return "", GetLastError()
......
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