summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-16 01:11:55 +0100
commit00132b46968fff7975eb8d20a307c626dfefe2f1 (patch)
treee2d6ea3d7535358435ea136019e03c35c22c19ba /include
parent23c4ef67c735813fd41f66f6722b996d1ad7314a (diff)
downloadlibnl-00132b46968fff7975eb8d20a307c626dfefe2f1.tar.gz
cache: provide safe variant of nl_cache_mngt_require() and use it
This makes runtime removal of cache operations possible if non-safe API is not in use by application. The non-safe API will be removed in the next major version. Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'include')
-rw-r--r--include/netlink-local.h8
-rw-r--r--include/netlink/cache.h2
2 files changed, 2 insertions, 8 deletions
diff --git a/include/netlink-local.h b/include/netlink-local.h
index 2bfae3e..b891d8c 100644
--- a/include/netlink-local.h
+++ b/include/netlink-local.h
@@ -117,14 +117,6 @@ extern int __str2flags(const char *, const struct trans_tbl *, size_t);
extern void dump_from_ops(struct nl_object *, struct nl_dump_params *);
-static inline struct nl_cache *dp_cache(struct nl_object *obj)
-{
- if (obj->ce_cache == NULL)
- return nl_cache_mngt_require(obj->ce_ops->oo_name);
-
- return obj->ce_cache;
-}
-
static inline int nl_cb_call(struct nl_cb *cb, int type, struct nl_msg *msg)
{
return cb->cb_set[type](msg, cb->cb_args[type]);
diff --git a/include/netlink/cache.h b/include/netlink/cache.h
index f193c76..ac03842 100644
--- a/include/netlink/cache.h
+++ b/include/netlink/cache.h
@@ -52,6 +52,7 @@ extern struct nl_cache * nl_cache_clone(struct nl_cache *);
extern void nl_cache_clear(struct nl_cache *);
extern void nl_cache_get(struct nl_cache *);
extern void nl_cache_free(struct nl_cache *);
+extern void nl_cache_put(struct nl_cache *cache);
/* Cache modification */
extern int nl_cache_add(struct nl_cache *,
@@ -118,6 +119,7 @@ extern int nl_cache_mngt_unregister(struct nl_cache_ops *);
extern void nl_cache_mngt_provide(struct nl_cache *);
extern void nl_cache_mngt_unprovide(struct nl_cache *);
extern struct nl_cache * nl_cache_mngt_require(const char *);
+extern struct nl_cache * nl_cache_mngt_require_safe(const char *);
extern struct nl_cache * __nl_cache_mngt_require(const char *);
struct nl_cache_mngr;