Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
804dfaf0
Commit
804dfaf0
authored
Nov 05, 2018
by
Matthew Wilcox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XArray: Fix Documentation
Minor fixes. Signed-off-by:
Matthew Wilcox
<
willy@infradead.org
>
parent
d9c48043
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
Documentation/core-api/xarray.rst
Documentation/core-api/xarray.rst
+5
-1
include/linux/xarray.h
include/linux/xarray.h
+2
-2
lib/xarray.c
lib/xarray.c
+5
-5
No files found.
Documentation/core-api/xarray.rst
View file @
804dfaf0
...
@@ -74,7 +74,8 @@ using :c:func:`xa_load`. xa_store will overwrite any entry with the
...
@@ -74,7 +74,8 @@ using :c:func:`xa_load`. xa_store will overwrite any entry with the
new entry and return the previous entry stored at that index. You can
new entry and return the previous entry stored at that index. You can
use :c:func:`xa_erase` instead of calling :c:func:`xa_store` with a
use :c:func:`xa_erase` instead of calling :c:func:`xa_store` with a
``NULL`` entry. There is no difference between an entry that has never
``NULL`` entry. There is no difference between an entry that has never
been stored to and one that has most recently had ``NULL`` stored to it.
been stored to, one that has been erased and one that has most recently
had ``NULL`` stored to it.
You can conditionally replace an entry at an index by using
You can conditionally replace an entry at an index by using
:c:func:`xa_cmpxchg`. Like :c:func:`cmpxchg`, it will only succeed if
:c:func:`xa_cmpxchg`. Like :c:func:`cmpxchg`, it will only succeed if
...
@@ -114,6 +115,9 @@ unused entry. If another user has stored to the entry in the meantime,
...
@@ -114,6 +115,9 @@ unused entry. If another user has stored to the entry in the meantime,
:c:func:`xa_release` will do nothing; if instead you want the entry to
:c:func:`xa_release` will do nothing; if instead you want the entry to
become ``NULL``, you should use :c:func:`xa_erase`.
become ``NULL``, you should use :c:func:`xa_erase`.
If all entries in the array are ``NULL``, the :c:func:`xa_empty` function
will return ``true``.
Finally, you can remove all entries from an XArray by calling
Finally, you can remove all entries from an XArray by calling
:c:func:`xa_destroy`. If the XArray entries are pointers, you may wish
:c:func:`xa_destroy`. If the XArray entries are pointers, you may wish
to free the entries first. You can do this by iterating over all present
to free the entries first. You can do this by iterating over all present
...
...
include/linux/xarray.h
View file @
804dfaf0
...
@@ -487,7 +487,7 @@ static inline void *xa_store_irq(struct xarray *xa, unsigned long index,
...
@@ -487,7 +487,7 @@ static inline void *xa_store_irq(struct xarray *xa, unsigned long index,
* the third argument. The XArray does not need to allocate memory, so
* the third argument. The XArray does not need to allocate memory, so
* the user does not need to provide GFP flags.
* the user does not need to provide GFP flags.
*
*
* Context:
Process
context. Takes and releases the xa_lock while
* Context:
Any
context. Takes and releases the xa_lock while
* disabling softirqs.
* disabling softirqs.
* Return: The entry which used to be at this index.
* Return: The entry which used to be at this index.
*/
*/
...
@@ -622,7 +622,7 @@ static inline int xa_alloc(struct xarray *xa, u32 *id, u32 max, void *entry,
...
@@ -622,7 +622,7 @@ static inline int xa_alloc(struct xarray *xa, u32 *id, u32 max, void *entry,
* Updates the @id pointer with the index, then stores the entry at that
* Updates the @id pointer with the index, then stores the entry at that
* index. A concurrent lookup will not see an uninitialised @id.
* index. A concurrent lookup will not see an uninitialised @id.
*
*
* Context:
Process
context. Takes and releases the xa_lock while
* Context:
Any
context. Takes and releases the xa_lock while
* disabling softirqs. May sleep if the @gfp flags permit.
* disabling softirqs. May sleep if the @gfp flags permit.
* Return: 0 on success, -ENOMEM if memory allocation fails or -ENOSPC if
* Return: 0 on success, -ENOMEM if memory allocation fails or -ENOSPC if
* there is no more space in the XArray.
* there is no more space in the XArray.
...
...
lib/xarray.c
View file @
804dfaf0
...
@@ -610,8 +610,8 @@ static int xas_expand(struct xa_state *xas, void *head)
...
@@ -610,8 +610,8 @@ static int xas_expand(struct xa_state *xas, void *head)
* (see the xa_cmpxchg() implementation for an example).
* (see the xa_cmpxchg() implementation for an example).
*
*
* Return: If the slot already existed, returns the contents of this slot.
* Return: If the slot already existed, returns the contents of this slot.
* If the slot was newly created, returns NULL. If it failed to create the
* If the slot was newly created, returns
%
NULL. If it failed to create the
* slot, returns NULL and indicates the error in @xas.
* slot, returns
%
NULL and indicates the error in @xas.
*/
*/
static
void
*
xas_create
(
struct
xa_state
*
xas
)
static
void
*
xas_create
(
struct
xa_state
*
xas
)
{
{
...
@@ -1640,7 +1640,7 @@ EXPORT_SYMBOL(__xa_alloc);
...
@@ -1640,7 +1640,7 @@ EXPORT_SYMBOL(__xa_alloc);
* @index: Index of entry.
* @index: Index of entry.
* @mark: Mark number.
* @mark: Mark number.
*
*
* Attempting to set a mark on a NULL entry does not succeed.
* Attempting to set a mark on a
%
NULL entry does not succeed.
*
*
* Context: Any context. Expects xa_lock to be held on entry.
* Context: Any context. Expects xa_lock to be held on entry.
*/
*/
...
@@ -1710,7 +1710,7 @@ EXPORT_SYMBOL(xa_get_mark);
...
@@ -1710,7 +1710,7 @@ EXPORT_SYMBOL(xa_get_mark);
* @index: Index of entry.
* @index: Index of entry.
* @mark: Mark number.
* @mark: Mark number.
*
*
* Attempting to set a mark on a NULL entry does not succeed.
* Attempting to set a mark on a
%
NULL entry does not succeed.
*
*
* Context: Process context. Takes and releases the xa_lock.
* Context: Process context. Takes and releases the xa_lock.
*/
*/
...
@@ -1879,7 +1879,7 @@ static unsigned int xas_extract_marked(struct xa_state *xas, void **dst,
...
@@ -1879,7 +1879,7 @@ static unsigned int xas_extract_marked(struct xa_state *xas, void **dst,
*
*
* The @filter may be an XArray mark value, in which case entries which are
* The @filter may be an XArray mark value, in which case entries which are
* marked with that mark will be copied. It may also be %XA_PRESENT, in
* marked with that mark will be copied. It may also be %XA_PRESENT, in
* which case all entries which are not NULL will be copied.
* which case all entries which are not
%
NULL will be copied.
*
*
* The entries returned may not represent a snapshot of the XArray at a
* The entries returned may not represent a snapshot of the XArray at a
* moment in time. For example, if another thread stores to index 5, then
* moment in time. For example, if another thread stores to index 5, then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment