Linked lists in Linux

Source: Internet
Author: User

NOTES: <<the Linux kernel primer>>

The list of links in Linux is often a circular doubly linked list. The complete code is stored in the same file include/linux/list.h.

1include/linux/list.h2 3 structList_head {4     structList_head *next,*prev;5 };6 7 #defineList_head_init (name) {& (name),& (name)}8 9 #defineList_head (name)Ten     structList_head name =list_head_init (name)//Create a table header based on the name of the linked list One  A #defineInit_list_head (PTR) do {\//) points the Prev and next pointers in the head node to the head node itself, and after the two macros are called, name points to an empty list: (the head node's next -(PTR)->next = (PTR);(p tr)->prev =(ptr); \//points to the table header element itself) -} while(0)

Linked lists in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.