Skip to content

Commit

Permalink
route/tc: add internal rtnl_tc_data_peek() function
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Haller <thaller@redhat.com>
  • Loading branch information
thom311 committed Mar 4, 2015
1 parent 4ff512b commit e89aec9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/netlink-private/route/tc-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
13 changes: 13 additions & 0 deletions lib/route/tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e89aec9

Please sign in to comment.