public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <akinobu.mita@gmail.com>
To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Cc: Akinobu Mita <akinobu.mita@gmail.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: [PATCH 21/29] net/sunrpc: rename random32() and net_random() to prandom_u32()
Date: Mon, 24 Dec 2012 11:14:08 +0900	[thread overview]
Message-ID: <1356315256-6572-22-git-send-email-akinobu.mita@gmail.com> (raw)
In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com>

Use more preferable function name which implies using a pseudo-random
number generator.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Cc: linux-nfs@vger.kernel.org
---
 net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
 net/sunrpc/cache.c                  | 2 +-
 net/sunrpc/xprt.c                   | 2 +-
 net/sunrpc/xprtsock.c               | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 107c452..daf301f 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -130,8 +130,8 @@ gss_krb5_make_confounder(char *p, u32 conflen)
 
 	/* initialize to random value */
 	if (i == 0) {
-		i = random32();
-		i = (i << 32) | random32();
+		i = prandom_u32();
+		i = (i << 32) | prandom_u32();
 	}
 
 	switch (conflen) {
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 9afa439..0f85674 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -629,7 +629,7 @@ static void cache_limit_defers(void)
 
 	/* Consider removing either the first or the last */
 	if (cache_defer_cnt > DFR_MAX) {
-		if (net_random() & 1)
+		if (prandom_u32() & 1)
 			discard = list_entry(cache_defer_list.next,
 					     struct cache_deferred_req, recent);
 		else
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index bd462a5..0b51154 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1109,7 +1109,7 @@ static inline __be32 xprt_alloc_xid(struct rpc_xprt *xprt)
 
 static inline void xprt_init_xid(struct rpc_xprt *xprt)
 {
-	xprt->xid = net_random();
+	xprt->xid = prandom_u32();
 }
 
 static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 68b0a81..3b126ae 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1654,7 +1654,7 @@ static void xs_udp_timer(struct rpc_task *task)
 static unsigned short xs_get_random_port(void)
 {
 	unsigned short range = xprt_max_resvport - xprt_min_resvport;
-	unsigned short rand = (unsigned short) net_random() % range;
+	unsigned short rand = (unsigned short) prandom_u32() % range;
 	return rand + xprt_min_resvport;
 }
 
-- 
1.7.11.7


  parent reply	other threads:[~2012-12-24  2:15 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-24  2:13 [PATCH 00/29] rename random32 and net_random to prandom Akinobu Mita
2012-12-24  2:13 ` [PATCH 01/29] raid6test: use prandom_bytes() Akinobu Mita
2012-12-24  2:13 ` [PATCH 02/29] uuid: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 03/29] x86: pageattr-test: remove srandom32 call Akinobu Mita
2012-12-24  2:13 ` [PATCH 04/29] x86: rename random32() to prandom_u32() Akinobu Mita
2012-12-24  2:13 ` [PATCH 05/29] lib/: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 06/29] mm/: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 07/29] kernel/: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 08/29] drbd: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 09/29] infiniband: rename random32() and net_random() " Akinobu Mita
2012-12-24  2:13 ` [PATCH 10/29] mmc: rename random32() " Akinobu Mita
2012-12-24  2:13 ` [PATCH 11/29] video/uvesafb: " Akinobu Mita
2012-12-24  2:13 ` [PATCH 12/29] xfs: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 13/29] ubifs: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 14/29] uwb: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 15/29] lguest: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 16/29] scsi: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 17/29] mtd: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 18/29] drivers/net: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 19/29] batman-adv: fix random jitter calculation Akinobu Mita
2012-12-25 11:26   ` Antonio Quartulli
2012-12-25 21:35     ` Akinobu Mita
2012-12-25 21:37       ` David Miller
2012-12-24  2:14 ` [PATCH 20/29] batman-adv: rename random32() to prandom_u32() Akinobu Mita
2012-12-25 11:30   ` Antonio Quartulli
2013-01-02 11:52     ` [B.A.T.M.A.N.] " Marek Lindner
2012-12-24  2:14 ` Akinobu Mita [this message]
2012-12-24  2:14 ` [PATCH 22/29] net/sched: rename random32() and net_random() " Akinobu Mita
2012-12-24  2:14 ` [PATCH 23/29] net/ipv4: rename " Akinobu Mita
2012-12-24  2:14 ` [PATCH 24/29] net/ipv6: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 25/29] net/netfilter: rename random32() and " Akinobu Mita
2012-12-24  2:14 ` [PATCH 26/29] net/core: " Akinobu Mita
2012-12-24  2:14 ` [PATCH 27/29] net/core: remove duplicate statements by do-while loop Akinobu Mita
2012-12-24  2:14 ` [PATCH 28/29] net/: rename net_random() to prandom_u32() Akinobu Mita
2012-12-25  0:21   ` Neil Horman
2012-12-25 11:47     ` Akinobu Mita
2012-12-26  0:42       ` Neil Horman
2012-12-24  2:14 ` [PATCH 29/29] remove unused net_random(), net_srandom(), random32(), and srandom32() Akinobu Mita

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=1356315256-6572-22-git-send-email-akinobu.mita@gmail.com \
    --to=akinobu.mita@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox