From aba36899377bfa9dcb9aab431de5a26c3cfeb5ef Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Thu, 9 Jun 2011 12:30:15 +0200 Subject: Provide documentation for rtnl_tc_data() and rtnl_tc_data_check() --- lib/route/tc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/route/tc.c b/lib/route/tc.c index 983555a..7bd4728 100644 --- a/lib/route/tc.c +++ b/lib/route/tc.c @@ -987,6 +987,15 @@ void rtnl_tc_unregister(struct rtnl_tc_ops *ops) nl_list_del(&ops->to_list); } +/** + * Return pointer to private data of traffic control object + * @arg tc traffic control object + * + * Allocates the private traffic control object data section + * as necessary and returns it. + * + * @return Pointer to private tc data or NULL if allocation failed. + */ void *rtnl_tc_data(struct rtnl_tc *tc) { if (!tc->tc_subdata) { @@ -1010,6 +1019,20 @@ void *rtnl_tc_data(struct rtnl_tc *tc) return nl_data_get(tc->tc_subdata); } +/** + * Check traffic control object type and return private data section + * @arg tc traffic control object + * @arg ops expected traffic control object operations + * + * Checks whether the traffic control object matches the type + * specified with the traffic control object operations. If the + * type matches, the private tc object data is returned. If type + * mismatches, APPBUG() will print a application bug warning. + * + * @see rtnl_tc_data() + * + * @return Pointer to private tc data or NULL if type mismatches. + */ void *rtnl_tc_data_check(struct rtnl_tc *tc, struct rtnl_tc_ops *ops) { if (tc->tc_ops != ops) { @@ -1018,6 +1041,7 @@ void *rtnl_tc_data_check(struct rtnl_tc *tc, struct rtnl_tc_ops *ops) snprintf(buf, sizeof(buf), "tc object %p used in %s context but is of type %s", tc, ops->to_kind, tc->tc_ops->to_kind); + APPBUG(buf); return NULL; } -- cgit v1.2.1