linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] erofs-utils: add list_replace from linux kernel for dirs sorted later
@ 2021-05-05 14:26 Li Guifu via Linux-erofs
  2021-05-05 14:26 ` [PATCH v1 2/2] erofs-utils: introduce erofs_subdirs to one dir for sort Li Guifu via Linux-erofs
  0 siblings, 1 reply; 5+ messages in thread
From: Li Guifu via Linux-erofs @ 2021-05-05 14:26 UTC (permalink / raw)
  To: linux-erofs

A temp list head will be replaced to inode i_subdirs.

Signed-off-by: Li Guifu <bluce.lee@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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-10  1:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 14:26 [PATCH v1 1/2] erofs-utils: add list_replace from linux kernel for dirs sorted later Li Guifu via Linux-erofs
2021-05-05 14:26 ` [PATCH v1 2/2] erofs-utils: introduce erofs_subdirs to one dir for sort Li Guifu via Linux-erofs
2021-05-07  7:09   ` Gao Xiang
2021-05-09 14:30     ` Li GuiFu via Linux-erofs
2021-05-10  1:06       ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).