Change in osmo-remsim[master]: slotmap: Return newly-created map from slotmap_add()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Mar 7 20:37:47 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13180 )

Change subject: slotmap: Return newly-created map from slotmap_add()
......................................................................

slotmap: Return newly-created map from slotmap_add()

Change-Id: I1bc66fee1f457bcf9693491031d7d4c411fc582e
---
M src/slotmap.c
M src/slotmap.h
2 files changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/src/slotmap.c b/src/slotmap.c
index 924452b..12d7777 100644
--- a/src/slotmap.c
+++ b/src/slotmap.c
@@ -63,7 +63,8 @@
 }
 
 /* thread-safe creating of a new bank<->client map */
-int slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client)
+struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank,
+				 const struct client_slot *client)
 {
 	struct slot_mapping *map;
 	char mapname[64];
@@ -76,20 +77,20 @@
 	if (map) {
 		fprintf(stderr, "BANKD %u:%u already in use, cannot add new map\n",
 			bank->bank_id, bank->slot_nr);
-		return -EBUSY;
+		return NULL;
 	}
 
 	map = slotmap_by_client(maps, client);
 	if (map) {
 		fprintf(stderr, "CLIENT %u:%u already in use, cannot add new map\n",
 			client->client_id, client->slot_nr);
-		return -EBUSY;
+		return NULL;
 	}
 
 	/* allocate new mapping and add to list of mappings */
 	map = talloc_zero(maps, struct slot_mapping);
 	if (!map)
-		return -ENOMEM;
+		return NULL;
 
 	map->maps = maps;
 	map->bank = *bank;
@@ -105,7 +106,7 @@
 
 	printf("Slot Map %s added\n", slotmap_name(mapname, sizeof(mapname), map));
 
-	return 0;
+	return map;
 }
 
 /* thread-safe removal of a bank<->client map */
diff --git a/src/slotmap.h b/src/slotmap.h
index 27d7e1b..af08a81 100644
--- a/src/slotmap.h
+++ b/src/slotmap.h
@@ -74,7 +74,7 @@
 struct slot_mapping *slotmap_by_bank(struct slotmaps *maps, const struct bank_slot *bank);
 
 /* thread-safe creating of a new bank<->client map */
-int slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client);
+struct slot_mapping *slotmap_add(struct slotmaps *maps, const struct bank_slot *bank, const struct client_slot *client);
 
 /* thread-safe removal of a bank<->client map */
 void slotmap_del(struct slotmaps *maps, struct slot_mapping *map);

-- 
To view, visit https://gerrit.osmocom.org/13180
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-remsim
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1bc66fee1f457bcf9693491031d7d4c411fc582e
Gerrit-Change-Number: 13180
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190307/30dde756/attachment.htm>


More information about the gerrit-log mailing list