All of lore.kernel.org
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Kenneth D'souza <kdsouza@redhat.com>
Cc: linux-nfs@vger.kernel.org, bfields@redhat.com, agaikwad@redhat.com
Subject: Re: [PATCH] nfsd4: Make "info" file json compatible.
Date: Wed, 6 May 2020 21:32:03 -0400	[thread overview]
Message-ID: <20200507013203.GD21307@fieldses.org> (raw)
In-Reply-To: <20200501062230.19693-1-kdsouza@redhat.com>

On Fri, May 01, 2020 at 11:52:30AM +0530, Kenneth D'souza wrote:
> Currently the output returned by client_info_show() is not
> pure json, fix it so user space can pass the file properly.

Gah, I said JSON, but the promise was that these files would be YAML,
which I believe is a superset of JSON.

I'd prefer not to make major backwards-incompatible changes.

--b.

> 
> Signed-off-by: Kenneth D'souza <kdsouza@redhat.com>
> Signed-off-by: Achilles Gaikwad <agaikwad@redhat.com>
> ---
>  fs/nfsd/nfs4state.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index c107caa56525..f2a14f95ffa6 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -2341,19 +2341,24 @@ static int client_info_show(struct seq_file *m, void *v)
>  	if (!clp)
>  		return -ENXIO;
>  	memcpy(&clid, &clp->cl_clientid, sizeof(clid));
> -	seq_printf(m, "clientid: 0x%llx\n", clid);
> -	seq_printf(m, "address: \"%pISpc\"\n", (struct sockaddr *)&clp->cl_addr);
> -	seq_printf(m, "name: ");
> +	seq_printf(m, "{\n");
> +	seq_printf(m, "\t\"clientid\": \"0x%llx\",\n", clid);
> +	seq_printf(m, "\t\"address\": \"%pISpc\",\n", (struct sockaddr *)&clp->cl_addr);
> +	seq_printf(m, "\t\"name\": ");
>  	seq_quote_mem(m, clp->cl_name.data, clp->cl_name.len);
> -	seq_printf(m, "\nminor version: %d\n", clp->cl_minorversion);
> +	seq_printf(m, ", ");
> +	seq_printf(m, "\n\t\"minor version\": %d,\n", clp->cl_minorversion);
>  	if (clp->cl_nii_domain.data) {
> -		seq_printf(m, "Implementation domain: ");
> +		seq_printf(m, "\t\"Implementation domain\": ");
>  		seq_quote_mem(m, clp->cl_nii_domain.data,
>  					clp->cl_nii_domain.len);
> -		seq_printf(m, "\nImplementation name: ");
> +		seq_printf(m, ", ");
> +		seq_printf(m, "\n\t\"Implementation name\": ");
>  		seq_quote_mem(m, clp->cl_nii_name.data, clp->cl_nii_name.len);
> -		seq_printf(m, "\nImplementation time: [%lld, %ld]\n",
> +		seq_printf(m, ", ");
> +		seq_printf(m, "\n\t\"Implementation time\": \"[%lld, %ld]\"\n",
>  			clp->cl_nii_time.tv_sec, clp->cl_nii_time.tv_nsec);
> +		seq_printf(m, "}\n");
>  	}
>  	drop_client(clp);
>  
> -- 
> 2.21.1

  reply	other threads:[~2020-05-07  1:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  6:22 [PATCH] nfsd4: Make "info" file json compatible Kenneth D'souza
2020-05-07  1:32 ` J. Bruce Fields [this message]
2020-05-07  2:30   ` Kenneth Dsouza

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507013203.GD21307@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=agaikwad@redhat.com \
    --cc=bfields@redhat.com \
    --cc=kdsouza@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.