seq_file.c (95d465fd750897ab32462a6702fbfe1b122cbbc0) seq_file.c (15ad7cdcfd76450d4beebc789ec646664238184d)
1/*
2 * linux/fs/seq_file.c
3 *
4 * helper functions for making synthetic files from sequences of records.
5 * initial implementation -- AV, Oct 2001.
6 */
7
8#include <linux/fs.h>

--- 12 unchanged lines hidden (view full) ---

21 * seq_open() sets @file, associating it with a sequence described
22 * by @op. @op->start() sets the iterator up and returns the first
23 * element of sequence. @op->stop() shuts it down. @op->next()
24 * returns the next element of sequence. @op->show() prints element
25 * into the buffer. In case of error ->start() and ->next() return
26 * ERR_PTR(error). In the end of sequence they return %NULL. ->show()
27 * returns 0 in case of success and negative number in case of error.
28 */
1/*
2 * linux/fs/seq_file.c
3 *
4 * helper functions for making synthetic files from sequences of records.
5 * initial implementation -- AV, Oct 2001.
6 */
7
8#include <linux/fs.h>

--- 12 unchanged lines hidden (view full) ---

21 * seq_open() sets @file, associating it with a sequence described
22 * by @op. @op->start() sets the iterator up and returns the first
23 * element of sequence. @op->stop() shuts it down. @op->next()
24 * returns the next element of sequence. @op->show() prints element
25 * into the buffer. In case of error ->start() and ->next() return
26 * ERR_PTR(error). In the end of sequence they return %NULL. ->show()
27 * returns 0 in case of success and negative number in case of error.
28 */
29int seq_open(struct file *file, struct seq_operations *op)
29int seq_open(struct file *file, const struct seq_operations *op)
30{
31 struct seq_file *p = file->private_data;
32
33 if (!p) {
34 p = kmalloc(sizeof(*p), GFP_KERNEL);
35 if (!p)
36 return -ENOMEM;
37 file->private_data = p;

--- 365 unchanged lines hidden (view full) ---

403 kfree(op);
404 }
405 return res;
406}
407EXPORT_SYMBOL(single_open);
408
409int single_release(struct inode *inode, struct file *file)
410{
30{
31 struct seq_file *p = file->private_data;
32
33 if (!p) {
34 p = kmalloc(sizeof(*p), GFP_KERNEL);
35 if (!p)
36 return -ENOMEM;
37 file->private_data = p;

--- 365 unchanged lines hidden (view full) ---

403 kfree(op);
404 }
405 return res;
406}
407EXPORT_SYMBOL(single_open);
408
409int single_release(struct inode *inode, struct file *file)
410{
411 struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
411 const struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
412 int res = seq_release(inode, file);
413 kfree(op);
414 return res;
415}
416EXPORT_SYMBOL(single_release);
417
418int seq_release_private(struct inode *inode, struct file *file)
419{

--- 30 unchanged lines hidden ---
412 int res = seq_release(inode, file);
413 kfree(op);
414 return res;
415}
416EXPORT_SYMBOL(single_release);
417
418int seq_release_private(struct inode *inode, struct file *file)
419{

--- 30 unchanged lines hidden ---