[[toc]]
from_timer(var,callback_timer,timer_fieldname)
在include\linux\kernel.h
中有说明。
1 2
| #define from_timer(var, callback_timer, timer_fieldname) \ container_of(callback_timer, typeof(*var), timer_fieldname)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#define container_of(ptr, type, member) ({ \ void *__mptr = (void *)(ptr); \ BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ !__same_type(*(ptr), void), \ "pointer type mismatch in container_of()"); \ ((type *)(__mptr - offsetof(type, member))); })
|