Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
The new APIs added are used behind the scenes by list_gen.h
to abstract away details on how lists and nodes work.
Name them with z_ prefix as they are not intended for use
by applications.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Singly-linked lists work in a specific way, but this will allow
slist semantics to be defined for any data structure that can store
a "next" pointer in any way at all, possibly something not even
a pointer value, but a table index.
The immediate need for this patch is to allow the easy definition
of an slist variant which stores flags in the low-order bits of the
node pointer.
The compiler does not need them, but the function prototypes have
been left in slist.h to make the header easier to understand by
the end user and not confuse Doxygen.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Based on the feedback, uses conventional spelling for "thread safe"
and also add notices more consistently.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
These headers provide an efficient, inline implementations of single-
and double- linked lists, and thus not threadsafe. They are intended
to be used as internal kernel APIs (and currently for example not
documented at https://www.zephyrproject.org/doc/). However, to avoid
issues when doing kernel programming (e.g. #4350), it makes sense
to explicitly, even verbosely, document these functions as not
threadsafe.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Using MPU enabled HW it was evident that a NULL access
(with offset) was happening in the TCP stack due to the
following message:
***** MPU FAULT *****
Executing thread ID (thread): 0x20009b0c
Faulting instruction address: 0x8034496
Data Access Violation
Address: 0x34
Fatal fault in essential thread! Spinning...
Turns out we are referencing a potentially de-referenced
NULL pointer in the SYS_SLIST_PEEK_NEXT_CONTAINER macro.
Let's avoid this by checking the container node for NULL.
Also fix dlist.h SYS_DLIST_PEEK_NEXT_CONTAINER with the same
issue.
Change-Id: I2e765b9af7bcaf8fb13f7c9b7e081f9e6d4928f2
Signed-off-by: Michael Scott <michael.scott@linaro.org>
sys_slist_merge_slist shall reinit the appended list not the original.
Change-Id: Iacd5244d0243b7ebdb110991574e9e1d265ced14
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This enables casting if necessary.
Change-Id: I69d537dd1082e1e5a05aa2cacdd503d3f6c1ab95
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds SYS_SLIST_PEEK_TAIL_CONTAINER macro to access the container
directly.
Change-Id: I740138a47936ebda1e0090628f4933e921f6a43b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
To be API-equivalent with doubly-linked lists.
Change-Id: I98b781f4c649e248abb04f660f686ad76d6b39de
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
While iterating on each node element it is much more common to try to
access the container struct which up until now have been done manually
using CONTAINER_OF macro, so this introduce CONTAINER variants that allow
to iterate directly with container pointer rather than the list node.
Change-Id: Ia24d9b88d5e2c43ffd476f565faf5bb523a9927b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.
Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.
Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file. Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.
Jira: ZEP-1457
Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Allow appending a list to another list. The list being appended can be
either a slist or the head and tail of a singly-linked list with the
same node format as the slist.
Change-Id: I14410d2b793e1d9f893ff4e7ce097bee4a93a4be
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
More straightforward than doing sys_slist_peek_head() followed by
sys_slist_remove().
Also add a version that does not check if the list is non-empty to be
used when the list is known bo be non-empty.
Change-Id: I8fd10e20e2c84c7d8972c9207f3d4917884808cb
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
sys_slist_insert can be used to insert a node in the middle of the list
which previously was not possible with sys_slist_append and
sys_slist_prepend.
Change-Id: Ib9e319469cd4911adf7ddf49c54c3f7390c4c953
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Doxygen complained about "Unsupported xml/html tag <user> found".
Make the correct indentation to signify a code block, since it is
indeed a code block. This gets rid of the warning.
Change-Id: I78ea7709f1d45b2ff48c86153151d4f71a41d1e3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The @file tag should follow by a file (or nothing for current file),
instead of file description. Fix it by separating the description.
Change-Id: I1944b164ebe420fbdc03fc65b314ac53493a5d2c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
As for double linked list provided through misc/dlist.h, this provides a
generic API for single linked list in misc/slist.h. It follows the same
naming rule as in dlist.h
Change-Id: I955bd16a201bc9987c29f5a9e3e3d8447682a71e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>