Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[pandora-kernel.git] / fs / seq_file.c
index bbb19be..ca71c11 100644 (file)
@@ -429,6 +429,39 @@ int seq_release_private(struct inode *inode, struct file *file)
 }
 EXPORT_SYMBOL(seq_release_private);
 
+void *__seq_open_private(struct file *f, const struct seq_operations *ops,
+               int psize)
+{
+       int rc;
+       void *private;
+       struct seq_file *seq;
+
+       private = kzalloc(psize, GFP_KERNEL);
+       if (private == NULL)
+               goto out;
+
+       rc = seq_open(f, ops);
+       if (rc < 0)
+               goto out_free;
+
+       seq = f->private_data;
+       seq->private = private;
+       return private;
+
+out_free:
+       kfree(private);
+out:
+       return NULL;
+}
+EXPORT_SYMBOL(__seq_open_private);
+
+int seq_open_private(struct file *filp, const struct seq_operations *ops,
+               int psize)
+{
+       return __seq_open_private(filp, ops, psize) ? 0 : -ENOMEM;
+}
+EXPORT_SYMBOL(seq_open_private);
+
 int seq_putc(struct seq_file *m, char c)
 {
        if (m->count < m->size) {