函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:include\linux\xarray.h Create Date:2022-07-27 06:43:52
首页 Copyright©Brick

1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
/**
 * xas_next() - Move state to next index.
 * @xas: XArray operation state.
 *
 * If the @xas was in an error state, it will remain in an error state
 * and this function will return %NULL.  If the @xas has never been walked,
 * it will have the effect of calling xas_load().  Otherwise one will be
 * added to the index and the state will be walked to the correct
 * location in the array for the next operation.
 *
 * If the iterator was referencing index %ULONG_MAX, this function wraps
 * around to 0.
 *
 * Return: The entry at the new index.  This may be %NULL or an internal
 * entry.
 */
static inline void *xas_next(struct xa_state *xas)
{
    struct xa_node *node = xas->xa_node;
 
    if (unlikely(xas_not_node(node) || node->shift ||
                xas->xa_offset == XA_CHUNK_MASK))
        return __xas_next(xas);
 
    xas->xa_index++;
    xas->xa_offset++;
    return xa_entry(xas->xa, node, xas->xa_offset);
}