Exemplo n.º 1
0
static int gatorfs_fill_super(struct super_block *sb, void *data, int silent)
{
	struct inode *root_inode;
	struct dentry *root_dentry;

	sb->s_blocksize = PAGE_CACHE_SIZE;
	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
	sb->s_magic = gatorfs_MAGIC;
	sb->s_op = &s_ops;
	sb->s_time_gran = 1;

	root_inode = gatorfs_get_inode(sb, S_IFDIR | 0755);
	if (!root_inode)
		return -ENOMEM;
	root_inode->i_op = &simple_dir_inode_operations;
	root_inode->i_fop = &simple_dir_operations;

	root_dentry = d_make_root(root_inode);

	if (!root_dentry) {
		return -ENOMEM;
	}

	sb->s_root = root_dentry;

	gator_op_create_files(sb, root_dentry);

	return 0;
}
Exemplo n.º 2
0
static int gatorfs_fill_super(struct super_block *sb, void *data, int silent)
{
	struct inode *root_inode;
	struct dentry *root_dentry;

	sb->s_blocksize = PAGE_CACHE_SIZE;
	sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
	sb->s_magic = met_gatorfs_MAGIC;
	sb->s_op = &s_ops;
	sb->s_time_gran = 1;

	root_inode = gatorfs_get_inode(sb, S_IFDIR | 0755);
	if (!root_inode)
		return -ENOMEM;
	root_inode->i_op = &simple_dir_inode_operations;
	root_inode->i_fop = &simple_dir_operations;

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
	root_dentry = d_alloc_root(root_inode);
#else
	root_dentry = d_make_root(root_inode);
#endif

	if (!root_dentry) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
		iput(root_inode);
#endif
		return -ENOMEM;
	}

	sb->s_root = root_dentry;

	gator_op_create_files(sb, root_dentry);

	return 0;
}