netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -v2 00/26] rename random32 to prandom
@ 2013-01-03 12:18 Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32() Akinobu Mita
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:18 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, Theodore Ts'o, David S. Miller, netdev

Commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f ("random32: rename random32
to prandom") renamed random32() and srandom32() to prandom_u32() and
prandom_seed() respectively.  Due to the volume of existing random32()
callers, they were preserved as backword compatibility wrapper macros.

This patch series aims for finishing the naming transition and removing
the backword compatibility wrapper macros.

The naming transition is mainly simple substitution work for random32()
and srandom32().  But this patch series also includes minor cleanup
which was found while I was working on the substitution.

* Changes from v1
- leave all net_random() and net_srandom callers as-is and preserve the
  macro definisions. Because that is a useful indirection.
  Spotted by Neil Horman.
- remove batman-adv fix which has been applied to net
- collect Acked-by:

Akinobu Mita (26):
  raid6test: use prandom_bytes()
  uuid: use prandom_bytes()
  x86: pageattr-test: remove srandom32 call
  x86: rename random32() to prandom_u32()
  lib/: rename random32() to prandom_u32()
  mm/: rename random32() to prandom_u32()
  kernel/: rename random32() to prandom_u32()
  drbd: rename random32() to prandom_u32()
  infiniband: rename random32() to prandom_u32()
  mmc: rename random32() to prandom_u32()
  video/uvesafb: rename random32() to prandom_u32()
  xfs: rename random32() to prandom_u32()
  ubifs: rename random32() to prandom_u32()
  uwb: rename random32() to prandom_u32()
  lguest: rename random32() to prandom_u32()
  scsi: rename random32() to prandom_u32()
  mtd: rename random32() to prandom_u32()
  drivers/net: rename random32() to prandom_u32()
  batman-adv: rename random32() to prandom_u32()
  net/sunrpc: rename random32() to prandom_u32()
  net/sched: rename random32() to prandom_u32()
  net/netfilter: rename random32() to prandom_u32()
  net/core:  rename random32() to prandom_u32()
  net/core: remove duplicate statements by do-while loop
  net: rename random32 to prandom
  remove unused random32() and srandom32()

 arch/x86/mm/pageattr-test.c                 |  5 ++--
 crypto/async_tx/raid6test.c                 |  9 ++-----
 drivers/block/drbd/drbd_receiver.c          |  5 ++--
 drivers/infiniband/hw/cxgb3/cxio_resource.c |  4 +--
 drivers/infiniband/hw/cxgb4/id_table.c      |  4 +--
 drivers/infiniband/hw/mlx4/mad.c            |  2 +-
 drivers/infiniband/ulp/ipoib/ipoib_cm.c     |  2 +-
 drivers/lguest/page_tables.c                |  2 +-
 drivers/mmc/core/core.c                     |  4 +--
 drivers/mtd/nand/nandsim.c                  |  6 ++---
 drivers/mtd/tests/mtd_nandecctest.c         | 10 +++----
 drivers/mtd/tests/mtd_stresstest.c          |  8 +++---
 drivers/mtd/ubi/debug.h                     |  6 ++---
 drivers/net/ethernet/broadcom/cnic.c        |  4 +--
 drivers/net/hamradio/baycom_epp.c           |  2 +-
 drivers/net/hamradio/hdlcdrv.c              |  2 +-
 drivers/net/hamradio/yam.c                  |  2 +-
 drivers/net/wireless/mwifiex/cfg80211.c     |  4 +--
 drivers/scsi/fcoe/fcoe_ctlr.c               |  4 +--
 drivers/scsi/lpfc/lpfc_hbadisc.c            |  6 ++---
 drivers/scsi/qla2xxx/qla_attr.c             |  7 +++--
 drivers/uwb/rsv.c                           |  4 +--
 drivers/video/uvesafb.c                     |  2 +-
 fs/ubifs/debug.c                            |  8 +++---
 fs/ubifs/lpt_commit.c                       | 14 +++++-----
 fs/ubifs/tnc_commit.c                       |  2 +-
 fs/xfs/xfs_alloc.c                          |  2 +-
 fs/xfs/xfs_error.c                          |  2 +-
 fs/xfs/xfs_ialloc.c                         |  2 +-
 fs/xfs/xfs_log.c                            |  2 +-
 include/linux/net.h                         |  4 +--
 include/linux/random.h                      |  7 -----
 kernel/rcutree.c                            |  2 +-
 kernel/test_kprobes.c                       |  2 +-
 lib/fault-inject.c                          |  2 +-
 lib/list_sort.c                             |  2 +-
 lib/uuid.c                                  |  8 +-----
 mm/swapfile.c                               |  2 +-
 net/batman-adv/bat_iv_ogm.c                 |  4 +--
 net/core/pktgen.c                           | 42 ++++++++++++++---------------
 net/netfilter/nf_conntrack_core.c           |  4 +--
 net/sched/sch_choke.c                       |  2 +-
 net/sunrpc/auth_gss/gss_krb5_wrap.c         |  4 +--
 43 files changed, 102 insertions(+), 119 deletions(-)

Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
-- 
1.7.11.7

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32()
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 19:36   ` Bing Zhao
       [not found] ` <1357215562-6288-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, David S. Miller, Michael Chan, Thomas Sailer,
	Jean-Paul Roubelat, Bing Zhao, netdev, linux-hams, linux-wireless

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Michael Chan <mchan@broadcom.com>
Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
Cc: Jean-Paul Roubelat <jpr@f6fbb.org>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: netdev@vger.kernel.org
Cc: linux-hams@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
---

No change from v1

 drivers/net/ethernet/broadcom/cnic.c    | 4 ++--
 drivers/net/hamradio/baycom_epp.c       | 2 +-
 drivers/net/hamradio/hdlcdrv.c          | 2 +-
 drivers/net/hamradio/yam.c              | 2 +-
 drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
index df8c30d..27d7a32 100644
--- a/drivers/net/ethernet/broadcom/cnic.c
+++ b/drivers/net/ethernet/broadcom/cnic.c
@@ -4085,7 +4085,7 @@ static int cnic_cm_alloc_mem(struct cnic_dev *dev)
 	if (!cp->csk_tbl)
 		return -ENOMEM;
 
-	port_id = random32();
+	port_id = prandom_u32();
 	port_id %= CNIC_LOCAL_PORT_RANGE;
 	if (cnic_init_id_tbl(&cp->csk_port_tbl, CNIC_LOCAL_PORT_RANGE,
 			     CNIC_LOCAL_PORT_MIN, port_id)) {
@@ -4145,7 +4145,7 @@ static int cnic_cm_init_bnx2_hw(struct cnic_dev *dev)
 {
 	u32 seed;
 
-	seed = random32();
+	seed = prandom_u32();
 	cnic_ctx_wr(dev, 45, 0, seed);
 	return 0;
 }
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 49b8b58..484f77e 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -449,7 +449,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
 			if ((--bc->hdlctx.slotcnt) > 0)
 				return 0;
 			bc->hdlctx.slotcnt = bc->ch_params.slottime;
-			if ((random32() % 256) > bc->ch_params.ppersist)
+			if ((prandom_u32() % 256) > bc->ch_params.ppersist)
 				return 0;
 		}
 	}
diff --git a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
index a4a3516..3169252 100644
--- a/drivers/net/hamradio/hdlcdrv.c
+++ b/drivers/net/hamradio/hdlcdrv.c
@@ -389,7 +389,7 @@ void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
 	if ((--s->hdlctx.slotcnt) > 0)
 		return;
 	s->hdlctx.slotcnt = s->ch_params.slottime;
-	if ((random32() % 256) > s->ch_params.ppersist)
+	if ((prandom_u32() % 256) > s->ch_params.ppersist)
 		return;
 	start_tx(dev, s);
 }
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index c6645f1..21f231a 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -638,7 +638,7 @@ static void yam_arbitrate(struct net_device *dev)
 	yp->slotcnt = yp->slot / 10;
 
 	/* is random > persist ? */
-	if ((random32() % 256) > yp->pers)
+	if ((prandom_u32() % 256) > yp->pers)
 		return;
 
 	yam_start_tx(dev, yp);
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index a875499..78dbc18 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -216,7 +216,7 @@ mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
 	mwifiex_form_mgmt_frame(skb, buf, len);
 	mwifiex_queue_tx_pkt(priv, skb);
 
-	*cookie = random32() | 1;
+	*cookie = prandom_u32() | 1;
 	cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_ATOMIC);
 
 	wiphy_dbg(wiphy, "info: management frame transmitted\n");
