public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: Petr Vorel <pvorel@suse.cz>
Cc: linux-nfs@vger.kernel.org, Tom Haynes <loghyr@hammerspace.com>,
	"Yong Sun (Sero)" <yosun@suse.com>
Subject: Re: [PATCH pynfs 2/2] 4.1 server: Compare with int variable instead of string
Date: Fri, 21 May 2021 14:07:37 -0400	[thread overview]
Message-ID: <YKf26VaDUVmsr2bx@pick.fieldses.org> (raw)
In-Reply-To: <20210521054633.3170-2-pvorel@suse.cz>

Both applied, thanks.--b.

On Fri, May 21, 2021 at 07:46:33AM +0200, Petr Vorel wrote:
> Similarly to previous commit prefer using int variables
> (e.g. NFS4_OK) than string literals (e.g. "NFS4_OK"),
> which don't detect typos.
> 
> This requires to change status parameter of show_op()
> from string to int.
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  nfs4.1/nfs4server.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/nfs4.1/nfs4server.py b/nfs4.1/nfs4server.py
> index 6f7d10c..9422481 100755
> --- a/nfs4.1/nfs4server.py
> +++ b/nfs4.1/nfs4server.py
> @@ -515,8 +515,8 @@ class SummaryOutput:
>  
>          summary_line = "  %s" % ', '.join(opnames)
>  
> -        if status != "NFS4_OK" and status != "NFS3_OK":
> -            summary_line += " -> %s" % (status,)
> +        if status != NFS4_OK and status != NFS3_OK:
> +            summary_line += " -> %s" % nfsstat4[status]
>  
>          print_summary_line = True
>          if summary_line != self._last or role != self._last_role:
> @@ -850,7 +850,7 @@ class NFS4Server(rpc.Server):
>          log_41.info("Replying.  Status %s (%d)" % (nfsstat4[status], status))
>          client_addr = '%s:%s' % cred.connection._s.getpeername()[:2]
>          self.summary.show_op('handle v4.1 %s' % client_addr,
> -                             opnames, nfsstat4[status])
> +                             opnames, status)
>          return env
>  
>      def delete_session(self, session, sessionid):
> -- 
> 2.31.1
> 


      reply	other threads:[~2021-05-21 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-21  5:46 [PATCH pynfs 1/2] st_flex: Fix comparison operator, compare int Petr Vorel
2021-05-21  5:46 ` [PATCH pynfs 2/2] 4.1 server: Compare with int variable instead of string Petr Vorel
2021-05-21 18:07   ` J. Bruce Fields [this message]

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=YKf26VaDUVmsr2bx@pick.fieldses.org \
    --to=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=loghyr@hammerspace.com \
    --cc=pvorel@suse.cz \
    --cc=yosun@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox