From: Thomas Haller Date: Wed, 4 Mar 2015 13:15:34 +0000 (+0100) Subject: route/tc: add internal rtnl_tc_data_peek() function X-Git-Tag: libnl3_2_26rc1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e89aec9bc13c18f7da7b5683d02d7ddfc45edb92;p=thirdparty%2Flibnl.git route/tc: add internal rtnl_tc_data_peek() function Signed-off-by: Thomas Haller --- diff --git a/include/netlink-private/route/tc-api.h b/include/netlink-private/route/tc-api.h index ce62080..fbfa2ab 100644 --- a/include/netlink-private/route/tc-api.h +++ b/include/netlink-private/route/tc-api.h @@ -114,6 +114,7 @@ extern int rtnl_tc_compare(struct nl_object *, struct nl_object *, uint32_t, int); +void * rtnl_tc_data_peek(struct rtnl_tc *tc); extern void * rtnl_tc_data(struct rtnl_tc *); extern void * rtnl_tc_data_check(struct rtnl_tc *, struct rtnl_tc_ops *, int *); diff --git a/lib/route/tc.c b/lib/route/tc.c index b24c06e..579405e 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -1025,6 +1025,19 @@ void rtnl_tc_unregister(struct rtnl_tc_ops *ops) nl_list_del(&ops->to_list); } +/** + * Returns the private data of the traffic control object. + * Contrary to rtnl_tc_data(), this returns NULL if the data is + * not yet allocated + * @arg tc traffic control object + * + * @return pointer to the private data or NULL if not allocated. + */ +void *rtnl_tc_data_peek(struct rtnl_tc *tc) +{ + return tc->tc_subdata ? nl_data_get(tc->tc_subdata) : NULL; +} + /** * Return pointer to private data of traffic control object * @arg tc traffic control object