netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "YOSHIFUJI Hideaki / ____________" <yoshfuji@linux-ipv6.org>,
	davem@redhat.com
Cc: netdev@oss.sgi.com, yoshfuji@linux-ipv6.org
Subject: Re: [PATCH] (2/4) support large number of network devices -- name hash
Date: Mon, 19 Jan 2004 11:28:50 -0800	[thread overview]
Message-ID: <20040119112850.3b3575a7.shemminger@osdl.org> (raw)
In-Reply-To: <20040117.112244.90941296.yoshfuji@linux-ipv6.org>

Use strnlen, great idea, thanks.

diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	Mon Jan 19 11:30:20 2004
+++ b/net/core/dev.c	Mon Jan 19 11:30:20 2004
@@ -192,8 +192,8 @@
 
 static inline struct hlist_head *dev_name_hash(const char *name)
 {
-	size_t len = min(strlen(name),(size_t)(IFNAMSIZ-1));
-	unsigned hash = full_name_hash(name, len);
+	unsigned hash = full_name_hash(name, 
+				       strnlen(name, IFNAMSIZ-1));
 	return &dev_name_head[hash & ((1<<NETDEV_HASHBITS)-1)];
 }
 

  reply	other threads:[~2004-01-19 19:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 23:46 [PATCH] (1/4) support large number of network devices Stephen Hemminger
2004-01-16 23:48 ` [PATCH] (2/4) support large number of network devices -- name hash Stephen Hemminger
2004-01-17  2:22   ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-19 19:28     ` Stephen Hemminger [this message]
2004-01-22  2:10       ` YOSHIFUJI Hideaki / 吉藤英明
2004-01-16 23:49 ` [PATCH] (3/4) support large number of network devices -- hash ifindex Stephen Hemminger
2004-01-16 23:50 ` [PATCH] (4/4) support large number of network devices -- alloc_name bitmap Stephen Hemminger
2004-01-20  5:24 ` [PATCH] (1/4) support large number of network devices David S. Miller

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=20040119112850.3b3575a7.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=netdev@oss.sgi.com \
    --cc=yoshfuji@linux-ipv6.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;
as well as URLs for NNTP newsgroup(s).