Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: David Laight <David.Laight@aculab.com>
Cc: 'Sergey Senozhatsky' <sergey.senozhatsky.work@gmail.com>,
	Steve French <sfrench@samba.org>,
	"linux-cifs@vger.kernel.org" <linux-cifs@vger.kernel.org>,
	"samba-technical@lists.samba.org"
	<samba-technical@lists.samba.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: Re: [PATCH 2/2] cifs: don't use __constant_cpu_to_le32()
Date: Fri, 15 Mar 2019 23:29:38 +0900	[thread overview]
Message-ID: <20190315142938.GA32256@tigerII.localdomain> (raw)
In-Reply-To: <757dbafbdadb45f6a3de728ecfd05c5d@AcuMS.aculab.com>

On (03/15/19 12:31), David Laight wrote:
> From: Sergey Senozhatsky
> > 
> > cpu_to_le32() is capable enough to detect __builtin_constant_p()
> > and to use an appropriate compile time ___constant_swahb32()
> > function.
> > 
> > So we can use cpu_to_le32() instead of __constant_cpu_to_le32().
> 
> Unless any code tries to use them as case statement labels.

What is the problem?

For compile time constants cpu_to_le32() should do the same thing
as __constant_cpu_to_le32().

There seems a whole bunch of cpu_to_XX compile time constants which
are used in case statement labels

include/linux/sunrpc/xdr.h:#define      rpc_msg_accepted        cpu_to_be32(RPC_MSG_ACCEPTED)
include/linux/sunrpc/xdr.h:#define      rpc_success             cpu_to_be32(RPC_SUCCESS)
include/linux/sunrpc/xdr.h:#define      rpc_prog_unavail        cpu_to_be32(RPC_PROG_UNAVAIL)
include/linux/sunrpc/xdr.h:#define      rpc_prog_mismatch       cpu_to_be32(RPC_PROG_MISMATCH)
include/linux/sunrpc/xdr.h:#define      rpc_proc_unavail        cpu_to_be32(RPC_PROC_UNAVAIL)
include/linux/sunrpc/xdr.h:#define      rpc_garbage_args        cpu_to_be32(RPC_GARBAGE_ARGS)
include/linux/sunrpc/xdr.h:#define      rpc_system_err          cpu_to_be32(RPC_SYSTEM_ERR)
include/linux/sunrpc/xdr.h:#define      rpc_drop_reply          cpu_to_be32(RPC_DROP_REPLY)
include/linux/sunrpc/xdr.h:#define      rpc_mismatch            cpu_to_be32(RPC_MISMATCH)
include/linux/sunrpc/xdr.h:#define      rpc_auth_error          cpu_to_be32(RPC_AUTH_ERROR)
include/linux/sunrpc/xdr.h:#define      rpc_auth_ok             cpu_to_be32(RPC_AUTH_OK)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_badcred     cpu_to_be32(RPC_AUTH_BADCRED)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_rejectedcred cpu_to_be32(RPC_AUTH_REJECTEDCRED)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_badverf     cpu_to_be32(RPC_AUTH_BADVERF)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_rejectedverf cpu_to_be32(RPC_AUTH_REJECTEDVERF)
include/linux/sunrpc/xdr.h:#define      rpc_autherr_tooweak     cpu_to_be32(RPC_AUTH_TOOWEAK)


net/sunrpc/clnt.c

2479         switch (*p) {
2480         case rpc_success:
2481                 return 0;
2482         case rpc_prog_unavail:
2483                 trace_rpc__prog_unavail(task);
2484                 error = -EPFNOSUPPORT;
2485                 goto out_err;
2486         case rpc_prog_mismatch:
2487                 trace_rpc__prog_mismatch(task);
2488                 error = -EPROTONOSUPPORT;
2489                 goto out_err;
2490         case rpc_proc_unavail:
2491                 trace_rpc__proc_unavail(task);
2492                 error = -EOPNOTSUPP;
2493                 goto out_err;
2494         case rpc_garbage_args:
2495                 trace_rpc__garbage_args(task);
2496                 break;
2497         default:
2498                 trace_rpc__unparsable(task);
2499         }

	-ss

      reply	other threads:[~2019-03-15 14:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14  6:17 [PATCH 1/2] cifs: remove unused status severity defines Sergey Senozhatsky
2019-03-14  6:54 ` Steve French
2019-03-14  7:04   ` Steve French
2019-03-14  7:12     ` Sergey Senozhatsky
2019-03-14  7:19       ` Steve French
2019-03-14  7:39         ` Sergey Senozhatsky
2019-03-14  8:03           ` Steve French
2019-03-14  7:08   ` Sergey Senozhatsky
     [not found] ` <20190314061716.19892-2-sergey.senozhatsky@gmail.com>
2019-03-15 12:31   ` [PATCH 2/2] cifs: don't use __constant_cpu_to_le32() David Laight
2019-03-15 14:29     ` Sergey Senozhatsky [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=20190315142938.GA32256@tigerII.localdomain \
    --to=sergey.senozhatsky@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samba-technical@lists.samba.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sfrench@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox