Commit 6996f39f authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] (3/9) more ->get_sb() stuff

More ->get_sb() patches: pipefs
parent d90464e1
...@@ -600,7 +600,7 @@ static struct super_operations pipefs_ops = { ...@@ -600,7 +600,7 @@ static struct super_operations pipefs_ops = {
statfs: pipefs_statfs, statfs: pipefs_statfs,
}; };
static struct super_block * pipefs_read_super(struct super_block *sb, void *data, int silent) static int pipefs_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct inode *root; struct inode *root;
...@@ -610,22 +610,32 @@ static struct super_block * pipefs_read_super(struct super_block *sb, void *data ...@@ -610,22 +610,32 @@ static struct super_block * pipefs_read_super(struct super_block *sb, void *data
sb->s_op = &pipefs_ops; sb->s_op = &pipefs_ops;
root = new_inode(sb); root = new_inode(sb);
if (!root) if (!root)
return NULL; return -ENOMEM;
root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
root->i_uid = root->i_gid = 0; root->i_uid = root->i_gid = 0;
root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
sb->s_root = d_alloc(NULL, &(const struct qstr) { "pipe:", 5, 0 }); sb->s_root = d_alloc(NULL, &(const struct qstr) { "pipe:", 5, 0 });
if (!sb->s_root) { if (!sb->s_root) {
iput(root); iput(root);
return NULL; return -ENOMEM;
} }
sb->s_root->d_sb = sb; sb->s_root->d_sb = sb;
sb->s_root->d_parent = sb->s_root; sb->s_root->d_parent = sb->s_root;
d_instantiate(sb->s_root, root); d_instantiate(sb->s_root, root);
return sb; return 0;
} }
static DECLARE_FSTYPE(pipe_fs_type, "pipefs", pipefs_read_super, FS_NOMOUNT); static struct super_block *pipefs_get_sb(struct file_system_type *fs_type,
int flags, char *dev_name, void *data)
{
return get_sb_nodev(fs_type, flags, data, pipefs_fill_super);
}
static struct file_system_type pipe_fs_type = {
name: "pipefs",
get_sb: pipefs_get_sb,
fs_flags: FS_NOMOUNT,
};
static int __init init_pipe_fs(void) static int __init init_pipe_fs(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment