in the kernel source code allocates an inode when creating a socket, but it’s not used afterwards. I’m not sure why it’s allocated without being used. It’s not simply because sockets are treated as files, as sockets have a file structure as a member. Is there a reason for this allocation, or can we identify where the inode is used in the kernel’s socket API?
And I’m analyzing the socket API in kernel code. Are there any good resources or courses available?
struct socket sock_alloc(void)
{
struct inode *inode;
struct socket *sock;
inode = new_inode_pseudo(sock_mnt->mnt_sb);
sock = SOCKET_I(inode);
...
return sock;
}