From patchwork Mon Dec 24 02:14:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 208010 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 25D822C007B for ; Mon, 24 Dec 2012 13:17:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753107Ab2LXCRL (ORCPT ); Sun, 23 Dec 2012 21:17:11 -0500 Received: from mail-pb0-f42.google.com ([209.85.160.42]:46587 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752990Ab2LXCPU (ORCPT ); Sun, 23 Dec 2012 21:15:20 -0500 Received: by mail-pb0-f42.google.com with SMTP id rp2so3730431pbb.1 for ; Sun, 23 Dec 2012 18:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=9OU4miaY1Zw3CCQJUEVF+4Zfi4FIMVyG9BBCUNqQ3L4=; b=xl1beETMnAPUNul7FEQeCdD73FzY91a0RsuHLkENxhgnIo8FrMPX/KgVm8vyCy+BBi RUgiYys5kNHHkLh8Hv6nwsxRkc4F+9JMFhlDg8SrK7QkjHKo4jiqcYAVP1TsDWMUd0UV SIfOAxft3r2mkidtuyJA6VRIvegceHTTgm/6fX0Tjb1wcUvNKIVUxaJCQXpU8AWmRo0V nndFzFAhPn74ParDUW5Wv9kv1ybKNvG79QaLlrTQbOsvOAKThFuSVepPSRGZMxvOWcls RWY36gCgb4AQaNI7fOkgSJ5spAbpoEfdU41i3Jn1Ci+BS8Cl6q75DIka0Vv/J0cGqq7P w6Gg== X-Received: by 10.68.143.41 with SMTP id sb9mr62992657pbb.50.1356315320151; Sun, 23 Dec 2012 18:15:20 -0800 (PST) Received: from localhost.localdomain (p2126-ipbf3106hodogaya.kanagawa.ocn.ne.jp. [114.149.157.126]) by mx.google.com with ESMTPS id wr4sm11379909pbc.72.2012.12.23.18.15.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Dec 2012 18:15:19 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Cc: Akinobu Mita , "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , netdev@vger.kernel.org Subject: [PATCH 23/29] net/ipv4: rename net_random() to prandom_u32() Date: Mon, 24 Dec 2012 11:14:10 +0900 Message-Id: <1356315256-6572-24-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com> References: <1356315256-6572-1-git-send-email-akinobu.mita@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use more preferable function name which implies using a pseudo-random number generator. Signed-off-by: Akinobu Mita Cc: "David S. Miller" Cc: Alexey Kuznetsov Cc: James Morris Cc: Hideaki YOSHIFUJI Cc: Patrick McHardy Cc: netdev@vger.kernel.org --- net/ipv4/devinet.c | 2 +- net/ipv4/igmp.c | 6 +++--- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/udp.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index cc06a47..e849a5e 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -453,7 +453,7 @@ static int __inet_insert_ifa(struct in_ifaddr *ifa, struct nlmsghdr *nlh, } if (!(ifa->ifa_flags & IFA_F_SECONDARY)) { - net_srandom(ifa->ifa_local); + prandom_seed((__force u32)ifa->ifa_local); ifap = last_primary; } diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 736ab70..8506a7c 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -186,7 +186,7 @@ static void igmp_stop_timer(struct ip_mc_list *im) /* It must be called with locked im->lock */ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) { - int tv = net_random() % max_delay; + int tv = prandom_u32() % max_delay; im->tm_running = 1; if (!mod_timer(&im->timer, jiffies+tv+2)) @@ -195,7 +195,7 @@ static void igmp_start_timer(struct ip_mc_list *im, int max_delay) static void igmp_gq_start_timer(struct in_device *in_dev) { - int tv = net_random() % in_dev->mr_maxdelay; + int tv = prandom_u32() % in_dev->mr_maxdelay; in_dev->mr_gq_running = 1; if (!mod_timer(&in_dev->mr_gq_timer, jiffies+tv+2)) @@ -204,7 +204,7 @@ static void igmp_gq_start_timer(struct in_device *in_dev) static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) { - int tv = net_random() % delay; + int tv = prandom_u32() % delay; if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) in_dev_hold(in_dev); diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index d0670f0..f43fc82 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -114,7 +114,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) again: inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; - smallest_rover = rover = net_random() % remaining + low; + smallest_rover = rover = prandom_u32() % remaining + low; smallest_size = -1; do { diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 79c8dbe..ca6cfbb 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -215,7 +215,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; - rand = net_random(); + rand = prandom_u32(); first = (((u64)rand * remaining) >> 32) + low; /* * force rand to be an odd multiple of UDP_HTABLE_SIZE