Signed-off-by: Jan Friesse <[email protected]>
---
exec/icmap.c | 22 ++++++++++++++++++++++
include/corosync/icmap.h | 13 +++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/exec/icmap.c b/exec/icmap.c
index cfc49ca..337a560 100644
--- a/exec/icmap.c
+++ b/exec/icmap.c
@@ -396,6 +396,28 @@ static int icmap_item_eq(const struct icmap_item *item,
const void *value, size_
return (0);
}
+int icmap_key_value_eq(
+ const icmap_map_t map1,
+ const char *key_name1,
+ const icmap_map_t map2,
+ const char *key_name2)
+{
+ struct icmap_item *item1, *item2;
+
+ if (map1 == NULL || key_name1 == NULL || map2 == NULL || key_name2 ==
NULL) {
+ return (0);
+ }
+
+ item1 = qb_map_get(map1->qb_map, key_name1);
+ item2 = qb_map_get(map2->qb_map, key_name2);
+
+ if (item1 == NULL || item2 == NULL) {
+ return (0);
+ }
+
+ return (icmap_item_eq(item1, item2->value, item2->value_len,
item2->type));
+}
+
cs_error_t icmap_set_r(
const icmap_map_t map,
const char *key_name,
diff --git a/include/corosync/icmap.h b/include/corosync/icmap.h
index 8026c88..a952ef6 100644
--- a/include/corosync/icmap.h
+++ b/include/corosync/icmap.h
@@ -152,6 +152,19 @@ extern void icmap_fini_r(const icmap_map_t map);
extern icmap_map_t icmap_get_global_map(void);
/*
+ * Compare value of key with name key_name1 in map1 with key with name
key_name2
+ * in map2. Two values must have same type, length and value to be considered
equal.
+ * Function returns 0 when any of map1, key_name1, map2, key_name2 are NULL, or
+ * key_name is not found in map, or keys are not equal. != 0 is returned when
+ * values are equal.
+ */
+extern int icmap_key_value_eq(
+ const icmap_map_t map1,
+ const char *key_name1,
+ const icmap_map_t map2,
+ const char *key_name2);
+
+/*
* Store value with value_len length and type as key_name name in global icmap.
*/
extern cs_error_t icmap_set(
--
1.7.1
_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss