mm/iob: add support of nonblock iob_clone
Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
parent
80fa70da4e
commit
d6d56c3372
@ -267,7 +267,8 @@ Public Function Prototypes
|
|||||||
buffer starting at ``offset`` in the I/O buffer, returning that
|
buffer starting at ``offset`` in the I/O buffer, returning that
|
||||||
actual number of bytes copied out.
|
actual number of bytes copied out.
|
||||||
|
|
||||||
.. c:function:: int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2, bool throttled)
|
.. c:function:: int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2, \
|
||||||
|
bool throttled, bool block);
|
||||||
|
|
||||||
Duplicate (and pack) the data in ``iob1`` in
|
Duplicate (and pack) the data in ``iob1`` in
|
||||||
``iob2``. ``iob2`` must be empty.
|
``iob2``. ``iob2`` must be empty.
|
||||||
|
@ -464,8 +464,8 @@ unsigned int iob_tailroom(FAR struct iob_s *iob);
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int iob_clone(FAR struct iob_s *iob1,
|
int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2,
|
||||||
FAR struct iob_s *iob2, bool throttled);
|
bool throttled, bool block);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: iob_concat
|
* Name: iob_concat
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2, bool throttled)
|
int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2,
|
||||||
|
bool throttled, bool block)
|
||||||
{
|
{
|
||||||
FAR uint8_t *src;
|
FAR uint8_t *src;
|
||||||
FAR uint8_t *dest;
|
FAR uint8_t *dest;
|
||||||
@ -145,7 +146,15 @@ int iob_clone(FAR struct iob_s *iob1, FAR struct iob_s *iob2, bool throttled)
|
|||||||
* destination I/O buffer chain.
|
* destination I/O buffer chain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (block)
|
||||||
|
{
|
||||||
next = iob_alloc(throttled);
|
next = iob_alloc(throttled);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next = iob_tryalloc(throttled);
|
||||||
|
}
|
||||||
|
|
||||||
if (!next)
|
if (!next)
|
||||||
{
|
{
|
||||||
ioberr("ERROR: Failed to allocate an I/O buffer\n");
|
ioberr("ERROR: Failed to allocate an I/O buffer\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user