Re: [PATCH] nwfilter: fix crash during filter define when lxc driver failed startup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]