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 @@ const char *slotmap_name(char *buf, size_t buf_len, const struct slot_mapping *m 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 @@ struct slotmaps { 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);