mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
XArray: Permit storing 2-byte-aligned pointers
On m68k, statically allocated pointers may only be two-byte aligned. This clashes with the XArray's method for tagging internal pointers. Permit storing these pointers in single slots (ie not in multislots). Signed-off-by: Matthew Wilcox <willy@infradead.org>
This commit is contained in:
parent
4a31896c5b
commit
76b4e52995
3 changed files with 58 additions and 12 deletions
|
@ -176,7 +176,8 @@ static inline bool xa_is_internal(const void *entry)
|
|||
*/
|
||||
static inline bool xa_is_err(const void *entry)
|
||||
{
|
||||
return unlikely(xa_is_internal(entry));
|
||||
return unlikely(xa_is_internal(entry) &&
|
||||
(unsigned long)entry >= -((MAX_ERRNO << 2) + 2));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1039,8 +1040,8 @@ static inline bool xa_is_sibling(const void *entry)
|
|||
(entry < xa_mk_sibling(XA_CHUNK_SIZE - 1));
|
||||
}
|
||||
|
||||
#define XA_ZERO_ENTRY xa_mk_internal(256)
|
||||
#define XA_RETRY_ENTRY xa_mk_internal(257)
|
||||
#define XA_RETRY_ENTRY xa_mk_internal(256)
|
||||
#define XA_ZERO_ENTRY xa_mk_internal(257)
|
||||
|
||||
/**
|
||||
* xa_is_zero() - Is the entry a zero entry?
|
||||
|
@ -1064,6 +1065,17 @@ static inline bool xa_is_retry(const void *entry)
|
|||
return unlikely(entry == XA_RETRY_ENTRY);
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_is_advanced() - Is the entry only permitted for the advanced API?
|
||||
* @entry: Entry to be stored in the XArray.
|
||||
*
|
||||
* Return: %true if the entry cannot be stored by the normal API.
|
||||
*/
|
||||
static inline bool xa_is_advanced(const void *entry)
|
||||
{
|
||||
return xa_is_internal(entry) && (entry <= XA_RETRY_ENTRY);
|
||||
}
|
||||
|
||||
/**
|
||||
* typedef xa_update_node_t - A callback function from the XArray.
|
||||
* @node: The node which is being processed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue