]> granicus.if.org Git - libnl/commitdiff
route/tc: add internal rtnl_tc_data_peek() function
authorThomas Haller <thaller@redhat.com>
Wed, 4 Mar 2015 13:15:34 +0000 (14:15 +0100)
committerThomas Haller <thaller@redhat.com>
Wed, 4 Mar 2015 13:55:38 +0000 (14:55 +0100)
Signed-off-by: Thomas Haller <thaller@redhat.com>
include/netlink-private/route/tc-api.h
lib/route/tc.c

index ce62080960ae2113dcda28f0e86f0bee981c4767..fbfa2abd8fa22ed80e2a31d7c8d63244beced719 100644 (file)
@@ -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 *);
index b24c06eeee9744745580283a0ab60630ca5c8da4..579405e0a213265708752cc6ef595c39df28d77a 100644 (file)
@@ -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