@@ -271,7 +271,7 @@ mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
 					 duration);
 
 	if (!ret) {
-		*cookie = random32() | 1;
+		*cookie = prandom_u32() | 1;
 		priv->roc_cfg.cookie = *cookie;
 		priv->roc_cfg.chan = *chan;
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 19/26] batman-adv: rename random32() to prandom_u32()
       [not found] ` <1357215562-6288-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-01-03 12:19   ` Akinobu Mita
       [not found]     ` <1357215562-6288-20-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r, Akinobu Mita,
	Simon Wunderlich, Marek Lindner, David S. Miller

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

Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Acked-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Cc: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
Cc: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Cc: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
Cc: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
---

No change from v1

 net/batman-adv/bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 7d02ebd..bc434c4 100644
--- a/net/batman-adv/bat_iv_ogm.c
+++ b/net/batman-adv/bat_iv_ogm.c
@@ -123,7 +123,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
 	unsigned int msecs;
 
 	msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER;
-	msecs += random32() % (2 * BATADV_JITTER);
+	msecs += prandom_u32() % (2 * BATADV_JITTER);
 
 	return jiffies + msecs_to_jiffies(msecs);
 }
@@ -131,7 +131,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv)
 /* when do we schedule a ogm packet to be sent */
 static unsigned long batadv_iv_ogm_fwd_send_time(void)
 {
-	return jiffies + msecs_to_jiffies(random32() % (BATADV_JITTER / 2));
+	return jiffies + msecs_to_jiffies(prandom_u32() % (BATADV_JITTER / 2));
 }
 
 /* apply hop penalty for a normal link */
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 20/26] net/sunrpc: rename random32() to prandom_u32()
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32() Akinobu Mita
       [not found] ` <1357215562-6288-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 21/26] net/sched: " Akinobu Mita
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, J. Bruce Fields, Trond Myklebust, David S. Miller,
	netdev, linux-nfs

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
---

* Change from v1
- leave net_random() callers as-is because that is a useful indirection

 net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 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) {
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 21/26] net/sched: rename random32() to prandom_u32()
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
                   ` (2 preceding siblings ...)
  2013-01-03 12:19 ` [PATCH -v2 20/26] net/sunrpc: " Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 22/26] net/netfilter: " Akinobu Mita
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, Stephen Hemminger, Jamal Hadi Salim,
	David S. Miller, netem, netdev

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netem@lists.linux-foundation.org
Cc: netdev@vger.kernel.org
Cc: netdev@vger.kernel.org
---

* Change from v1
- leave net_random() callers as-is because that is a useful indirection

 net/sched/sch_choke.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index cc37dd5..ef53ab8 100644
--- a/net/sched/sch_choke.c
+++ b/net/sched/sch_choke.c
@@ -80,7 +80,7 @@ struct choke_sched_data {
 /* deliver a random number between 0 and N - 1 */
 static u32 random_N(unsigned int N)
 {
-	return reciprocal_divide(random32(), N);
+	return reciprocal_divide(prandom_u32(), N);
 }
 
 /* number of elements in queue including holes */
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 22/26] net/netfilter: rename random32() to prandom_u32()
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
                   ` (3 preceding siblings ...)
  2013-01-03 12:19 ` [PATCH -v2 21/26] net/sched: " Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 23/26] net/core: " Akinobu Mita
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm
  Cc: Akinobu Mita, Pablo Neira Ayuso, Patrick McHardy, netfilter-devel,
	netfilter, coreteam, David S. Miller, netdev

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: netfilter-devel@vger.kernel.org
Cc: netfilter@vger.kernel.org
Cc: coreteam@netfilter.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---

* Change from v1
- leave net_random() callers as-is because that is a useful indirection

 net/netfilter/nf_conntrack_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 08cdc71..a8f5c7a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -263,7 +263,7 @@ static void death_by_event(unsigned long ul_conntrack)
 	if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
 		/* bad luck, let's retry again */
 		ecache->timeout.expires = jiffies +
-			(random32() % net->ct.sysctl_events_retry_timeout);
+			(prandom_u32() % net->ct.sysctl_events_retry_timeout);
 		add_timer(&ecache->timeout);
 		return;
 	}
