Linux General linked list instances and linuxlist instances

Source: Internet
Author: User

Linux General linked list instances and linuxlist instances
Linux/list. h

The linked list used in the Linux kernel is reusable without repeated wheel creation. it is easy to think of a linked list using the following method: struct list {strucu list * next, * prev; int priv_data ;}; data is stored in the node of the linked list and moved by next and prev to access the priv_data on each node. the problem is that the Code is almost reusable, and different data storage requires a variety of lists. in linux kernel, a linked list containing data outside the node can solve this problem. struct list_head {struct list_head * prev, * next;}; struct list_data {struct list_head head; int priv_data ;}; the list_data data structure only needs to contain a linked list structure list_head to use the features of the linked list.

Related Article

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.