diff options
author | Andreas Fett <a.fett@gmx.de> | 2010-09-22 20:10:26 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-13 13:41:57 +0200 |
commit | 4ab22ccd47319e7d9a972bcf018e1a03870f64f0 (patch) | |
tree | ceeb38a56218b4d17e297b21fd43fe7d76dcd720 /lib/cache_mngr.c | |
parent | 86b6f6f6291eaaec542a2f4028087fa823122082 (diff) | |
download | libnl-4ab22ccd47319e7d9a972bcf018e1a03870f64f0.tar.gz |
add user data to change_func_t for caches
the patch below adds the possibility to
pass user data to callbacks of type
change_func_t when using the nl_cache_mngr_*
family of functions.
If there is any better way to do this,
without duplicating the code in
cache_mngr.c please let me know.
Diffstat (limited to 'lib/cache_mngr.c')
-rw-r--r-- | lib/cache_mngr.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/cache_mngr.c b/lib/cache_mngr.c index 0675316..81052aa 100644 --- a/lib/cache_mngr.c +++ b/lib/cache_mngr.c @@ -95,7 +95,7 @@ static int include_cb(struct nl_object *obj, struct nl_parser_param *p) if (nl_debug >= 4) nl_object_dump(obj, &nl_debug_dp); #endif - return nl_cache_include(ca->ca_cache, obj, ca->ca_change); + return nl_cache_include(ca->ca_cache, obj, ca->ca_change, ca->ca_change_data); } static int event_input(struct nl_msg *msg, void *arg) @@ -207,7 +207,7 @@ errout: * @return 0 on success or a negative error code. */ int nl_cache_mngr_add(struct nl_cache_mngr *mngr, const char *name, - change_func_t cb, struct nl_cache **result) + change_func_t cb, void *data, struct nl_cache **result) { struct nl_cache_ops *ops; struct nl_cache *cache; @@ -264,6 +264,7 @@ retry: mngr->cm_assocs[i].ca_cache = cache; mngr->cm_assocs[i].ca_change = cb; + mngr->cm_assocs[i].ca_change_data = data; if (mngr->cm_flags & NL_AUTO_PROVIDE) nl_cache_mngt_provide(cache); |