slotmap: Add slotmap_get_id() function to get numeric ID of slot map

Change-Id: Ie476244d9ade30eed9215923275aa82a5d10176f
This commit is contained in:
Harald Welte 2019-03-06 16:05:42 +01:00
parent 2bf39e0fe0
commit c86568359c
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -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);