Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[firefly-linux-kernel-4.4.55.git] / fs / seq_file.c
index 555b9ac04c25be9ac5354bea2810ef79290ab92e..49194a4e6b91ba9dcd22c3aa7fe81f794aca4413 100644 (file)
@@ -26,7 +26,7 @@
  *     ERR_PTR(error).  In the end of sequence they return %NULL. ->show()
  *     returns 0 in case of success and negative number in case of error.
  */
-int seq_open(struct file *file, struct seq_operations *op)
+int seq_open(struct file *file, const struct seq_operations *op)
 {
        struct seq_file *p = file->private_data;
 
@@ -269,7 +269,7 @@ EXPORT_SYMBOL(seq_lseek);
 /**
  *     seq_release -   free the structures associated with sequential file.
  *     @file: file in question
- *     @inode: file->f_dentry->d_inode
+ *     @inode: file->f_path.dentry->d_inode
  *
  *     Frees the structures associated with sequential file; can be used
  *     as ->f_op->release() if you don't have private data to destroy.
@@ -408,7 +408,7 @@ EXPORT_SYMBOL(single_open);
 
 int single_release(struct inode *inode, struct file *file)
 {
-       struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
+       const struct seq_operations *op = ((struct seq_file *)file->private_data)->op;
        int res = seq_release(inode, file);
        kfree(op);
        return res;
@@ -447,3 +447,37 @@ int seq_puts(struct seq_file *m, const char *s)
        return -1;
 }
 EXPORT_SYMBOL(seq_puts);
+
+struct list_head *seq_list_start(struct list_head *head, loff_t pos)
+{
+       struct list_head *lh;
+
+       list_for_each(lh, head)
+               if (pos-- == 0)
+                       return lh;
+
+       return NULL;
+}
+
+EXPORT_SYMBOL(seq_list_start);
+
+struct list_head *seq_list_start_head(struct list_head *head, loff_t pos)
+{
+       if (!pos)
+               return head;
+
+       return seq_list_start(head, pos - 1);
+}
+
+EXPORT_SYMBOL(seq_list_start_head);
+
+struct list_head *seq_list_next(void *v, struct list_head *head, loff_t *ppos)
+{
+       struct list_head *lh;
+
+       lh = ((struct list_head *)v)->next;
+       ++*ppos;
+       return lh == head ? NULL : lh;
+}
+
+EXPORT_SYMBOL(seq_list_next);