dexter has uploaded this change for review.
e1_input: add new driver callback function: line_create
When a line is created using e1inp_line_create, then the line data
structures are initialized and the line is registered in the line list.
struct e1inp_line also contains driver specific sub structs that,
depending on the driver, might also need some initialization. At the
moment is no way to do that, so lets add a line_create callback that,
when populated by the driver, is executed on line creation.
Related: OS#5983
Change-Id: I404fa23e9b8a952be84e9716889c0dbbbc665d22
---
M include/osmocom/abis/e1_input.h
M src/e1_input.c
2 files changed, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/00/32400/1
diff --git a/include/osmocom/abis/e1_input.h b/include/osmocom/abis/e1_input.h
index a66f8eb..a7d4e76 100644
--- a/include/osmocom/abis/e1_input.h
+++ b/include/osmocom/abis/e1_input.h
@@ -182,6 +182,7 @@
const char *name;
int (*want_write)(struct e1inp_ts *ts);
int (*line_update)(struct e1inp_line *line);
+ int (*line_create)(struct e1inp_line *line);
void (*close)(struct e1inp_sign_link *link);
void (*vty_show)(struct vty *vty, struct e1inp_line *line);
int default_delay;
diff --git a/src/e1_input.c b/src/e1_input.c
index e3ac67e..6e0a924 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -639,8 +639,15 @@
line->use_count.talloc_object = line;
line->use_count.use_cb = e1inp_line_use_cb;
- e1inp_line_get2(line, "ctor");
+ if (driver->line_create) {
+ if (driver->line_create(line) < 0) {
+ talloc_free(line);
+ return NULL;
+ }
+ }
+
+ e1inp_line_get2(line, "ctor");
llist_add_tail(&line->list, &e1inp_line_list);
return line;
To view, visit change 32400. To unsubscribe, or for help writing mail filters, visit settings.