A temp list head will be replaced to inode i_subdirs. Signed-off-by: Li Guifu <bluce....@aliyun.com> --- include/erofs/list.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/include/erofs/list.h b/include/erofs/list.h index 3572726..7238418 100644 --- a/include/erofs/list.h +++ b/include/erofs/list.h @@ -67,6 +67,22 @@ static inline int list_empty(struct list_head *head) return head->next == head; } +/** + * list_replace - replace old entry by new one + * @old : the element to be replaced + * @new : the new element to insert + * + * If @old was empty, it will be overwritten. + */ +static inline void list_replace(struct list_head *old, + struct list_head *new) +{ + new->next = old->next; + new->next->prev = new; + new->prev = old->prev; + new->prev->next = new; +} + #define list_entry(ptr, type, member) container_of(ptr, type, member) #define list_first_entry(ptr, type, member) \ -- 2.17.1