You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/06/10 15:45:41 UTC
[incubator-nuttx] branch master updated (7c20199 -> 2c51c29)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from 7c20199 riscv/bl602:replace syslog to debugging log macros
new e73883a Documentation/iob: update the function prototype
new 2c51c29 mm/iob: add an interface to support dequeue an iob from the queue
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Documentation/reference/os/iob.rst | 29 +++++++---
include/nuttx/mm/iob.h | 14 +++++
mm/iob/Make.defs | 2 +-
...{iob_remove_queue.c => iob_free_queue_qentry.c} | 61 +++++++++++++---------
4 files changed, 71 insertions(+), 35 deletions(-)
copy mm/iob/{iob_remove_queue.c => iob_free_queue_qentry.c} (66%)
[incubator-nuttx] 02/02: mm/iob: add an interface to support
dequeue an iob from the queue
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 2c51c29768d395c3a1689b7d083c8beec8782a38
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Jun 8 23:38:26 2021 +0800
mm/iob: add an interface to support dequeue an iob from the queue
Signed-off-by: chao.an <an...@xiaomi.com>
---
Documentation/reference/os/iob.rst | 6 +++
include/nuttx/mm/iob.h | 14 ++++++
mm/iob/Make.defs | 2 +-
mm/iob/iob_free_queue_qentry.c | 94 ++++++++++++++++++++++++++++++++++++++
4 files changed, 115 insertions(+), 1 deletion(-)
diff --git a/Documentation/reference/os/iob.rst b/Documentation/reference/os/iob.rst
index 01e74d2..b962c5c 100644
--- a/Documentation/reference/os/iob.rst
+++ b/Documentation/reference/os/iob.rst
@@ -164,6 +164,7 @@ Public Function Prototypes
- :c:func:`iob_remove_queue()`
- :c:func:`iob_peek_queue()`
- :c:func:`iob_free_queue()`
+ - :c:func:`iob_free_queue_qentry()`
- :c:func:`iob_copyin()`
- :c:func:`iob_trycopyin()`
- :c:func:`iob_copyout()`
@@ -238,6 +239,11 @@ Public Function Prototypes
Free an entire queue of I/O buffer chains.
+.. c:function:: void iob_free_queue_qentry(FAR struct iob_s *iob, \
+ FAR struct iob_queue_s *iobq);
+
+ Free an iob entire queue of I/O buffer chains.
+
.. c:function:: int iob_copyin(FAR struct iob_s *iob, FAR const uint8_t *src, \
unsigned int len, unsigned int offset, bool throttled);
diff --git a/include/nuttx/mm/iob.h b/include/nuttx/mm/iob.h
index f5f5c8c..5fcabb1 100644
--- a/include/nuttx/mm/iob.h
+++ b/include/nuttx/mm/iob.h
@@ -426,6 +426,20 @@ void iob_free_queue(FAR struct iob_queue_s *qhead,
#endif /* CONFIG_IOB_NCHAINS > 0 */
/****************************************************************************
+ * Name: iob_free_queue_qentry
+ *
+ * Description:
+ * Free an iob entire queue of I/O buffer chains.
+ *
+ ****************************************************************************/
+
+#if CONFIG_IOB_NCHAINS > 0
+void iob_free_queue_qentry(FAR struct iob_s *iob,
+ FAR struct iob_queue_s *iobq,
+ enum iob_user_e producerid);
+#endif /* CONFIG_IOB_NCHAINS > 0 */
+
+/****************************************************************************
* Name: iob_copyin
*
* Description:
diff --git a/mm/iob/Make.defs b/mm/iob/Make.defs
index 7bf53e7..e241204 100644
--- a/mm/iob/Make.defs
+++ b/mm/iob/Make.defs
@@ -27,7 +27,7 @@ CSRCS += iob_concat.c iob_copyin.c iob_copyout.c iob_contig.c iob_free.c
CSRCS += iob_free_chain.c iob_free_qentry.c iob_free_queue.c
CSRCS += iob_initialize.c iob_pack.c iob_peek_queue.c iob_remove_queue.c
CSRCS += iob_statistics.c iob_trimhead.c iob_trimhead_queue.c iob_trimtail.c
-CSRCS += iob_navail.c
+CSRCS += iob_navail.c iob_free_queue_qentry.c
ifeq ($(CONFIG_IOB_NOTIFIER),y)
CSRCS += iob_notifier.c
diff --git a/mm/iob/iob_free_queue_qentry.c b/mm/iob/iob_free_queue_qentry.c
new file mode 100644
index 0000000..ef39084
--- /dev/null
+++ b/mm/iob/iob_free_queue_qentry.c
@@ -0,0 +1,94 @@
+/****************************************************************************
+ * mm/iob/iob_free_queue_qentry.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership. The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+#include <assert.h>
+#include <nuttx/mm/iob.h>
+
+#include "iob.h"
+
+#if CONFIG_IOB_NCHAINS > 0
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#ifndef NULL
+# define NULL ((FAR void *)0)
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: iob_free_queue_qentry
+ *
+ * Description:
+ * Free an iob entire queue of I/O buffer chains.
+ *
+ ****************************************************************************/
+
+void iob_free_queue_qentry(FAR struct iob_s *iob,
+ FAR struct iob_queue_s *iobq,
+ enum iob_user_e producerid)
+{
+ FAR struct iob_qentry_s *prev = NULL;
+ FAR struct iob_qentry_s *qentry;
+
+ for (qentry = iobq->qh_head; qentry != NULL;
+ prev = qentry, qentry = qentry->qe_flink)
+ {
+ /* Find head of the I/O buffer chain */
+
+ if (qentry->qe_head == iob)
+ {
+ if (prev == NULL)
+ {
+ iobq->qh_head = qentry->qe_flink;
+ }
+ else
+ {
+ prev->qe_flink = qentry->qe_flink;
+ }
+
+ if (iobq->qh_tail == qentry)
+ {
+ iobq->qh_tail = prev;
+ }
+
+ /* Remove the queue container */
+
+ iob_free_qentry(qentry);
+
+ /* Free the I/O chain */
+
+ iob_free_chain(iob, producerid);
+
+ break;
+ }
+ }
+}
+
+#endif /* CONFIG_IOB_NCHAINS > 0 */
[incubator-nuttx] 01/02: Documentation/iob: update the function
prototype
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit e73883aba5569880a2a8f09192905e7dc10dca03
Author: chao.an <an...@xiaomi.com>
AuthorDate: Tue Jun 8 23:34:54 2021 +0800
Documentation/iob: update the function prototype
Signed-off-by: chao.an <an...@xiaomi.com>
---
Documentation/reference/os/iob.rst | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/Documentation/reference/os/iob.rst b/Documentation/reference/os/iob.rst
index c4d9e46..01e74d2 100644
--- a/Documentation/reference/os/iob.rst
+++ b/Documentation/reference/os/iob.rst
@@ -191,13 +191,15 @@ Public Function Prototypes
buffer at the head of the free list without waiting for a buffer
to become free.
-.. c:function:: FAR struct iob_s *iob_free(FAR struct iob_s *iob);
+.. c:function:: FAR struct iob_s *iob_free(FAR struct iob_s *iob, \
+ enum iob_user_e producerid);
Free the I/O buffer at the head of a buffer chain
returning it to the free list. The link to the next I/O buffer in
the chain is return.
-.. c:function:: void iob_free_chain(FAR struct iob_s *iob);
+.. c:function:: void iob_free_chain(FAR struct iob_s *iob, \
+ enum iob_user_e producerid);
Free an entire buffer chain, starting at the
beginning of the I/O buffer chain
@@ -231,7 +233,8 @@ Public Function Prototypes
:return: Returns a reference to the I/O buffer chain at
the head of the queue.
-.. c:function:: void iob_free_queue(FAR struct iob_queue_s *qhead);
+.. c:function:: void iob_free_queue(FAR struct iob_queue_s *qhead, \
+ enum iob_user_e producerid);
Free an entire queue of I/O buffer chains.
@@ -265,14 +268,15 @@ Public Function Prototypes
Concatenate iob_s chain iob2 to iob1.
-.. c:function:: FAR struct iob_s *iob_trimhead(FAR struct iob_s *iob, unsigned int trimlen)
+.. c:function:: FAR struct iob_s *iob_trimhead(FAR struct iob_s *iob, \
+ unsigned int trimlen, enum iob_user_e producerid)
Remove bytes from the beginning of an I/O chain.
Emptied I/O buffers are freed and, hence, the beginning of the
chain may change.
.. c:function:: FAR struct iob_s *iob_trimhead_queue(FAR struct iob_queue_s *qhead, \
- unsigned int trimlen);
+ unsigned int trimlen, enum iob_user_e producerid);
Remove bytes from the beginning of an I/O chain
at the head of the queue. Emptied I/O buffers are freed and,
@@ -285,19 +289,22 @@ Public Function Prototypes
:return: The new iob at the head of the queue is
returned.
-.. c:function:: FAR struct iob_s *iob_trimtail(FAR struct iob_s *iob, unsigned int trimlen);
+.. c:function:: FAR struct iob_s *iob_trimtail(FAR struct iob_s *iob, \
+ unsigned int trimlen, enum iob_user_e producerid);
Remove bytes from the end of an I/O chain.
Emptied I/O buffers are freed NULL will be returned in the special
case where the entry I/O buffer chain is freed.
-.. c:function:: FAR struct iob_s *iob_pack(FAR struct iob_s *iob);
+.. c:function:: FAR struct iob_s *iob_pack(FAR struct iob_s *iob, \
+ enum iob_user_e producerid);
Pack all data in the I/O buffer chain so that the
data offset is zero and all but the final buffer in the chain are
filled. Any emptied buffers at the end of the chain are freed.
-.. c:function:: int iob_contig(FAR struct iob_s *iob, unsigned int len);
+.. c:function:: int iob_contig(FAR struct iob_s *iob, unsigned int len, \
+ enum iob_user_e producerid);
Ensure that there is ``len`` bytes of contiguous
space at the beginning of the I/O buffer chain starting at