[PATCH] lib: Update ce-mask to uint64_t

Thomas Haller thaller at redhat.com
Fri Dec 18 00:16:45 PST 2015


Hi David,


On Wed, 2015-12-16 at 13:11 -0800, David Ahern wrote:
> lib/route/link.c already defines 32 attributes which fills the
> current
> uint32_t used for ce_mask. To accommodate more attributes the mask
> needs
> to be expanded. This patch updates the definition to uint64_t and
> fixes
> callers and implementations to consistently use uint64_t data type.


>  extern void *			rtnl_tc_data(struct rtnl_tc *);
> diff --git a/include/netlink/object.h b/include/netlink/object.h
> index a95feda7b4db..81a1578bb22c 100644
> --- a/include/netlink/object.h
> +++ b/include/netlink/object.h
> @@ -41,7 +41,7 @@ extern void			nl_object_dump(s
> truct nl_object *,
>  extern void			nl_object_dump_buf(struct
> nl_object *, char *, size_t);
>  extern int			nl_object_identical(struct
> nl_object *,
>  						    struct nl_object
> *);
> -extern uint32_t			nl_object_diff(struct
> nl_object *,
> +extern uint64_t			nl_object_diff(struct
> nl_object *,
> 

This changes public API. Cannot do that. Maybe add a nl_object_diff64()
-- as ugly as it is...


Too bad we already used:
#define LINK_ATTR_LINK_NETNSID  (1 << 31)

I missed that. Otherwise we could reserve the highest bit for ~there
are some other flags above 32 bit~.


like:

uint32_t nl_object_diff(struct nl_object *obj1, ... obj2)
{
    uint64_t diff;

    diff = nl_object_diff64 (obj1, obj2);

    return (diff & ~((uint64_t 0xFFFFFFFF))
           ? (uint32_t) diff | (1 << 31)
           : (uint32_t) diff;
}


Maybe we just change LINK_ATTR_LINK_NETNSID to be (1 << 32) and do it
anyway? The actual numeric values of LINK_ATTR_* are anyway private
API.






Otherwise this patch changes ABI for internal API in a somewhat crucial
way. I guess that's OK and no user in the wild depends on that,
right(??)



Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20151218/892707d6/attachment.sig>


More information about the libnl mailing list