pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/39361?usp=email )


Change subject: cosmetic: osmo_io: Improvde documentation of read_cb when 
segmentation is used
......................................................................

cosmetic: osmo_io: Improvde documentation of read_cb when segmentation is used

Change-Id: I93ac0b3224e17bfd1ecd4244a6dc7a44457c06e8
---
M include/osmocom/core/osmo_io.h
M src/core/osmo_io.c
2 files changed, 8 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/39361/1

diff --git a/include/osmocom/core/osmo_io.h b/include/osmocom/core/osmo_io.h
index fa1f9c3..f4bfec4 100644
--- a/include/osmocom/core/osmo_io.h
+++ b/include/osmocom/core/osmo_io.h
@@ -98,7 +98,11 @@
                 *  \param[in] iofd osmo_io_fd for which read() has completed.
                 *  \param[in] res return value of the read() call, or -errno 
in case of error.
                 *  \param[in] msg message buffer containing the read data. 
Ownership is transferred to the
-                *  call-back, and it must make sure to msgb_free() it 
eventually! */
+                *  call-back, and it must make sure to msgb_free() it 
eventually!
+                *
+                *  NOTE: If segmentation_cb is in use, the bytes read in res 
value
+                *        may be different than those provided in the msg 
parameter!
+                */
                void (*read_cb)(struct osmo_io_fd *iofd, int res, struct msgb 
*msg);

                /*! completion call-back function when write issued via 
osmo_iofd_write_msgb() has completed
diff --git a/src/core/osmo_io.c b/src/core/osmo_io.c
index 15703cf..65c9b33 100644
--- a/src/core/osmo_io.c
+++ b/src/core/osmo_io.c
@@ -344,6 +344,9 @@
                pending = NULL;
                res = iofd_handle_segmentation(iofd, msg, &pending);
                if (res != IOFD_SEG_ACT_DEFER) {
+                       /* It it expected as per API spec that we return the
+                        * return value of read here. The amount of bytes in 
msg is
+                        * available to the user in msg itself. */
                        iofd->io_ops.read_cb(iofd, rc, msg);
                        /* The user could unregister/close the iofd during 
read_cb() above.
                         * Once that's done, it doesn't expect to receive any 
more events,

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/39361?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I93ac0b3224e17bfd1ecd4244a6dc7a44457c06e8
Gerrit-Change-Number: 39361
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to