Some Ideas about list_entry ()

Source: Internet
Author: User
Some Ideas about list_entry ()-General Linux technology-Linux programming and kernel information. The following is a detailed description. In the past two days, I have been reading the content in linux/list. h. I feel that list_entry () has some advantages. However, it is troublesome to specify the struct type when passing parameters.

Therefore, I want to create a new linked list based on this idea, specifying that struct bclist_head adds a flag to indicate the type of peripheral structure, in addition, struct bclist_head is always placed at the position of the first element (only a simple forced type conversion is required to convert struct bclist_head and peripheral struct ). Defines the peripheral interface users can define the definition of macro and struct, within the maximum number range, as long as the registration can make each macro and struct one-to-one correspondence. In this way, you can add different types of struct at will. (There is no major change, but list_entry () can support different memory models ).
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.