Hi Florian,

merged into the fw3 repo. i did not update the package in lede yet.
first want to talk to jow if current head of that repo is production ready.

        John

On 02/09/2016 04:10, Florian Fainelli wrote:
> Rename to fw3_{set,del,has}bit to avoid name clashes with sys/param.h:
> 
> /opt/toolchains/stbgcc-4.8-1.5/arm-linux-gnueabihf/sys-root/usr/include/sys/param.h:80:0:
>  note: this is the location of the previous definition
>  #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
> 
> Signed-off-by: Florian Fainelli <f.faine...@gmail.com>
> ---
>  defaults.c |  2 +-
>  forwards.c |  4 ++--
>  iptables.c |  8 ++++----
>  options.c  |  8 ++++----
>  rules.c    |  8 ++++----
>  utils.h    | 12 ++++++------
>  zones.c    | 26 +++++++++++++-------------
>  7 files changed, 34 insertions(+), 34 deletions(-)
> 
> diff --git a/defaults.c b/defaults.c
> index 2dbbb633e2e4..8afbf9acf832 100644
> --- a/defaults.c
> +++ b/defaults.c
> @@ -154,7 +154,7 @@ fw3_print_default_chains(struct fw3_ipt_handle *handle, 
> struct fw3_state *state,
>                       continue;
>  
>               if (c->flag &&
> -                 !hasbit(defs->flags[handle->family == FW3_FAMILY_V6], 
> c->flag))
> +                 !fw3_hasbit(defs->flags[handle->family == FW3_FAMILY_V6], 
> c->flag))
>                       continue;
>  
>               fw3_ipt_create_chain(handle, c->format);
> diff --git a/forwards.c b/forwards.c
> index 591173279996..6f950520fd37 100644
> --- a/forwards.c
> +++ b/forwards.c
> @@ -86,8 +86,8 @@ fw3_load_forwards(struct fw3_state *state, struct 
> uci_package *p)
>               /* NB: forward family... */
>               if (forward->_dest)
>               {
> -                     setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
> -                     setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
> +                     fw3_setbit(forward->_dest->flags[0], FW3_FLAG_ACCEPT);
> +                     fw3_setbit(forward->_dest->flags[1], FW3_FLAG_ACCEPT);
>  
>                       if (forward->_src &&
>                           (forward->_src->conntrack || 
> forward->_dest->conntrack))
> diff --git a/iptables.c b/iptables.c
> index 96fba12f0e90..e54ea53f2c39 100644
> --- a/iptables.c
> +++ b/iptables.c
> @@ -1030,7 +1030,7 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct 
> fw3_time *time)
>       {
>               for (i = 1, p = buf; i < 32; i++)
>               {
> -                     if (hasbit(time->monthdays, i))
> +                     if (fw3_hasbit(time->monthdays, i))
>                       {
>                               if (p > buf)
>                                       *p++ = ',';
> @@ -1039,14 +1039,14 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct 
> fw3_time *time)
>                       }
>               }
>  
> -             fw3_ipt_rule_addarg(r, hasbit(time->monthdays, 0), 
> "--monthdays", buf);
> +             fw3_ipt_rule_addarg(r, fw3_hasbit(time->monthdays, 0), 
> "--monthdays", buf);
>       }
>  
>       if (time->weekdays & 0xFE)
>       {
>               for (i = 1, p = buf; i < 8; i++)
>               {
> -                     if (hasbit(time->weekdays, i))
> +                     if (fw3_hasbit(time->weekdays, i))
>                       {
>                               if (p > buf)
>                                       *p++ = ',';
> @@ -1055,7 +1055,7 @@ fw3_ipt_rule_time(struct fw3_ipt_rule *r, struct 
> fw3_time *time)
>                       }
>               }
>  
> -             fw3_ipt_rule_addarg(r, hasbit(time->weekdays, 0), "--weekdays", 
> buf);
> +             fw3_ipt_rule_addarg(r, fw3_hasbit(time->weekdays, 0), 
> "--weekdays", buf);
>       }
>  }
>  
> diff --git a/options.c b/options.c
> index 407931b4c490..d88d3ba09b50 100644
> --- a/options.c
> +++ b/options.c
> @@ -718,7 +718,7 @@ fw3_parse_weekdays(void *ptr, const char *val, bool 
> is_list)
>  
>       if (*val == '!')
>       {
> -             setbit(*(uint8_t *)ptr, 0);
> +             fw3_setbit(*(uint8_t *)ptr, 0);
>               while (isspace(*++val));
>       }
>  
> @@ -738,7 +738,7 @@ fw3_parse_weekdays(void *ptr, const char *val, bool 
> is_list)
>                       }
>               }
>  
> -             setbit(*(uint8_t *)ptr, w);
> +             fw3_setbit(*(uint8_t *)ptr, w);
>       }
>  
>       free(s);
> @@ -753,7 +753,7 @@ fw3_parse_monthdays(void *ptr, const char *val, bool 
> is_list)
>  
>       if (*val == '!')
>       {
> -             setbit(*(uint32_t *)ptr, 0);
> +             fw3_setbit(*(uint32_t *)ptr, 0);
>               while (isspace(*++val));
>       }
>  
> @@ -770,7 +770,7 @@ fw3_parse_monthdays(void *ptr, const char *val, bool 
> is_list)
>                       return false;
>               }
>  
> -             setbit(*(uint32_t *)ptr, d);
> +             fw3_setbit(*(uint32_t *)ptr, d);
>       }
>  
>       free(s);
> diff --git a/rules.c b/rules.c
> index 2c682b1b0b7e..8f232d3e0644 100644
> --- a/rules.c
> +++ b/rules.c
> @@ -247,13 +247,13 @@ fw3_load_rules(struct fw3_state *state, struct 
> uci_package *p,
>               /* NB: rule family... */
>               if (rule->_dest)
>               {
> -                     setbit(rule->_dest->flags[0], rule->target);
> -                     setbit(rule->_dest->flags[1], rule->target);
> +                     fw3_setbit(rule->_dest->flags[0], rule->target);
> +                     fw3_setbit(rule->_dest->flags[1], rule->target);
>               }
>               else if (need_src_action_chain(rule))
>               {
> -                     setbit(rule->_src->flags[0], 
> fw3_to_src_target(rule->target));
> -                     setbit(rule->_src->flags[1], 
> fw3_to_src_target(rule->target));
> +                     fw3_setbit(rule->_src->flags[0], 
> fw3_to_src_target(rule->target));
> +                     fw3_setbit(rule->_src->flags[1], 
> fw3_to_src_target(rule->target));
>               }
>       }
>  }
> diff --git a/utils.h b/utils.h
> index 166ac26cfd07..c74a5dd76d22 100644
> --- a/utils.h
> +++ b/utils.h
> @@ -46,13 +46,13 @@ void warn(const char *format, ...);
>  void error(const char *format, ...);
>  void info(const char *format, ...);
>  
> -#define setbit(field, flag) field |= (1 << (flag))
> -#define delbit(field, flag) field &= ~(1 << (flag))
> -#define hasbit(field, flag) (field & (1 << (flag)))
> +#define fw3_setbit(field, flag) field |= (1 << (flag))
> +#define fw3_delbit(field, flag) field &= ~(1 << (flag))
> +#define fw3_hasbit(field, flag) (field & (1 << (flag)))
>  
> -#define set(field, family, flag) setbit(field[family == FW3_FAMILY_V6], flag)
> -#define del(field, family, flag) delbit(field[family == FW3_FAMILY_V6], flag)
> -#define has(field, family, flag) hasbit(field[family == FW3_FAMILY_V6], flag)
> +#define set(field, family, flag) fw3_setbit(field[family == FW3_FAMILY_V6], 
> flag)
> +#define del(field, family, flag) fw3_delbit(field[family == FW3_FAMILY_V6], 
> flag)
> +#define has(field, family, flag) fw3_hasbit(field[family == FW3_FAMILY_V6], 
> flag)
>  
>  #define fw3_foreach(p, h)                                                  \
>       for (p = list_empty(h) ? NULL : list_first_entry(h, typeof(*p), list); \
> diff --git a/zones.c b/zones.c
> index a4458fe5f7ea..9ae0c75b9835 100644
> --- a/zones.c
> +++ b/zones.c
> @@ -216,23 +216,23 @@ fw3_load_zones(struct fw3_state *state, struct 
> uci_package *p)
>  
>               if (zone->masq)
>               {
> -                     setbit(zone->flags[0], FW3_FLAG_SNAT);
> +                     fw3_setbit(zone->flags[0], FW3_FLAG_SNAT);
>                       zone->conntrack = true;
>               }
>  
>               if (zone->custom_chains)
>               {
> -                     setbit(zone->flags[0], FW3_FLAG_SNAT);
> -                     setbit(zone->flags[0], FW3_FLAG_DNAT);
> +                     fw3_setbit(zone->flags[0], FW3_FLAG_SNAT);
> +                     fw3_setbit(zone->flags[0], FW3_FLAG_DNAT);
>               }
>  
> -             setbit(zone->flags[0], fw3_to_src_target(zone->policy_input));
> -             setbit(zone->flags[0], zone->policy_forward);
> -             setbit(zone->flags[0], zone->policy_output);
> +             fw3_setbit(zone->flags[0], 
> fw3_to_src_target(zone->policy_input));
> +             fw3_setbit(zone->flags[0], zone->policy_forward);
> +             fw3_setbit(zone->flags[0], zone->policy_output);
>  
> -             setbit(zone->flags[1], fw3_to_src_target(zone->policy_input));
> -             setbit(zone->flags[1], zone->policy_forward);
> -             setbit(zone->flags[1], zone->policy_output);
> +             fw3_setbit(zone->flags[1], 
> fw3_to_src_target(zone->policy_input));
> +             fw3_setbit(zone->flags[1], zone->policy_forward);
> +             fw3_setbit(zone->flags[1], zone->policy_output);
>  
>               list_add_tail(&zone->list, &state->zones);
>       }
> @@ -284,7 +284,7 @@ print_zone_chain(struct fw3_ipt_handle *handle, struct 
> fw3_state *state,
>                       continue;
>  
>               if (c->flag &&
> -                 !hasbit(zone->flags[handle->family == FW3_FAMILY_V6], 
> c->flag))
> +                 !fw3_hasbit(zone->flags[handle->family == FW3_FAMILY_V6], 
> c->flag))
>                       continue;
>  
>               fw3_ipt_create_chain(handle, c->format, zone->name);
> @@ -655,15 +655,15 @@ fw3_hotplug_zones(struct fw3_state *state, bool add)
>  
>       list_for_each_entry(z, &state->zones, list)
>       {
> -             if (add != hasbit(z->flags[0], FW3_FLAG_HOTPLUG))
> +             if (add != fw3_hasbit(z->flags[0], FW3_FLAG_HOTPLUG))
>               {
>                       list_for_each_entry(d, &z->devices, list)
>                               fw3_hotplug(add, z, d);
>  
>                       if (add)
> -                             setbit(z->flags[0], FW3_FLAG_HOTPLUG);
> +                             fw3_setbit(z->flags[0], FW3_FLAG_HOTPLUG);
>                       else
> -                             delbit(z->flags[0], FW3_FLAG_HOTPLUG);
> +                             fw3_delbit(z->flags[0], FW3_FLAG_HOTPLUG);
>               }
>       }
>  }
> 

_______________________________________________
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Reply via email to