Created
January 20, 2013 14:00
-
-
Save scottt/4578849 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MyCustomType { | |
int misc; | |
struct ExistingType m0; | |
void *data; | |
}; | |
void my_callback(struct ExistingType *e) | |
{ | |
struct MyCustomType *p = containter_of(e, struct MyCustomType, m0); | |
/* access p->data ... */ | |
} | |
/* See http://www.kroah.com/log/linux/container_of.html | |
for how the container_of() macro is implemented. */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment