[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190315142938.GA32256@tigerII.localdomain>
Date: Fri, 15 Mar 2019 23:29:38 +0900
From: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To: David Laight <David.Laight@...lab.com>
Cc: 'Sergey Senozhatsky' <sergey.senozhatsky.work@...il.com>,
Steve French <sfrench@...ba.org>,
"linux-cifs@...r.kernel.org" <linux-cifs@...r.kernel.org>,
"samba-technical@...ts.samba.org" <samba-technical@...ts.samba.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [PATCH 2/2] cifs: don't use __constant_cpu_to_le32()
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
Powered by blists - more mailing lists