~ubuntu-branches/ubuntu/quantal/linux-lowlatency/quantal-proposed

« back to all changes in this revision

Viewing changes to fs/pstore/inode.c

  • Committer: Package Import Robot
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2012-06-21 09:16:38 UTC
  • Revision ID: package-import@ubuntu.com-20120621091638-gubhv4nox8xez1ct
Tags: 3.5.0-1.1
[ Andy Whitcroft]

* Rebuild lowlatency against Ubuntu-3.5.0-1.1
* All new configuration system to allow configuration deltas to be
  exposed via debian.lowlatency/config-delta

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        char    data[];
53
53
};
54
54
 
55
 
static int pstore_file_open(struct inode *inode, struct file *file)
56
 
{
57
 
        file->private_data = inode->i_private;
58
 
        return 0;
59
 
}
60
 
 
61
55
static ssize_t pstore_file_read(struct file *file, char __user *userbuf,
62
56
                                                size_t count, loff_t *ppos)
63
57
{
67
61
}
68
62
 
69
63
static const struct file_operations pstore_file_operations = {
70
 
        .open   = pstore_file_open,
 
64
        .open   = simple_open,
71
65
        .read   = pstore_file_read,
72
66
        .llseek = default_llseek,
73
67
};
80
74
{
81
75
        struct pstore_private *p = dentry->d_inode->i_private;
82
76
 
83
 
        p->psi->erase(p->type, p->id, p->psi);
 
77
        if (p->psi->erase)
 
78
                p->psi->erase(p->type, p->id, p->psi);
84
79
 
85
80
        return simple_unlink(dir, dentry);
86
81
}
90
85
        struct pstore_private   *p = inode->i_private;
91
86
        unsigned long           flags;
92
87
 
93
 
        end_writeback(inode);
 
88
        clear_inode(inode);
94
89
        if (p) {
95
90
                spin_lock_irqsave(&allpstore_lock, flags);
96
91
                list_del(&p->list);
104
99
        .unlink         = pstore_unlink,
105
100
};
106
101
 
107
 
static struct inode *pstore_get_inode(struct super_block *sb,
108
 
                                        const struct inode *dir, int mode, dev_t dev)
 
102
static struct inode *pstore_get_inode(struct super_block *sb)
109
103
{
110
104
        struct inode *inode = new_inode(sb);
111
 
 
112
105
        if (inode) {
113
106
                inode->i_ino = get_next_ino();
114
 
                inode->i_uid = inode->i_gid = 0;
115
 
                inode->i_mode = mode;
116
107
                inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
117
 
                switch (mode & S_IFMT) {
118
 
                case S_IFREG:
119
 
                        inode->i_fop = &pstore_file_operations;
120
 
                        break;
121
 
                case S_IFDIR:
122
 
                        inode->i_op = &pstore_dir_inode_operations;
123
 
                        inode->i_fop = &simple_dir_operations;
124
 
                        inc_nlink(inode);
125
 
                        break;
126
 
                }
127
108
        }
128
109
        return inode;
129
110
}
215
196
                return rc;
216
197
 
217
198
        rc = -ENOMEM;
218
 
        inode = pstore_get_inode(pstore_sb, root->d_inode, S_IFREG | 0444, 0);
 
199
        inode = pstore_get_inode(pstore_sb);
219
200
        if (!inode)
220
201
                goto fail;
 
202
        inode->i_mode = S_IFREG | 0444;
 
203
        inode->i_fop = &pstore_file_operations;
221
204
        private = kmalloc(sizeof *private + size, GFP_KERNEL);
222
205
        if (!private)
223
206
                goto fail_alloc;
277
260
 
278
261
int pstore_fill_super(struct super_block *sb, void *data, int silent)
279
262
{
280
 
        struct inode *inode = NULL;
281
 
        struct dentry *root;
282
 
        int err;
 
263
        struct inode *inode;
283
264
 
284
265
        save_mount_options(sb, data);
285
266
 
294
275
 
295
276
        parse_options(data);
296
277
 
297
 
        inode = pstore_get_inode(sb, NULL, S_IFDIR | 0755, 0);
298
 
        if (!inode) {
299
 
                err = -ENOMEM;
300
 
                goto fail;
301
 
        }
302
 
        /* override ramfs "dir" options so we catch unlink(2) */
303
 
        inode->i_op = &pstore_dir_inode_operations;
304
 
 
305
 
        root = d_alloc_root(inode);
306
 
        sb->s_root = root;
307
 
        if (!root) {
308
 
                err = -ENOMEM;
309
 
                goto fail;
310
 
        }
 
278
        inode = pstore_get_inode(sb);
 
279
        if (inode) {
 
280
                inode->i_mode = S_IFDIR | 0755;
 
281
                inode->i_op = &pstore_dir_inode_operations;
 
282
                inode->i_fop = &simple_dir_operations;
 
283
                inc_nlink(inode);
 
284
        }
 
285
        sb->s_root = d_make_root(inode);
 
286
        if (!sb->s_root)
 
287
                return -ENOMEM;
311
288
 
312
289
        pstore_get_records(0);
313
290
 
314
291
        return 0;
315
 
fail:
316
 
        iput(inode);
317
 
        return err;
318
292
}
319
293
 
320
294
static struct dentry *pstore_mount(struct file_system_type *fs_type,