aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-03-22 12:26:35 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-31 16:03:15 -0400
commit22a71c3055cfcc277b7a8422d4ff256944370c24 (patch)
tree8b0b9c4da7329866b5f006ac9e6954a90e10d098 /fs
parenta2e1859adb3b05fa99f87a67df9ef2a4b7b04a13 (diff)
pstore: trim pstore_get_inode()
move mode-dependent parts to callers, kill unused arguments Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/pstore/inode.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index f37c32b94525..50952c9bd06c 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -105,26 +105,12 @@ static const struct inode_operations pstore_dir_inode_operations = {
105 .unlink = pstore_unlink, 105 .unlink = pstore_unlink,
106}; 106};
107 107
108static struct inode *pstore_get_inode(struct super_block *sb, 108static struct inode *pstore_get_inode(struct super_block *sb)
109 const struct inode *dir, int mode, dev_t dev)
110{ 109{
111 struct inode *inode = new_inode(sb); 110 struct inode *inode = new_inode(sb);
112
113 if (inode) { 111 if (inode) {
114 inode->i_ino = get_next_ino(); 112 inode->i_ino = get_next_ino();
115 inode->i_uid = inode->i_gid = 0;
116 inode->i_mode = mode;
117 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 113 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
118 switch (mode & S_IFMT) {
119 case S_IFREG:
120 inode->i_fop = &pstore_file_operations;
121 break;
122 case S_IFDIR:
123 inode->i_op = &pstore_dir_inode_operations;
124 inode->i_fop = &simple_dir_operations;
125 inc_nlink(inode);
126 break;
127 }
128 } 114 }
129 return inode; 115 return inode;
130} 116}
@@ -216,9 +202,11 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id,
216 return rc; 202 return rc;
217 203
218 rc = -ENOMEM; 204 rc = -ENOMEM;
219 inode = pstore_get_inode(pstore_sb, root->d_inode, S_IFREG | 0444, 0); 205 inode = pstore_get_inode(pstore_sb);
220 if (!inode) 206 if (!inode)
221 goto fail; 207 goto fail;
208 inode->i_mode = S_IFREG | 0444;
209 inode->i_fop = &pstore_file_operations;
222 private = kmalloc(sizeof *private + size, GFP_KERNEL); 210 private = kmalloc(sizeof *private + size, GFP_KERNEL);
223 if (!private) 211 if (!private)
224 goto fail_alloc; 212 goto fail_alloc;
@@ -293,10 +281,12 @@ int pstore_fill_super(struct super_block *sb, void *data, int silent)
293 281
294 parse_options(data); 282 parse_options(data);
295 283
296 inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0); 284 inode = pstore_get_inode(sb);
297 if (inode) { 285 if (inode) {
298 /* override ramfs "dir" options so we catch unlink(2) */ 286 inode->i_mode = S_IFDIR | 0755;
299 inode->i_op = &pstore_dir_inode_operations; 287 inode->i_op = &pstore_dir_inode_operations;
288 inode->i_fop = &simple_dir_operations;
289 inc_nlink(inode);
300 } 290 }
301 sb->s_root = d_make_root(inode); 291 sb->s_root = d_make_root(inode);
302 if (!sb->s_root) 292 if (!sb->s_root)