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?