Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=259902ea951008bcbd31a49f667062ff8012ef55
Commit:     259902ea951008bcbd31a49f667062ff8012ef55
Parent:     b0765fb85782da9dca98482ebb1ae0d8c1a5e0f7
Author:     Pavel Emelianov <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:39:56 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:42 2007 -0700

    Make NFS client use seq_list_xxx helpers
    
    This includes /proc/fs/nfsfs/servers and /proc/fs/nfsfs/volumes entries.
    
    Both need to show the header and use the list_head.
    
    Signed-off-by: Pavel Emelianov <[EMAIL PROTECTED]>
    Acked-by: Trond Myklebust <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/nfs/client.c |   54 ++++++------------------------------------------------
 1 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index ccb4550..a49f9fe 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1206,23 +1206,9 @@ static int nfs_server_list_open(struct inode *inode, 
struct file *file)
  */
 static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos)
 {
-       struct list_head *_p;
-       loff_t pos = *_pos;
-
        /* lock the list against modification */
        spin_lock(&nfs_client_lock);
-
-       /* allow for the header line */
-       if (!pos)
-               return SEQ_START_TOKEN;
-       pos--;
-
-       /* find the n'th element in the list */
-       list_for_each(_p, &nfs_client_list)
-               if (!pos--)
-                       break;
-
-       return _p != &nfs_client_list ? _p : NULL;
+       return seq_list_start_head(&nfs_client_list, *_pos);
 }
 
 /*
@@ -1230,14 +1216,7 @@ static void *nfs_server_list_start(struct seq_file *m, 
loff_t *_pos)
  */
 static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos)
 {
-       struct list_head *_p;
-
-       (*pos)++;
-
-       _p = v;
-       _p = (v == SEQ_START_TOKEN) ? nfs_client_list.next : _p->next;
-
-       return _p != &nfs_client_list ? _p : NULL;
+       return seq_list_next(v, &nfs_client_list, pos);
 }
 
 /*
@@ -1256,7 +1235,7 @@ static int nfs_server_list_show(struct seq_file *m, void 
*v)
        struct nfs_client *clp;
 
        /* display header on line 1 */
-       if (v == SEQ_START_TOKEN) {
+       if (v == &nfs_client_list) {
                seq_puts(m, "NV SERVER   PORT USE HOSTNAME\n");
                return 0;
        }
@@ -1297,23 +1276,9 @@ static int nfs_volume_list_open(struct inode *inode, 
struct file *file)
  */
 static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos)
 {
-       struct list_head *_p;
-       loff_t pos = *_pos;
-
        /* lock the list against modification */
        spin_lock(&nfs_client_lock);
-
-       /* allow for the header line */
-       if (!pos)
-               return SEQ_START_TOKEN;
-       pos--;
-
-       /* find the n'th element in the list */
-       list_for_each(_p, &nfs_volume_list)
-               if (!pos--)
-                       break;
-
-       return _p != &nfs_volume_list ? _p : NULL;
+       return seq_list_start_head(&nfs_volume_list, *_pos);
 }
 
 /*
@@ -1321,14 +1286,7 @@ static void *nfs_volume_list_start(struct seq_file *m, 
loff_t *_pos)
  */
 static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos)
 {
-       struct list_head *_p;
-
-       (*pos)++;
-
-       _p = v;
-       _p = (v == SEQ_START_TOKEN) ? nfs_volume_list.next : _p->next;
-
-       return _p != &nfs_volume_list ? _p : NULL;
+       return seq_list_next(v, &nfs_volume_list, pos);
 }
 
 /*
@@ -1349,7 +1307,7 @@ static int nfs_volume_list_show(struct seq_file *m, void 
*v)
        char dev[8], fsid[17];
 
        /* display header on line 1 */
-       if (v == SEQ_START_TOKEN) {
+       if (v == &nfs_volume_list) {
                seq_puts(m, "NV SERVER   PORT DEV     FSID\n");
                return 0;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to