Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6374

linux kernel socket source macro container_of

$
0
0

i was trying to understand how created is socket but i have ran into the problem which i really dont understand. This problem is the code below:

static inline struct socket *SOCKET_I(struct inode *inode){    return &container_of(inode, struct socket_alloc, vfs_inode)->socket; //why here is -> socket}

I see it's the container_of macro and it returns a pointer. It takes inode pointer as a parameter andsubtracts amount of vfs_inode bytes.

my question is :Why there is something like ->socket at the end of the macro and what does it do?


Viewing all articles
Browse latest Browse all 6374

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>