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

Re: [libvirt] [PATCH V5 02/10] Introduce an internal priority for chains



On 11/17/2011 01:11 PM, Stefan Berger wrote:
> For better handling of the sorting of chains introduce an internally used
> priority. Use a lookup table to store the priorities. For now their actual
> values do not matter just that the values cause the chains to be properly
> sorted through changes in the following patches. However, the values are
> chosen as negative so that once they are sorted along with filtering rules
> (whose priority may only be positive for now) they will always be instantiated
> before them (lower values cause instantiation before higher values). This
> is done to maintain backwards compatibility.
> 
> 
> Signed-off-by: Stefan Berger <stefanb linux vnet ibm com>
> 
> ---
> 
> v3:
>  - increased filter priorities to have more room before them
> 
> ---
>  src/conf/nwfilter_conf.c                  |   14 ++++++++++++++
>  src/conf/nwfilter_conf.h                  |   12 ++++++++++++
>  src/nwfilter/nwfilter_ebiptables_driver.c |    4 ++++
>  src/nwfilter/nwfilter_ebiptables_driver.h |    1 +
>  4 files changed, 31 insertions(+)

ACK.

> @@ -2028,6 +2036,12 @@ virNWFilterDefParseXML(xmlXPathContextPt
>                                     _("unknown chain suffix '%s'"), chain);
>              goto cleanup;
>          }
> +        /* assign an implicit priority -- support XML attribute later */
> +        if (intMapGetByString(chain_priorities, chain, 0,
> +                              &ret->chainPriority) == false) {

I tend not to compare to true or false, but it's not wrong so you don't
have to change it.  My argument is that comparison to bool is redundant,
since the other side of the comparison is already in bool context; I
would have used:

if (!intMapGetByString(chain_priorities, chain, 0,
                       &ret->chainPriority)) {

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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