Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void *ptr = ((char*)l_p - (unsigned int)&((struct node_s*)0)->list);
- struct node_s{
- char a;
- char b;
- char c;
- char d;
- struct list_head list;
- };
- (unsigned int)&((struct node_s*)0)->list
- (struct node_s*)0
- ((struct node_s*)0)->list
- &((struct node_s*)0)->list;
- (unsigned int)&((struct node_s*)0)->list
- ((char*)l_p - (unsigned int)&((struct node_s*)0)->list)
- void *ptr = (char*)l_p - offsetof(struct node_s, list);
- void *ptr = container_of(l_p, struct node_s, list);
Add Comment
Please, Sign In to add comment