|
@@ -599,6 +599,24 @@ int single_open(struct file *file, int (*show)(struct seq_file *, void *),
|
|
|
}
|
|
|
EXPORT_SYMBOL(single_open);
|
|
|
|
|
|
+int single_open_size(struct file *file, int (*show)(struct seq_file *, void *),
|
|
|
+ void *data, size_t size)
|
|
|
+{
|
|
|
+ char *buf = kmalloc(size, GFP_KERNEL);
|
|
|
+ int ret;
|
|
|
+ if (!buf)
|
|
|
+ return -ENOMEM;
|
|
|
+ ret = single_open(file, show, data);
|
|
|
+ if (ret) {
|
|
|
+ kfree(buf);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ ((struct seq_file *)file->private_data)->buf = buf;
|
|
|
+ ((struct seq_file *)file->private_data)->size = size;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(single_open_size);
|
|
|
+
|
|
|
int single_release(struct inode *inode, struct file *file)
|
|
|
{
|
|
|
const struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
|