日期:2014-05-16 浏览次数:20762 次
?
int server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
inode = new_inode(sock_mnt->mnt_sb);其中,sock_mnt为socket文件系统的根节点,是在内核初始化安装socket文件系统时赋值的,mnt_sb是该文件系统安装点的超级块对象的指针;
struct inode *new_inode(struct super_block *sb) { struct inode * inode; inode = alloc_inode(sb); …... return inode; }这里调用了alloc_inode函数分配inode结构(fs/Inode.c):
static struct inode *alloc_inode(struct super_block *sb) { struct inode *inode; if (sb->s_op->alloc_inode) inode = sb->s_op->alloc_inode(sb); else inode = (struct inode *) kmem_cache_alloc(inode_cachep, GFP_KERNEL); …... }