summaryrefslogtreecommitdiffstats
path: root/lib/route/qdisc_api.c
diff options
context:
space:
mode:
authorThomas Graf <tgr@lsx.localdomain>2008-05-14 15:49:44 (GMT)
committerThomas Graf <tgr@lsx.localdomain>2008-05-14 15:49:44 (GMT)
commit8a3efffa5b3fde252675239914118664d36a2c24 (patch)
treef8efc71b2bd4736f2a56084efea05d7ee191a422 /lib/route/qdisc_api.c
parent85f932552e61c5997c1e83fe386098c94d93c273 (diff)
downloadlibnl-8a3efffa5b3fde252675239914118664d36a2c24.zip
libnl-8a3efffa5b3fde252675239914118664d36a2c24.tar.gz
libnl-8a3efffa5b3fde252675239914118664d36a2c24.tar.bz2
Thread-safe error handling
In order for the interface to become more thread safe, the error handling was revised to no longer depend on a static errno and error string buffer. This patch converts all error paths to return a libnl specific error code which can be translated to a error message using nl_geterror(int error). The functions nl_error() and nl_get_errno() are therefore obsolete. This change required various sets of function prototypes to be changed in order to return an error code, the most prominent are: struct nl_cache *foo_alloc_cache(...); changed to: int foo_alloc_cache(..., struct nl_cache **); struct nl_msg *foo_build_request(...); changed to: int foo_build_request(..., struct nl_msg **); struct foo *foo_parse(...); changed to: int foo_parse(..., struct foo **); This pretty much only leaves trivial allocation functions to still return a pointer object which can still return NULL to signal out of memory. This change is a serious API and ABI breaker, sorry!
Diffstat (limited to 'lib/route/qdisc_api.c')
-rw-r--r--lib/route/qdisc_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/route/qdisc_api.c b/lib/route/qdisc_api.c
index ef4d07a..089f212 100644
--- a/lib/route/qdisc_api.c
+++ b/lib/route/qdisc_api.c
@@ -46,7 +46,7 @@ int rtnl_qdisc_register(struct rtnl_qdisc_ops *qops)
for (op = &qdisc_ops_list; (o = *op) != NULL; op = &o->qo_next)
if (!strcasecmp(qops->qo_kind, o->qo_kind))
- return nl_errno(EEXIST);
+ return -NLE_EXIST;
qops->qo_next = NULL;
*op = qops;
@@ -67,7 +67,7 @@ int rtnl_qdisc_unregister(struct rtnl_qdisc_ops *qops)
break;
if (!o)
- return nl_errno(ENOENT);
+ return -NLE_OBJ_NOTFOUND;
*op = qops->qo_next;