summaryrefslogtreecommitdiffstats
path: root/lib/object.c
diff options
context:
space:
mode:
authorroopa <roopa@cumulusnetworks.com>2013-01-08 12:33:29 (GMT)
committerThomas Graf <tgraf@suug.ch>2013-01-11 12:52:50 (GMT)
commitb1ebda92410c57c09c7aff3e4d5ce3572d9fc1c1 (patch)
tree278021a70471809c8f2fdf7a3a80fd6f20174754 /lib/object.c
parent3540e44b158f0f45fc2364d99e70433fba176b21 (diff)
downloadlibnl-b1ebda92410c57c09c7aff3e4d5ce3572d9fc1c1.zip
libnl-b1ebda92410c57c09c7aff3e4d5ce3572d9fc1c1.tar.gz
libnl-b1ebda92410c57c09c7aff3e4d5ce3572d9fc1c1.tar.bz2
cache: Add new nl_cache_find api
This patch adds new cache find api nl_cache_find api was suggested by Thomas. Unlike nl_cache_search, this patch uses nl_object_match_filter() to look for an object match. Am not sure this matches what was decided on the list few weeks back. I will be happy to make any changes. Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
Diffstat (limited to 'lib/object.c')
-rw-r--r--lib/object.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/object.c b/lib/object.c
index 806bae6..7361194 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -506,6 +506,28 @@ struct nl_object_ops *nl_object_get_ops(const struct nl_object *obj)
return obj->ce_ops;
}
+/**
+ * Return object id attribute mask
+ * @arg obj object
+ *
+ * @return object id attribute mask
+ */
+uint32_t nl_object_get_id_attrs(struct nl_object *obj)
+{
+ struct nl_object_ops *ops = obj_ops(obj);
+ uint32_t id_attrs;
+
+ if (!ops)
+ return 0;
+
+ if (ops->oo_id_attrs_get)
+ id_attrs = ops->oo_id_attrs_get(obj);
+ else
+ id_attrs = ops->oo_id_attrs;
+
+ return id_attrs;
+}
+
/** @} */
/** @} */