@@ -282,7 +282,7 @@ void nf_ct_dying_timeout(struct nf_conn *ct)
 	/* set a new timer to retry event delivery */
 	setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct);
 	ecache->timeout.expires = jiffies +
-		(random32() % net->ct.sysctl_events_retry_timeout);
+		(prandom_u32() % net->ct.sysctl_events_retry_timeout);
 	add_timer(&ecache->timeout);
 }
 EXPORT_SYMBOL_GPL(nf_ct_dying_timeout);
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 23/26] net/core:  rename random32() to prandom_u32()
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
                   ` (4 preceding siblings ...)
  2013-01-03 12:19 ` [PATCH -v2 22/26] net/netfilter: " Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 24/26] net/core: remove duplicate statements by do-while loop Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 25/26] net: rename random32 to prandom Akinobu Mita
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev

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

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---

* Change from v1
- leave net_random() callers as-is because that is a useful indirection

 net/core/pktgen.c | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b29dacf..d23ec86 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2182,7 +2182,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
 				pkt_dev->curfl = 0; /*reset */
 		}
 	} else {
-		flow = random32() % pkt_dev->cflows;
+		flow = prandom_u32() % pkt_dev->cflows;
 		pkt_dev->curfl = flow;
 
 		if (pkt_dev->flows[flow].count > pkt_dev->lflow) {
@@ -2229,7 +2229,7 @@ static void set_cur_queue_map(struct pktgen_dev *pkt_dev)
 	else if (pkt_dev->queue_map_min <= pkt_dev->queue_map_max) {
 		__u16 t;
 		if (pkt_dev->flags & F_QUEUE_MAP_RND) {
-			t = random32() %
+			t = prandom_u32() %
 				(pkt_dev->queue_map_max -
 				 pkt_dev->queue_map_min + 1)
 				+ pkt_dev->queue_map_min;
@@ -2261,7 +2261,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 		__u32 tmp;
 
 		if (pkt_dev->flags & F_MACSRC_RND)
-			mc = random32() % pkt_dev->src_mac_count;
+			mc = prandom_u32() % pkt_dev->src_mac_count;
 		else {
 			mc = pkt_dev->cur_src_mac_offset++;
 			if (pkt_dev->cur_src_mac_offset >=
@@ -2287,7 +2287,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 		__u32 tmp;
 
 		if (pkt_dev->flags & F_MACDST_RND)
-			mc = random32() % pkt_dev->dst_mac_count;
+			mc = prandom_u32() % pkt_dev->dst_mac_count;
 
 		else {
 			mc = pkt_dev->cur_dst_mac_offset++;
@@ -2314,21 +2314,21 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 		for (i = 0; i < pkt_dev->nr_labels; i++)
 			if (pkt_dev->labels[i] & MPLS_STACK_BOTTOM)
 				pkt_dev->labels[i] = MPLS_STACK_BOTTOM |
-					     ((__force __be32)random32() &
+					     ((__force __be32)prandom_u32() &
 						      htonl(0x000fffff));
 	}
 
 	if ((pkt_dev->flags & F_VID_RND) && (pkt_dev->vlan_id != 0xffff)) {
-		pkt_dev->vlan_id = random32() & (4096-1);
+		pkt_dev->vlan_id = prandom_u32() & (4096 - 1);
 	}
 
 	if ((pkt_dev->flags & F_SVID_RND) && (pkt_dev->svlan_id != 0xffff)) {
-		pkt_dev->svlan_id = random32() & (4096 - 1);
+		pkt_dev->svlan_id = prandom_u32() & (4096 - 1);
 	}
 
 	if (pkt_dev->udp_src_min < pkt_dev->udp_src_max) {
 		if (pkt_dev->flags & F_UDPSRC_RND)
-			pkt_dev->cur_udp_src = random32() %
+			pkt_dev->cur_udp_src = prandom_u32() %
 				(pkt_dev->udp_src_max - pkt_dev->udp_src_min)
 				+ pkt_dev->udp_src_min;
 
@@ -2341,7 +2341,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 
 	if (pkt_dev->udp_dst_min < pkt_dev->udp_dst_max) {
 		if (pkt_dev->flags & F_UDPDST_RND) {
-			pkt_dev->cur_udp_dst = random32() %
+			pkt_dev->cur_udp_dst = prandom_u32() %
 				(pkt_dev->udp_dst_max - pkt_dev->udp_dst_min)
 				+ pkt_dev->udp_dst_min;
 		} else {
@@ -2358,7 +2358,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 		if (imn < imx) {
 			__u32 t;
 			if (pkt_dev->flags & F_IPSRC_RND)
-				t = random32() % (imx - imn) + imn;
+				t = prandom_u32() % (imx - imn) + imn;
 			else {
 				t = ntohl(pkt_dev->cur_saddr);
 				t++;
@@ -2379,7 +2379,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 				__be32 s;
 				if (pkt_dev->flags & F_IPDST_RND) {
 
-					t = random32() % (imx - imn) + imn;
+					t = prandom_u32() % (imx - imn) + imn;
 					s = htonl(t);
 
 					while (ipv4_is_loopback(s) ||
@@ -2387,7 +2387,8 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 					       ipv4_is_lbcast(s) ||
 					       ipv4_is_zeronet(s) ||
 					       ipv4_is_local_multicast(s)) {
-						t = random32() % (imx - imn) + imn;
+						t = prandom_u32() %
+							(imx - imn) + imn;
 						s = htonl(t);
 					}
 					pkt_dev->cur_daddr = s;
@@ -2420,7 +2421,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 
 			for (i = 0; i < 4; i++) {
 				pkt_dev->cur_in6_daddr.s6_addr32[i] =
-				    (((__force __be32)random32() |
+				    (((__force __be32)prandom_u32() |
 				      pkt_dev->min_in6_daddr.s6_addr32[i]) &
 				     pkt_dev->max_in6_daddr.s6_addr32[i]);
 			}
@@ -2430,7 +2431,7 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 	if (pkt_dev->min_pkt_size < pkt_dev->max_pkt_size) {
 		__u32 t;
 		if (pkt_dev->flags & F_TXSIZE_RND) {
-			t = random32() %
+			t = prandom_u32() %
 				(pkt_dev->max_pkt_size - pkt_dev->min_pkt_size)
 				+ pkt_dev->min_pkt_size;
 		} else {
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 24/26] net/core: remove duplicate statements by do-while loop
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
                   ` (5 preceding siblings ...)
  2013-01-03 12:19 ` [PATCH -v2 23/26] net/core: " Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  2013-01-03 12:19 ` [PATCH -v2 25/26] net: rename random32 to prandom Akinobu Mita
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev

Remove duplicate statements by using do-while loop instead of while loop.

- A;
- while (e) {
+ do {
	A;
- }
+ } while (e);

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---

No change from v1

 net/core/pktgen.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index d23ec86..48a3a29 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2379,18 +2379,15 @@ static void mod_cur_headers(struct pktgen_dev *pkt_dev)
 				__be32 s;
 				if (pkt_dev->flags & F_IPDST_RND) {
 
-					t = prandom_u32() % (imx - imn) + imn;
-					s = htonl(t);
-
-					while (ipv4_is_loopback(s) ||
-					       ipv4_is_multicast(s) ||
-					       ipv4_is_lbcast(s) ||
-					       ipv4_is_zeronet(s) ||
-					       ipv4_is_local_multicast(s)) {
+					do {
 						t = prandom_u32() %
 							(imx - imn) + imn;
 						s = htonl(t);
-					}
+					} while (ipv4_is_loopback(s) ||
+						ipv4_is_multicast(s) ||
+						ipv4_is_lbcast(s) ||
+						ipv4_is_zeronet(s) ||
+						ipv4_is_local_multicast(s));
 					pkt_dev->cur_daddr = s;
 				} else {
 					t = ntohl(pkt_dev->cur_daddr);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH -v2 25/26] net: rename random32 to prandom
  2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
                   ` (6 preceding siblings ...)
  2013-01-03 12:19 ` [PATCH -v2 24/26] net/core: remove duplicate statements by do-while loop Akinobu Mita
@ 2013-01-03 12:19 ` Akinobu Mita
  7 siblings, 0 replies; 13+ messages in thread
From: Akinobu Mita @ 2013-01-03 12:19 UTC (permalink / raw)
  To: linux-kernel, akpm; +Cc: Akinobu Mita, David S. Miller, netdev

Commit 496f2f93b1cc286f5a4f4f9acdc1e5314978683f ("random32: rename
random32 to prandom") renamed random32() and srandom32() to prandom_u32()
and prandom_seed() respectively.

net_random() and net_srandom() need to be redefined with prandom_* in
order to finish the naming transition.

While I'm at it, enclose macro argument of net_srandom() with parenthesis.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
---

* New patch from v2

 include/linux/net.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/net.h b/include/linux/net.h
index aa16731..99c9f0c 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -240,8 +240,8 @@ do {								\
 #define net_dbg_ratelimited(fmt, ...)				\
 	net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
 
-#define net_random()		random32()
-#define net_srandom(seed)	srandom32((__force u32)seed)
+#define net_random()		prandom_u32()
+#define net_srandom(seed)	prandom_seed((__force u32)(seed))
 
 extern int   	     kernel_sendmsg(struct socket *sock, struct msghdr *msg,
 				    struct kvec *vec, size_t num, size_t len);
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32()
  2013-01-03 12:19 ` [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32() Akinobu Mita
@ 2013-01-03 19:36   ` Bing Zhao
  0 siblings, 0 replies; 13+ messages in thread
From: Bing Zhao @ 2013-01-03 19:36 UTC (permalink / raw)
  To: Akinobu Mita, linux-kernel@vger.kernel.org,
	akpm@linux-foundation.org
  Cc: David S. Miller, Michael Chan, Thomas Sailer, Jean-Paul Roubelat,
	netdev@vger.kernel.org, linux-hams@vger.kernel.org,
	linux-wireless@vger.kernel.org

Hi Akinobu,

> Use more preferable function name which implies using a pseudo-random
> number generator.
> 
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> Acked-by: Thomas Sailer <t.sailer@alumni.ethz.ch>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Michael Chan <mchan@broadcom.com>
> Cc: Thomas Sailer <t.sailer@alumni.ethz.ch>
> Cc: Jean-Paul Roubelat <jpr@f6fbb.org>
> Cc: Bing Zhao <bzhao@marvell.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-hams@vger.kernel.org
> Cc: linux-wireless@vger.kernel.org

Acked-by: Bing Zhao <bzhao@marvell.com> [mwifiex]

Thanks,
Bing

> ---
> 
> No change from v1
> 
>  drivers/net/ethernet/broadcom/cnic.c    | 4 ++--
>  drivers/net/hamradio/baycom_epp.c       | 2 +-
>  drivers/net/hamradio/hdlcdrv.c          | 2 +-
>  drivers/net/hamradio/yam.c              | 2 +-
>  drivers/net/wireless/mwifiex/cfg80211.c | 4 ++--
>  5 files changed, 7 insertions(+), 7 deletions(-)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH -v2 19/26] batman-adv: rename random32() to prandom_u32()
       [not found]     ` <1357215562-6288-20-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2013-01-04  2:12       ` Antonio Quartulli
  2013-01-04 13:50         ` Akinobu Mita
  0 siblings, 1 reply; 13+ messages in thread
From: Antonio Quartulli @ 2013-01-04  2:12 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Simon Wunderlich,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, Marek Lindner,
	David S. Miller

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

On Thu, Jan 03, 2013 at 09:19:15PM +0900, Akinobu Mita wrote:
> Use more preferable function name which implies using a pseudo-random
> number generator.
> 
> Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> Cc: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
> Cc: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
> Cc: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> Cc: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
> Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> ---

Hello Akinobu,

as you can see in <201301021952.49979.lindner_marek-LWAfsSFWpa4@public.gmane.org>, Marek Lindner
already applied this change onto our tree. You didn't need to resend this patch
to netdev, it will be sent by us through a future pull request.


Thanks a lot.
Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH -v2 19/26] batman-adv: rename random32() to prandom_u32()
  2013-01-04  2:12       ` Antonio Quartulli
@ 2013-01-04 13:50         ` Akinobu Mita
       [not found]           ` <CAC5umyhLB++mh=-pFRzhD-YxZH2RwC5ED4g8mYxS5pYGcbxsvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Akinobu Mita @ 2013-01-04 13:50 UTC (permalink / raw)
  To: Antonio Quartulli
  Cc: linux-kernel, akpm, Marek Lindner, Simon Wunderlich, b.a.t.m.a.n,
	David S. Miller, netdev

2013/1/4 Antonio Quartulli <ordex@autistici.org>:
> On Thu, Jan 03, 2013 at 09:19:15PM +0900, Akinobu Mita wrote:
>> Use more preferable function name which implies using a pseudo-random
>> number generator.
>>
>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>> Acked-by: Antonio Quartulli <ordex@autistici.org>
>> Cc: Marek Lindner <lindner_marek@yahoo.de>
>> Cc: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
>> Cc: Antonio Quartulli <ordex@autistici.org>
>> Cc: b.a.t.m.a.n@lists.open-mesh.org
>> Cc: "David S. Miller" <davem@davemloft.net>
>> Cc: netdev@vger.kernel.org
>> ---
>
> Hello Akinobu,
>
> as you can see in <201301021952.49979.lindner_marek@yahoo.de>, Marek Lindner
> already applied this change onto our tree. You didn't need to resend this patch
> to netdev, it will be sent by us through a future pull request.

Yes. I read Marek's email. But I included it in v2 again in order not
to break the build. Because it doesn't show up the latest linux-next yet
and the last patch 26/26 removes random32() and srandom32().

But I should have mentioned it and trimmed the Cc list.
Sorry for the confusion.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH -v2 19/26] batman-adv: rename random32() to prandom_u32()
       [not found]           ` <CAC5umyhLB++mh=-pFRzhD-YxZH2RwC5ED4g8mYxS5pYGcbxsvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-01-06  9:00             ` Antonio Quartulli
  0 siblings, 0 replies; 13+ messages in thread
From: Antonio Quartulli @ 2013-01-06  9:00 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Simon Wunderlich,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, Marek Lindner,
	David S. Miller

[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]

On Fri, Jan 04, 2013 at 10:50:41PM +0900, Akinobu Mita wrote:
> 2013/1/4 Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>:
> > On Thu, Jan 03, 2013 at 09:19:15PM +0900, Akinobu Mita wrote:
> >> Use more preferable function name which implies using a pseudo-random
> >> number generator.
> >>
> >> Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >> Acked-by: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> >> Cc: Marek Lindner <lindner_marek-LWAfsSFWpa4@public.gmane.org>
> >> Cc: Simon Wunderlich <siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
> >> Cc: Antonio Quartulli <ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
> >> Cc: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org
> >> Cc: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
> >> Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> >> ---
> >
> > Hello Akinobu,
> >
> > as you can see in <201301021952.49979.lindner_marek-LWAfsSFWpa4@public.gmane.org>, Marek Lindner
> > already applied this change onto our tree. You didn't need to resend this patch
> > to netdev, it will be sent by us through a future pull request.
> 
> Yes. I read Marek's email. But I included it in v2 again in order not
> to break the build. Because it doesn't show up the latest linux-next yet
> and the last patch 26/26 removes random32() and srandom32().
> 
> But I should have mentioned it and trimmed the Cc list.
> Sorry for the confusion.

Ok..everything is fine as soon David won't apply this patch.
Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-01-06  9:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 12:18 [PATCH -v2 00/26] rename random32 to prandom Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 18/26] drivers/net: rename random32() to prandom_u32() Akinobu Mita
2013-01-03 19:36   ` Bing Zhao
     [not found] ` <1357215562-6288-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-03 12:19   ` [PATCH -v2 19/26] batman-adv: " Akinobu Mita
     [not found]     ` <1357215562-6288-20-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-01-04  2:12       ` Antonio Quartulli
2013-01-04 13:50         ` Akinobu Mita
     [not found]           ` <CAC5umyhLB++mh=-pFRzhD-YxZH2RwC5ED4g8mYxS5pYGcbxsvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-06  9:00             ` Antonio Quartulli
2013-01-03 12:19 ` [PATCH -v2 20/26] net/sunrpc: " Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 21/26] net/sched: " Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 22/26] net/netfilter: " Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 23/26] net/core: " Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 24/26] net/core: remove duplicate statements by do-while loop Akinobu Mita
2013-01-03 12:19 ` [PATCH -v2 25/26] net: rename random32 to prandom Akinobu Mita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).