Kernel Linked Lists (list_splice)
Leandro M Barbosa
lbarbosa at linux.com
Wed Mar 25 17:41:11 EDT 2015
To clarify my doubt, it seems to me that it just sits there in memory
without it being referenced anymore, is that right?
On Wed, Mar 25, 2015 at 6:38 PM, Leandro M Barbosa <lbarbosa at linux.com> wrote:
> Hello all!
>
> I was reading the __list_splice () function code and I had a doubt. The code is:
>
> 274 static inline void __list_splice(const struct list_head *list,
> 275 struct list_head *prev,
> 276 struct list_head *next)
> 277 {
> 278 struct list_head *first = list->next;
> 279 struct list_head *last = list->prev;
> 280
> 281 first->prev = prev;
> 282 prev->next = first;
> 283
> 284 last->next = next;
> 285 next->prev = last;
> 286 }
>
> What happens with the *list head? As I understood, when you call
> list_splice (list_a, list_b, list_b->next), the code joins the two
> lists together such that the list_a is put before list_b. The code
> grabs list->next and list->prev but what about *list itself?
>
>
> --
> Leandro Moreira Barbosa
--
Leandro Moreira Barbosa
More information about the Kernelnewbies
mailing list