Change in libosmo-abis[master]: ipaccess: Use osmo_fd_setup to set up callbacks

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

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Aug 22 11:11:52 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10568


Change subject: ipaccess: Use osmo_fd_setup to set up callbacks
......................................................................

ipaccess: Use osmo_fd_setup to set up callbacks

We have a public API in libosmocore, so let's use it istead of manually
filling each struct field.

Change-Id: I09479c3d5b0b9bd69a56c080b8c533a32824cc66
---
M src/input/ipaccess.c
1 file changed, 5 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/68/10568/1

diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index 3d2fa44..6f41c97 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -189,11 +189,9 @@
 			newbfd = &ts->driver.ipaccess.fd;
 
 			/* get rid of our old temporary bfd */
-			newbfd->fd = bfd->fd;
-			newbfd->when |= bfd->when; /* preserve 'newbfd->when' flags potentially set by sign_link_up() */
-			newbfd->cb = bfd->cb;
-			newbfd->data = bfd->data;
-			newbfd->priv_nr = E1INP_SIGN_RSL + unit_data.trx_id;
+			/* preserve 'newbfd->when' flags potentially set by sign_link_up() */
+			osmo_fd_setup(newbfd, bfd->fd, bfd->when, bfd->cb,
+				      bfd->data, E1INP_SIGN_RSL + unit_data.trx_id);
 			osmo_fd_unregister(bfd);
 			bfd->fd = -1;
 			ret = osmo_fd_register(newbfd);
@@ -479,11 +477,7 @@
 	e1i_ts = &line->ts[idx];
 
 	bfd = &e1i_ts->driver.ipaccess.fd;
-	bfd->fd = fd;
-	bfd->data = line;
-	bfd->priv_nr = E1INP_SIGN_OML;
-	bfd->cb = ipaccess_fd_cb;
-	bfd->when = BSC_FD_READ;
+	osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_OML);
 	ret = osmo_fd_register(bfd);
 	if (ret < 0) {
 		LOGP(DLINP, LOGL_ERROR, "could not register FD\n");
@@ -535,11 +529,7 @@
 	e1i_ts = &line->ts[E1INP_SIGN_RSL-1];
 
 	bfd = &e1i_ts->driver.ipaccess.fd;
-	bfd->fd = fd;
-	bfd->data = line;
-	bfd->priv_nr = E1INP_SIGN_RSL;
-	bfd->cb = ipaccess_fd_cb;
-	bfd->when = BSC_FD_READ;
+	osmo_fd_setup(bfd, fd, BSC_FD_READ, ipaccess_fd_cb, line, E1INP_SIGN_RSL);
 	ret = osmo_fd_register(bfd);
 	if (ret < 0) {
 		LOGP(DLINP, LOGL_ERROR, "could not register FD\n");

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

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I09479c3d5b0b9bd69a56c080b8c533a32824cc66
Gerrit-Change-Number: 10568
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180822/433285f9/attachment.htm>


More information about the gerrit-log mailing list