Change in osmo-e1d[master]: add e1_line_destroy() / e1_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
Tue Jun 30 06:02:05 UTC 2020


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

Change subject: add e1_line_destroy() / e1_intf_destroy() functions
......................................................................

add e1_line_destroy() / e1_intf_destroy() functions

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

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/e1d.h b/src/e1d.h
index a5076b0..7803b2e 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -94,9 +94,15 @@
 struct e1_intf *
 e1d_find_intf(struct e1_daemon *e1d, uint8_t id);
 
+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_line_mux_out(struct e1_line *line, uint8_t *buf, int fts);
 
diff --git a/src/intf_line.c b/src/intf_line.c
index a879922..9118232 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++)
+		e1_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: 3
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Assignee: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200630/c59bd4a8/attachment.htm>


More information about the gerrit-log mailing list