pespin has uploaded this change for review.

View Change

osmo_io: close() op in backend only takes care of closing

Move dependent steps such as unregister to be done at the common path,
and leave the close() op on each backend to implement only the specific
close operations.

Change-Id: I0150afcc0b83ea8b2d00d108658ed688ce487f7f
---
M src/core/osmo_io.c
M src/core/osmo_io_poll.c
M src/core/osmo_io_uring.c
3 files changed, 4 insertions(+), 5 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/70/39070/1
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index cef9bec..387cefb 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -845,6 +845,10 @@

iofd->pending = NULL;

+ osmo_iofd_ops.read_disable(iofd);
+ osmo_iofd_ops.write_disable(iofd);
+ osmo_iofd_unregister(iofd);
+
rc = osmo_iofd_ops.close(iofd);
iofd->fd = -1;
return rc;
diff --git a/src/core/osmo_io_poll.c b/src/core/osmo_io_poll.c
index 89ff466..92f03f8 100644
--- a/src/core/osmo_io_poll.c
+++ b/src/core/osmo_io_poll.c
@@ -156,9 +156,7 @@

static int iofd_poll_close(struct osmo_io_fd *iofd)
{
- iofd_poll_unregister(iofd);
osmo_fd_close(&iofd->u.poll.ofd);
-
return 0;
}

diff --git a/src/core/osmo_io_uring.c b/src/core/osmo_io_uring.c
index be7e1d8..72a465e 100644
--- a/src/core/osmo_io_uring.c
+++ b/src/core/osmo_io_uring.c
@@ -507,9 +507,6 @@

static int iofd_uring_close(struct osmo_io_fd *iofd)
{
- iofd_uring_read_disable(iofd);
- iofd_uring_write_disable(iofd);
- iofd_uring_unregister(iofd);
return close(iofd->fd);
}


To view, visit change 39070. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0150afcc0b83ea8b2d00d108658ed688ce487f7f
Gerrit-Change-Number: 39070
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin@sysmocom.de>