On 08/09/2012 12:30 AM, Laine Stump wrote:
The meat of this patch is just moving the calls to
virNWFilterRegisterCallbackDriver from each hypervisor's "register"
function into its "initialize" function. The rest is just code
movement to allow that, and a new virNWFilterUnRegisterCallbackDriver
function to undo what the register function does.
The long explanation:
<snip> but certainly helpful.
+++ b/src/conf/nwfilter_conf.c
@@ -2829,6 +2829,24 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr
cbd)
}
void
+virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
+{
+ int i = 0;
+
+ while (i < nCallbackDriver && callbackDrvArray[i] != cbd)
+ i++;
+
+ if (i < nCallbackDriver) {
+ while (i < nCallbackDriver - 1) {
+ callbackDrvArray[i] = callbackDrvArray[i+1];
+ i++;
+ }
Is memmove() better than an open-coded loop?
+++ b/src/libvirt_private.syms
@@ -880,6 +880,7 @@ virNWFilterRuleActionTypeToString;
virNWFilterRuleDirectionTypeToString;
virNWFilterRuleProtocolTypeToString;
virNWFilterTestUnassignDef;
+virNWFilterUnRegisterCallbackDriver;
virNWFilterUnlockFilterUpdates;
I don't know if we've been favoring case-sensitive ("C") or
case-insensitive ("en_US.UTF-8") sorting in this file, so don't worry
about whether you need to swap lines. I blame POSIX for introducing
LC_COLLATE :)
ACK.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org