slotmap: Introduce slotmap_{rd,wr,un}lock() wrappers for lock debugging

Change-Id: I8dde90d62e673e60e026979c74074f7084490467
diff --git a/src/slotmap.c b/src/slotmap.c
index f4a22e1..9e16fff 100644
--- a/src/slotmap.c
+++ b/src/slotmap.c
@@ -40,14 +40,14 @@
 {
 	struct slot_mapping *map;
 
-	pthread_rwlock_rdlock(&maps->rwlock);
+	slotmaps_rdlock(maps);
 	llist_for_each_entry(map, &maps->mappings, list) {
 		if (client_slot_equals(&map->client, client)) {
-			pthread_rwlock_unlock(&maps->rwlock);
+			slotmaps_unlock(maps);
 			return map;
 		}
 	}
-	pthread_rwlock_unlock(&maps->rwlock);
+	slotmaps_unlock(maps);
 	return NULL;
 }
 
@@ -56,14 +56,14 @@
 {
 	struct slot_mapping *map;
 
-	pthread_rwlock_rdlock(&maps->rwlock);
+	slotmaps_rdlock(maps);
 	llist_for_each_entry(map, &maps->mappings, list) {
 		if (bank_slot_equals(&map->bank, bank)) {
-			pthread_rwlock_unlock(&maps->rwlock);
+			slotmaps_unlock(maps);
 			return map;
 		}
 	}
-	pthread_rwlock_unlock(&maps->rwlock);
+	slotmaps_unlock(maps);
 	return NULL;
 
 }
@@ -102,13 +102,13 @@
 	map->bank = *bank;
 	map->client = *client;
 
-	pthread_rwlock_wrlock(&maps->rwlock);
+	slotmaps_wrlock(maps);
 	llist_add_tail(&map->list, &maps->mappings);
 #ifdef REMSIM_SERVER
 	map->state = SLMAP_S_NEW;
 	INIT_LLIST_HEAD(&map->bank_list); /* to ensure llist_del() always succeeds */
 #endif
-	pthread_rwlock_unlock(&maps->rwlock);
+	slotmaps_unlock(maps);
 
 	printf("Slot Map %s added\n", slotmap_name(mapname, sizeof(mapname), map));
 
@@ -132,9 +132,9 @@
 /* thread-safe removal of a bank<->client map */
 void slotmap_del(struct slotmaps *maps, struct slot_mapping *map)
 {
-	pthread_rwlock_wrlock(&maps->rwlock);
+	slotmaps_wrlock(maps);
 	_slotmap_del(maps, map);
-	pthread_rwlock_unlock(&maps->rwlock);
+	slotmaps_unlock(maps);
 }
 
 struct slotmaps *slotmap_init(void *ctx)
@@ -171,9 +171,9 @@
 void Slotmap_state_change(struct slot_mapping *map, enum slot_mapping_state new_state,
 			  struct llist_head *new_bank_list, const char *file, int line)
 {
-	pthread_rwlock_wrlock(&map->maps->rwlock);
+	slotmaps_wrlock(map->maps);
 	_Slotmap_state_change(map, new_state, new_bank_list, file, line);
-	pthread_rwlock_unlock(&map->maps->rwlock);
+	slotmaps_unlock(map->maps);
 }
 
 #endif