#author("2025-10-24T16:38:45+09:00","default:guest","guest") #author("2025-10-24T16:51:14+09:00","default:guest","guest") *参照元 [#da6044a9] #backlinks *説明 [#j14f65cf] -パス: [[linux-5.15/include/linux/list.h]] -リストの要素を追加する。 --prevとnextの間にnewを追加する。 --prev - next --prev - new - next **引数 [#zdf78f94] -struct list_head *new --追加するリスト --追加する要素。 --[[linux-5.15/list_head()]] -struct list_head *prev --追加する位置の前の要素 --追加する位置の前の要素。 -struct list_head *next --追加する位置の後の要素 --追加する位置の後の要素。 **返り値 [#j293549d] -なし **参考 [#p2e5c1e0] *実装 [#sb225657] /* * Insert a new entry between two known consecutive entries. * * This is only for internal list manipulation where we know * the prev/next entries already! */ static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { if (!__list_add_valid(new, prev, next)) return; next->prev = new; new->next = next; new->prev = prev; WRITE_ONCE(prev->next, new); } -追加前 -- prev -(next)-> next -- prev <-(prev)- next -追加後 -- prev <-(prev)- new -(next)-> next -- prev -(next)-> new <-(prev)- next --[[linux-5.15/__list_add_valid()]] --[[linux-5.15/WRITE_ONCE()]] *コメント [#t46fd20d]