linux - What does this piece of code in the kernel.h mean? -


the below code linux kernel:

/** 639  * container_of - cast member of structure out containing structure 640  * @ptr:    pointer member. 641  * @type:   type of container struct embedded in. 642  * @member: name of member within struct. 643  * 644  */ 645 #define container_of(ptr, type, member) ({          \ 646     const typeof( ((type *)0)->member ) *__mptr = (ptr);    \ 647     (type *)( (char *)__mptr - offsetof(type,member) );}) 648  

i fail understand @ line 646-648. know these 2 lines comments above it, dont understand code word word. can explain me this?

the intent given anonymous pointer, know pointer element of larger structure, calculates beginning address of larger structure.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -