Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298361
b: refs/heads/master
c: 22a71c3
h: refs/heads/master
i:
  298359: 713046a
v: v3
  • Loading branch information
Al Viro committed Mar 31, 2012
1 parent e93ee6f commit 92266e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a2e1859adb3b05fa99f87a67df9ef2a4b7b04a13
refs/heads/master: 22a71c3055cfcc277b7a8422d4ff256944370c24
26 changes: 8 additions & 18 deletions trunk/fs/pstore/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,12 @@ static const struct inode_operations pstore_dir_inode_operations = {
.unlink = pstore_unlink,
};

static struct inode *pstore_get_inode(struct super_block *sb,
const struct inode *dir, int mode, dev_t dev)
static struct inode *pstore_get_inode(struct super_block *sb)
{
struct inode *inode = new_inode(sb);

if (inode) {
inode->i_ino = get_next_ino();
inode->i_uid = inode->i_gid = 0;
inode->i_mode = mode;
inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
switch (mode & S_IFMT) {
case S_IFREG:
inode->i_fop = &pstore_file_operations;
break;
case S_IFDIR:
inode->i_op = &pstore_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
inc_nlink(inode);
break;
}
}
return inode;
}
Expand Down Expand Up @@ -216,9 +202,11 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id,
return rc;

rc = -ENOMEM;
inode = pstore_get_inode(pstore_sb, root->d_inode, S_IFREG | 0444, 0);
inode = pstore_get_inode(pstore_sb);
if (!inode)
goto fail;
inode->i_mode = S_IFREG | 0444;
inode->i_fop = &pstore_file_operations;
private = kmalloc(sizeof *private + size, GFP_KERNEL);
if (!private)
goto fail_alloc;
Expand Down Expand Up @@ -293,10 +281,12 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)

parse_options(data);

inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0);
inode = pstore_get_inode(sb);
if (inode) {
/* override ramfs "dir" options so we catch unlink(2) */
inode->i_mode = S_IFDIR | 0755;
inode->i_op = &pstore_dir_inode_operations;
inode->i_fop = &simple_dir_operations;
inc_nlink(inode);
}
sb->s_root = d_make_root(inode);
if (!sb->s_root)
Expand Down

0 comments on commit 92266e6

Please sign in to comment.