diff options
author | Tobias Jungel <tobias.jungel@bisdn.de> | 2016-11-13 15:21:46 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-12-01 16:49:43 +0100 |
commit | 66d032ad443a9d67bd26ed3e801cddf9f0e71ae7 (patch) | |
tree | cf155e8a84ec4943ecd1e1ea383337319012195a /include | |
parent | 55ea6e6b6cd805f441b410971c9dd7575e783ef4 (diff) | |
download | libnl-66d032ad443a9d67bd26ed3e801cddf9f0e71ae7.tar.gz |
cache_mngr: add include callback v2
This patch adds change_func_v2_t to add a more detailed callback in
case of a cache change. The change function is registered using the new
nl_cache_mngr_add_cache_v2. In case the new change function is set,
nl_cache_include_v2 and thus cache_include_v2 will be used to perform the cache
inclusion.
The parameter of change_func_v2_t are the following:
* struct nl_cache * => cache
* struct nl_object * => the old/deleted nl_object
* struct nl_object * => the new nl_object
* uint64_t => the result of nl_object_diff64 in case of a change
* int => NL_ACT_*
* void * => data
https://github.com/thom311/libnl/issues/71
http://lists.infradead.org/pipermail/libnl/2016-September/002214.html
http://lists.infradead.org/pipermail/libnl/2016-October/002229.html
http://lists.infradead.org/pipermail/libnl/2016-November/002250.html
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink-private/cache-api.h | 3 | ||||
-rw-r--r-- | include/netlink-private/types.h | 1 | ||||
-rw-r--r-- | include/netlink/cache.h | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/include/netlink-private/cache-api.h b/include/netlink-private/cache-api.h index f3d9f01a..c684e797 100644 --- a/include/netlink-private/cache-api.h +++ b/include/netlink-private/cache-api.h @@ -237,7 +237,8 @@ struct nl_cache_ops * @see nl_cache_include() */ int (*co_include_event)(struct nl_cache *cache, struct nl_object *obj, - change_func_t change_cb, void *data); + change_func_t change_cb, change_func_v2_t change_cb_v2, + void *data); void (*reserved_1)(void); void (*reserved_2)(void); diff --git a/include/netlink-private/types.h b/include/netlink-private/types.h index 1b19b584..d8a92690 100644 --- a/include/netlink-private/types.h +++ b/include/netlink-private/types.h @@ -99,6 +99,7 @@ struct nl_cache_assoc { struct nl_cache * ca_cache; change_func_t ca_change; + change_func_v2_t ca_change_v2; void * ca_change_data; }; diff --git a/include/netlink/cache.h b/include/netlink/cache.h index 71eaceb2..c0797d01 100644 --- a/include/netlink/cache.h +++ b/include/netlink/cache.h @@ -35,6 +35,8 @@ enum { struct nl_cache; typedef void (*change_func_t)(struct nl_cache *, struct nl_object *, int, void *); +typedef void (*change_func_v2_t)(struct nl_cache *, struct nl_object *old_obj, + struct nl_object *new_obj, uint64_t, int, void *); /** * @ingroup cache @@ -88,6 +90,10 @@ extern int nl_cache_include(struct nl_cache *, struct nl_object *, change_func_t, void *); +extern int nl_cache_include_v2(struct nl_cache *, + struct nl_object *, + change_func_v2_t, + void *); extern void nl_cache_set_arg1(struct nl_cache *, int); extern void nl_cache_set_arg2(struct nl_cache *, int); extern void nl_cache_set_flags(struct nl_cache *, unsigned int); @@ -154,6 +160,9 @@ extern int nl_cache_mngr_add(struct nl_cache_mngr *, extern int nl_cache_mngr_add_cache(struct nl_cache_mngr *mngr, struct nl_cache *cache, change_func_t cb, void *data); +extern int nl_cache_mngr_add_cache_v2(struct nl_cache_mngr *mngr, + struct nl_cache *cache, + change_func_v2_t cb, void *data); extern int nl_cache_mngr_get_fd(struct nl_cache_mngr *); extern int nl_cache_mngr_poll(struct nl_cache_mngr *, int); |