slotmap: Add slotmap_get_id() function to get numeric ID of slot map
Change-Id: Ie476244d9ade30eed9215923275aa82a5d10176f
diff --git a/src/slotmap.c b/src/slotmap.c
index a8874fb..703dd02 100644
--- a/src/slotmap.c
+++ b/src/slotmap.c
@@ -29,6 +29,10 @@
return buf;
}
+uint32_t slotmap_get_id(const struct slot_mapping *map)
+{
+ return (map->bank.bank_id << 16) | map->bank.slot_nr;
+}
/* thread-safe lookup of map by client:slot */
struct slot_mapping *slotmap_by_client(struct slotmaps *maps, const struct client_slot *client)
diff --git a/src/slotmap.h b/src/slotmap.h
index 5d3d891..a26de6d 100644
--- a/src/slotmap.h
+++ b/src/slotmap.h
@@ -68,6 +68,8 @@
pthread_rwlock_t rwlock;
};
+uint32_t slotmap_get_id(const struct slot_mapping *map);
+
/* thread-safe lookup of map by client:slot */
struct slot_mapping *slotmap_by_client(struct slotmaps *maps, const struct client_slot *client);