diff options
author | Roopa Prabhu <roopa@cumulusnetworks.com> | 2016-06-18 22:30:06 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-07-08 10:02:07 (GMT) |
commit | 1db12c9e3208c98332cf169eb689a985d77c9a05 (patch) | |
tree | 16d8aa47c593f4794fb97ee21c0cfff20bfc0f67 /include | |
parent | b7d458c1939913c46b32c7643b412767b87d98c2 (diff) | |
download | libnl-1db12c9e3208c98332cf169eb689a985d77c9a05.zip libnl-1db12c9e3208c98332cf169eb689a985d77c9a05.tar.gz libnl-1db12c9e3208c98332cf169eb689a985d77c9a05.tar.bz2 |
cache: modify nl_cache_search to look at cache provided attributes for search
This patch adds a new cache operation co_cache_search_attrs_get to request for
attributes to use in the search. This gives the cache an opportunity to
use search attributes based on netlink message flags.
This is mainly to give the route cache an ability to decide on the cache
inclusion depending on the netlink header flags like NLM_F_APPEND and
NLM_F_REPLACE.
Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/netlink-private/cache-api.h | 15 | ||||
-rw-r--r-- | include/netlink/cache.h | 3 | ||||
-rw-r--r-- | include/netlink/hashtable.h | 2 | ||||
-rw-r--r-- | include/netlink/object.h | 3 |
4 files changed, 23 insertions, 0 deletions
diff --git a/include/netlink-private/cache-api.h b/include/netlink-private/cache-api.h index f3d9f01..0b39bfa 100644 --- a/include/netlink-private/cache-api.h +++ b/include/netlink-private/cache-api.h @@ -239,6 +239,21 @@ struct nl_cache_ops int (*co_include_event)(struct nl_cache *cache, struct nl_object *obj, change_func_t change_cb, void *data); + /** + * The function registered under this callback is called when an + * a nl_cache_search is to performed on the cache. + * + * The callback if implemented by a cache must return an attribute + * mask to be used for the cache search + * + * If no function is registered, nl_cache_search will internally use + * oo_id_attrs_get to get its attributes for matching objects + * + * @see nl_cache_search() + */ + uint32_t (*co_cache_search_attrs_get)(struct nl_cache *cache, + struct nl_object *needle); + void (*reserved_1)(void); void (*reserved_2)(void); void (*reserved_3)(void); diff --git a/include/netlink/cache.h b/include/netlink/cache.h index 71eaceb..7077f2e 100644 --- a/include/netlink/cache.h +++ b/include/netlink/cache.h @@ -96,6 +96,9 @@ extern void nl_cache_set_flags(struct nl_cache *, unsigned int); extern int nl_cache_is_empty(struct nl_cache *); extern struct nl_object * nl_cache_search(struct nl_cache *, struct nl_object *); +extern struct nl_object * nl_cache_search_mask(struct nl_cache *, + struct nl_object *, + uint32_t); extern struct nl_object *nl_cache_find(struct nl_cache *, struct nl_object *); extern void nl_cache_mark_all(struct nl_cache *); diff --git a/include/netlink/hashtable.h b/include/netlink/hashtable.h index 70d8c0f..c52f6e1 100644 --- a/include/netlink/hashtable.h +++ b/include/netlink/hashtable.h @@ -42,6 +42,8 @@ extern int nl_hash_table_del(nl_hash_table_t *ht, extern struct nl_object * nl_hash_table_lookup(nl_hash_table_t *ht, struct nl_object *obj); +extern struct nl_object * nl_hash_table_lookup_mask(nl_hash_table_t *ht, + struct nl_object *obj, uint32_t); extern uint32_t nl_hash(void *k, size_t length, uint32_t initval); diff --git a/include/netlink/object.h b/include/netlink/object.h index b0c32c9..e442f0f 100644 --- a/include/netlink/object.h +++ b/include/netlink/object.h @@ -45,6 +45,9 @@ extern uint32_t nl_object_diff(struct nl_object *, struct nl_object *); extern uint64_t nl_object_diff64(struct nl_object *, struct nl_object *); +extern uint32_t nl_object_diff_mask(struct nl_object *, + struct nl_object *, + uint32_t); extern int nl_object_match_filter(struct nl_object *, struct nl_object *); extern char * nl_object_attrs2str(struct nl_object *, |