Click here to Skip to main content
15,889,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have met this question this days.there are 2 lines of a function.
i want to know what does the list_entry() do?
wether it gets the offset of ptr's member "score" or gets list's member "ptr"?
the list_head is a kind of data structures of the Linux system,and how to use list_head?
i'm a newbie...thx for your help...
:confused: :confused: :confused:
...
curinf = list_entry(cur,struct ptr, list[i]);
curinf->score[i] -= sub;
...

/*the definition of ptr*/
struct ptr {
    struct int *x;
    struct list_head head;
    struct list_head list[4];
    int len;
    short weight;
    unsigned double score[4];
};
Posted

1 solution

It simply fetches a value embedded in a Linux kernel list structure. To learn more about Linux kernel linked lists, I suggest reading this article[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900