6 * container_of - routine for upcasting
8 * It is often convenient to create code where the caller registers a pointer
9 * to a generic structure and a callback. The callback might know that the
10 * pointer points to within a larger structure, and container_of gives a
11 * convenient and fairly type-safe way of returning to the enclosing structure.
13 * This idiom is an alternative to providing a void * pointer for every
23 * static void my_timer_callback(struct timer *timer)
25 * struct info *info = container_of(timer, struct info, timer);
26 * printf("my_stuff is %u\n", info->my_stuff);
31 * struct info info = { .my_stuff = 1 };
33 * register_timer(&info.timer);
36 int main(int argc, char *argv[])
41 if (strcmp(argv[1], "depends") == 0) {
42 printf("ccan/check_type\n");