Change in libosmocore[master]: gprs_ns2: add gprs_ns2_free_nsvcs() to free all NS-VC of a NSE

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/.

lynxis lazus gerrit-no-reply at lists.osmocom.org
Mon Dec 7 06:41:58 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/21572 )


Change subject: gprs_ns2: add gprs_ns2_free_nsvcs() to free all NS-VC of a NSE
......................................................................

gprs_ns2: add gprs_ns2_free_nsvcs() to free all NS-VC of a NSE

Change-Id: I909443b540dbf75146297f1d7f94940690be6c0d
---
M include/osmocom/gprs/gprs_ns2.h
M src/gb/gprs_ns2.c
M src/gb/libosmogb.map
3 files changed, 18 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/72/21572/1

diff --git a/include/osmocom/gprs/gprs_ns2.h b/include/osmocom/gprs/gprs_ns2.h
index 4b89ab5..3c3c63a 100644
--- a/include/osmocom/gprs/gprs_ns2.h
+++ b/include/osmocom/gprs/gprs_ns2.h
@@ -161,6 +161,7 @@
 
 /* create vc */
 void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc);
+void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse);
 struct gprs_ns2_vc *gprs_ns2_nsvc_by_nsvci(struct gprs_ns2_inst *nsi, uint16_t nsvci);
 
 /* generic VL driver */
diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 00a1f61..6d4b079 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -562,6 +562,21 @@
 	talloc_free(nsvc);
 }
 
+/*! Destroy/release all NS-VC of given NSE
+ *  \param[in] nse NSE
+ */
+void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse)
+{
+	struct gprs_ns2_vc *nsvc, *tmp;
+
+	if (!nse)
+		return;
+
+	llist_for_each_entry_safe(nsvc, tmp, &nse->nsvc, list) {
+		gprs_ns2_free_nsvc(nsvc);
+	}
+}
+
 /*! Allocate a message buffer for use with the NS2 stack. */
 struct msgb *gprs_ns2_msgb_alloc(void)
 {
@@ -722,15 +737,10 @@
  *  \param[in] nse NS Entity to destroy */
 void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
 {
-	struct gprs_ns2_vc *nsvc, *tmp;
-
 	if (!nse)
 		return;
 
-	llist_for_each_entry_safe(nsvc, tmp, &nse->nsvc, list) {
-		gprs_ns2_free_nsvc(nsvc);
-	}
-
+	gprs_ns2_free_nsvcs(nse);
 	ns2_prim_status_ind(nse, NULL, 0, NS_AFF_CAUSE_FAILURE);
 
 	llist_del(&nse->list);
diff --git a/src/gb/libosmogb.map b/src/gb/libosmogb.map
index 0590140..7e7971a 100644
--- a/src/gb/libosmogb.map
+++ b/src/gb/libosmogb.map
@@ -93,6 +93,7 @@
 gprs_ns2_free_nse;
 gprs_ns2_free_nses;
 gprs_ns2_free_nsvc;
+gprs_ns2_free_nsvcs;
 gprs_ns2_frgre_bind;
 gprs_ns2_fr_bind;
 gprs_ns2_fr_bind_netif;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I909443b540dbf75146297f1d7f94940690be6c0d
Gerrit-Change-Number: 21572
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201207/8a3f14a8/attachment.htm>


More information about the gerrit-log mailing list