Change in osmo-e1d[master]: add _e1d_line_destroy() / _e1d_intf_destroy() functions

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

laforge gerrit-no-reply at lists.osmocom.org
Mon Jun 29 12:11:13 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-e1d/+/19045 )


Change subject: add _e1d_line_destroy() / _e1d_intf_destroy() functions
......................................................................

add _e1d_line_destroy() / _e1d_intf_destroy() functions

Change-Id: I5425d22288d7239063d621bddfe81e9cf21f1a5b
---
M src/e1d.h
M src/intf_line.c
2 files changed, 35 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/45/19045/1

diff --git a/src/e1d.h b/src/e1d.h
index 55b4800..0cc1993 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -94,9 +94,15 @@
 struct e1_intf *
 _e1_intf_new(struct e1_daemon *e1d, void *drv_data);
 
+void
+_e1_intf_destroy(struct e1_intf *intf);
+
 struct e1_line *
 _e1_line_new(struct e1_intf *intf, void *drv_data);
 
+void
+_e1_line_destroy(struct e1_line *line);
+
 int
 _e1_rx_hdlcfs(struct e1_ts *ts, uint8_t *buf, int len);
 
diff --git a/src/intf_line.c b/src/intf_line.c
index 27fc5db..0dfa3fc 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -67,6 +67,21 @@
 	return intf;
 }
 
+void
+_e1_intf_destroy(struct e1_intf *intf)
+{
+	struct e1_line *line, *line2;
+
+	/* destroy all lines */
+	llist_for_each_entry_safe(line, line2, &intf->lines, list)
+		_e1_line_destroy(line);
+
+	/* remove from global list of interfaces */
+	llist_del(&intf->list);
+
+	talloc_free(intf);
+}
+
 struct e1_line *
 _e1_line_new(struct e1_intf *intf, void *drv_data)
 {
@@ -95,6 +110,20 @@
 	return line;
 }
 
+void
+_e1_line_destroy(struct e1_line *line)
+{
+	/* close all [peer] file descriptors */
+	for (int i=0; i<32; i++)
+		_e1d_ts_stop(&line->ts[i]);
+
+	/* remove from per-interface list of lines */
+	llist_del(&line->list);
+
+	talloc_free(line);
+}
+
+
 // ---------------------------------------------------------------------------
 // data transfer
 // ---------------------------------------------------------------------------

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

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I5425d22288d7239063d621bddfe81e9cf21f1a5b
Gerrit-Change-Number: 19045
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200629/e667981a/attachment.htm>


More information about the gerrit-log mailing list