235 /**
236 * container_of - cast a member of a structure out to the containing structure
237 *
238 * @ptr: the pointer to the member.
239 * @type: the type of the container struct this is embedded in.
240 * @member: the name of the member within the struct.
241 *
242 */
243 #define container_of( ptr, type, member) ({ \
244 const typeof( (( type *)0)->member ) *__mptr = (ptr); \
245 ( type *)( (char *)__mptr - offsetof(type,member) );})
Can someone please explain how the above macro works and in what situations it is used ? Thanks.
rgds
Arun