[PATCH 2/4] Add new rtnl_link_af_data_compare function to compare af_data

Thomas Graf tgraf at suug.ch
Sat Jan 12 05:45:28 EST 2013


On 01/08/13 at 05:29am, roopa at cumulusnetworks.com wrote:
> +/**
> + * Compare af data for a link address family
> + * @arg a		Link object a
> + * @arg b		Link object b
> + * @arg family		Link address family
> + *
> + * This function will compare af_data between two links
> + * a and b of family given by arg family
> + *
> + * @return 0 on compare success or 1 on compare failure
> + */
> +int rtnl_link_af_data_compare(struct rtnl_link *a, struct rtnl_link *b,
> +			      int family, uint32_t attrs, int flags)
> +{
> +	struct rtnl_link_af_ops *af_ops = rtnl_link_af_ops_lookup(family);
> +
> +	if (!a->l_af_data[family] && !b->l_af_data[family])
> +		return 0;
> +
> +	if (!a->l_af_data[family] || !b->l_af_data[family])
> +		return ~0;
> +
> +	if (af_ops->ao_compare)
> +		return af_ops->ao_compare(a, b, family, attrs, flags);
> +
> +	return 0;
> +}

Are you planning to make this function part of the public API? If so,
please make the required change in the header file.

It seems it would be more sensible to depend on a->l_family after
checking a->l_family == b->l_family instead of taking 'family'
as attribute.




More information about the libnl mailing list