summaryrefslogtreecommitdiff
path: root/nuttx/net/iob/iob_copyin.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/net/iob/iob_copyin.c')
-rw-r--r--nuttx/net/iob/iob_copyin.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/nuttx/net/iob/iob_copyin.c b/nuttx/net/iob/iob_copyin.c
index 0c9b3f037..fedd37098 100644
--- a/nuttx/net/iob/iob_copyin.c
+++ b/nuttx/net/iob/iob_copyin.c
@@ -39,6 +39,13 @@
#include <nuttx/config.h>
+#if defined(CONFIG_DEBUG) && defined(CONFIG_NET_IOB_DEBUG)
+/* Force debug output (from this file only) */
+
+# undef CONFIG_DEBUG_NET
+# define CONFIG_DEBUG_NET 1
+#endif
+
#include <stdint.h>
#include <string.h>
#include <errno.h>
@@ -91,13 +98,14 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src,
unsigned int ncopy;
unsigned int avail;
+ nllvdbg("iob=%p len=%u offset=%u\n", iob, len, offset);
DEBUGASSERT(iob && src);
/* The offset must applied to data that is already in the I/O buffer chain */
if (offset > iob->io_pktlen)
{
- ndbg("ERROR: offset is past the end of data: %d > %d\n",
+ ndbg("ERROR: offset is past the end of data: %u > %u\n",
offset, iob->io_pktlen);
return -ESPIPE;
}
@@ -123,6 +131,8 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src,
dest = &iob->io_data[iob->io_offset + offset];
avail = iob->io_len - offset;
+ nllvdbg("iob=%p avail=%u len=%u next=%p\n", iob, avail, len, next);
+
/* Will the rest of the copy fit into this buffer, overwriting
* existing data.
*/
@@ -146,7 +156,7 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src,
/* Yes.. We can extend this buffer to the up to the very end. */
- maxlen = CONFIG_IOB_BUFSIZE - iob->io_offset;
+ maxlen = CONFIG_IOB_BUFSIZE - iob->io_offset;
/* This is the new buffer length that we need. Of course,
* clipped to the maximum possible size in this buffer.
@@ -178,6 +188,8 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src,
/* Copy from the user buffer to the I/O buffer. */
memcpy(dest, src, ncopy);
+ nllvdbg("iob=%p, Copy %u bytes, new len=%u\n",
+ iob, ncopy, iob->io_len);
/* Adjust the total length of the copy and the destination address in
* the user buffer.
@@ -204,6 +216,7 @@ int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src,
/* Add the new, empty I/O buffer to the end of the buffer chain. */
iob->io_flink = next;
+ nllvdbg("iob=%p added to the chain\n", iob);
}
iob = next;