Home » Mailing lists » Devel » [PATCH 0/15] Make common helpers for seq_files that work with list_head-s (v2)
Re: [PATCH 12/15] Make NFS client use seq_list_xxx helpers [message #13085 is a reply to message #13060] |
Fri, 18 May 2007 17:42   |
Trond Myklebust
Messages: 24 Registered: July 2006
|
Junior Member |
|
|
On Fri, 2007-05-18 at 14:04 +0400, Pavel Emelianov wrote:
> 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 <xemul@openvz.org>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
>
> ---
>
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 50c6821..10355ec 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -1232,23 +1232,9 @@ static int nfs_server_list_open(struct i
> */
> 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);
> }
>
> /*
> @@ -1256,14 +1242,7 @@ static void *nfs_server_list_start(struc
> */
> 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);
> }
>
> /*
> @@ -1282,7 +1261,7 @@ static int nfs_server_list_show(struct s
> 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;
> }
> @@ -1323,23 +1302,9 @@ static int nfs_volume_list_open(struct i
> */
> 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);
> }
>
> /*
> @@ -1347,14 +1312,7 @@ static void *nfs_volume_list_start(struc
> */
> 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);
> }
>
> /*
> @@ -1375,7 +1333,7 @@ static int nfs_volume_list_show(struct s
> 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;
> }
>
|
|
|
 |
|
[PATCH 0/15] Make common helpers for seq_files that work with list_head-s (v2)
By: xemul on Fri, 18 May 2007 09:11
|
 |
|
[PATCH 1/15] The helper functions itselves
By: xemul on Fri, 18 May 2007 09:17
|
 |
|
Re: [PATCH 1/15] The helper functions itselves
|
 |
|
[PATCH 2/15] Make AFS use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:20
|
 |
|
[PATCH 3/15] Make ATM driver use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:23
|
 |
|
[PATCH 4/15] Make block layer /proc files use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:27
|
 |
|
[PATCH 5/15] Make crypto API use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:29
|
 |
|
Re: [PATCH 5/15] Make crypto API use seq_list_xxx helpers
|
 |
|
[PATCH 6/15] Make input layer use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:33
|
 |
|
[PATCH 7/15] Make ISDN CAPI use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:36
|
 |
|
Re: [PATCH 7/15] Make ISDN CAPI use seq_list_xxx helpers
|
 |
|
[PATCH 8/15] Make /proc/misc use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:39
|
 |
|
[PATCH 9/15] Make /proc/modules use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:41
|
 |
|
[PATCH 10/15] Make some network-related proc files use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:48
|
 |
|
Re: [PATCH 10/15] Make some network-related proc files use seq_list_xxx helpers
By: davem on Fri, 18 May 2007 10:24
|
 |
|
[PATCH 11/15] Make some netfilter-related proc files use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 09:55
|
 |
|
[PATCH 12/15] Make NFS client use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 10:00
|
 |
|
Re: [PATCH 12/15] Make NFS client use seq_list_xxx helpers
|
 |
|
[PATCH 13/15] Make /proc/tty/drivers use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 10:02
|
 |
|
[PATCH 14/15] Make /proc/slabinfo use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 10:06
|
 |
|
[PATCH 15/15] Make /proc/self/mounts(tats) use seq_list_xxx helpers
By: xemul on Fri, 18 May 2007 10:10
|
Goto Forum:
Current Time: Sat Sep 06 21:33:51 GMT 2025
Total time taken to generate the page: 0.08610 seconds
|