summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-03-24 22:50:11 +0100
committerThomas Graf <tgraf@suug.ch>2011-03-24 22:50:11 +0100
commite4b507e290475b59b08a022b1805f693d7867355 (patch)
treee15c3d17b1ddd66b0d9b63ba81e6e5720384cd79 /lib
parentf523f297f7fed8b64fe4c2a6e3791d31b2d2448b (diff)
downloadlibnl-e4b507e290475b59b08a022b1805f693d7867355.tar.gz
Deprecate rtnl_qdisc_foreach_child() and rtnl_qdisc_foreach_cls()
Their usage is not completely safe, it is not possible to handle the out of memory situation of the allocate filter. It is very unlikely for this to cause any problem though. The functions are still accessible but gcc will warn about their deprecation.
Diffstat (limited to 'lib')
-rw-r--r--lib/route/qdisc.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/lib/route/qdisc.c b/lib/route/qdisc.c
index d0f2edc..5257b9d 100644
--- a/lib/route/qdisc.c
+++ b/lib/route/qdisc.c
@@ -429,17 +429,15 @@ void rtnl_qdisc_put(struct rtnl_qdisc *qdisc)
/** @} */
/**
- * @name Iterators
+ * @name Deprecated Functions
* @{
*/
/**
- * Call a callback for each child class of a qdisc
- * @arg qdisc the parent qdisc
- * @arg cache a class cache including all classes of the interface
- * the specified qdisc is attached to
- * @arg cb callback function
- * @arg arg argument to be passed to callback function
+ * Call a callback for each child class of a qdisc (deprecated)
+ *
+ * @deprecated Use of this function is deprecated, it does not allow
+ * to handle the out of memory situation that can occur.
*/
void rtnl_qdisc_foreach_child(struct rtnl_qdisc *qdisc, struct nl_cache *cache,
void (*cb)(struct nl_object *, void *), void *arg)
@@ -460,26 +458,23 @@ void rtnl_qdisc_foreach_child(struct rtnl_qdisc *qdisc, struct nl_cache *cache,
}
/**
- * Call a callback for each filter attached to the qdisc
- * @arg qdisc the parent qdisc
- * @arg cache a filter cache including at least all the filters
- * attached to the specified qdisc
- * @arg cb callback function
- * @arg arg argument to be passed to callback function
+ * Call a callback for each filter attached to the qdisc (deprecated)
+ *
+ * @deprecated Use of this function is deprecated, it does not allow
+ * to handle the out of memory situation that can occur.
*/
void rtnl_qdisc_foreach_cls(struct rtnl_qdisc *qdisc, struct nl_cache *cache,
void (*cb)(struct nl_object *, void *), void *arg)
{
struct rtnl_cls *filter;
- filter = rtnl_cls_alloc();
- if (!filter)
+ if (!(filter = rtnl_cls_alloc()))
return;
- rtnl_tc_set_ifindex((struct rtnl_tc *) filter, qdisc->q_ifindex);
- rtnl_tc_set_parent((struct rtnl_tc *) filter, qdisc->q_parent);
+ rtnl_tc_set_ifindex(TC_CAST(filter), qdisc->q_ifindex);
+ rtnl_tc_set_parent(TC_CAST(filter), qdisc->q_parent);
- nl_cache_foreach_filter(cache, (struct nl_object *) filter, cb, arg);
+ nl_cache_foreach_filter(cache, OBJ_CAST(filter), cb, arg);
rtnl_cls_put(filter);
}