On 05/15/2018 01:43 PM, Daniel P. Berrangé wrote: > Wire up the ListAll, LookupByPortDev and GetXMLDesc APIs to allow the > virsh nwfilter-binding-list & nwfilter-binding-dumpxml commands to > work. > > Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> > --- > src/nwfilter/nwfilter_driver.c | 71 ++++++++++++++++++++++++++++++++++ > 1 file changed, 71 insertions(+) > > diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c > index caccecadda..6544261b38 100644 > --- a/src/nwfilter/nwfilter_driver.c > +++ b/src/nwfilter/nwfilter_driver.c > @@ -714,6 +714,74 @@ nwfilterTeardownFilter(virDomainNetDefPtr net) > } > > > +static virNWFilterBindingPtr > +nwfilterBindingLookupByPortDev(virConnectPtr conn, > + const char *portdev) > +{ > + virNWFilterBindingPtr ret = NULL; > + virNWFilterBindingObjPtr obj; > + > + obj = virNWFilterBindingObjListFindByPortDev(driver->bindings, > + portdev); > + if (!obj) > + goto cleanup; > + If _virNWFilterBindingObj is private then you'll need an accessor for obj->def > + if (virNWFilterBindingLookupByPortDevEnsureACL(conn, obj->def) < 0) > + goto cleanup; > + > + ret = virGetNWFilterBinding(conn, obj->def->portdevname, obj->def->filter); > + > + cleanup: > + virNWFilterBindingObjEndAPI(&obj); > + return ret; > +} > + > + > +static int > +nwfilterConnectListAllNWFilterBindings(virConnectPtr conn, > + virNWFilterBindingPtr **bindings, > + unsigned int flags) > +{ > + int ret; > + > + virCheckFlags(0, -1); > + > + if (virConnectListAllNWFilterBindingsEnsureACL(conn) < 0) > + return -1; > + > + ret = virNWFilterBindingObjListExport(driver->bindings, > + conn, > + bindings, > + virConnectListAllNWFilterBindingsCheckACL); > + > + return ret; > +} > + Another blank line > +static char * > +nwfilterBindingGetXMLDesc(virNWFilterBindingPtr binding, > + unsigned int flags) > +{ > + virNWFilterBindingObjPtr obj; > + char *ret = NULL; > + > + virCheckFlags(0, NULL); > + > + obj = virNWFilterBindingObjListFindByPortDev(driver->bindings, > + binding->portdev); > + if (!obj) > + goto cleanup; > + An accessor here too. > + if (virNWFilterBindingGetXMLDescEnsureACL(binding->conn, obj->def) < 0) > + goto cleanup; > + > + ret = virNWFilterBindingDefFormat(obj->def); > + > + cleanup: > + virNWFilterBindingObjEndAPI(&obj); > + return ret; > +} > + > + > static virNWFilterDriver nwfilterDriver = { > .name = "nwfilter", > .connectNumOfNWFilters = nwfilterConnectNumOfNWFilters, /* 0.8.0 */ > @@ -724,6 +792,9 @@ static virNWFilterDriver nwfilterDriver = { > .nwfilterDefineXML = nwfilterDefineXML, /* 0.8.0 */ > .nwfilterUndefine = nwfilterUndefine, /* 0.8.0 */ > .nwfilterGetXMLDesc = nwfilterGetXMLDesc, /* 0.8.0 */ > + .nwfilterBindingLookupByPortDev = nwfilterBindingLookupByPortDev, /* 4.4.0 */ > + .connectListAllNWFilterBindings = nwfilterConnectListAllNWFilterBindings, /* 4.4.0 */ > + .nwfilterBindingGetXMLDesc = nwfilterBindingGetXMLDesc, /* 4.4.0 */ > }; > > > Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx> John -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list