linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [2.4.19] fix for fuzzy hash <linux/ghash.h> [Attempt 2]
@ 2002-10-06 21:01 Bart Trojanowski
  2002-10-07  5:22 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Trojanowski @ 2002-10-06 21:01 UTC (permalink / raw)
  To: linux-kernel

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

[ Originally posted on 2002/09/11;  I just looked in 2.4.20-pre9 and it
was not there, hence the repost. ]

The DEF_HASH_FUZZY macro allows the user to template their hash; it
takes on a paramter for the hashing-function, namely HASHFN.  When used
with a hashing-function named anything other than 'hashfn()', a module
using the kernel's fuzzy hash implementation will not compile.

None of the in-kernel 2.4.x drivers use this primitive (yet) so it's no
wonder no one has spotted it.  The patch is very trivial and makes me
think that I am the very first user of the include/linux/ghash.h
hash-table primitive.   ;)

Bart.

---
diff -ruN linux-2.4.19/include/linux/ghash.h linux-2.4.19+ghash-fix/include/linux/ghash.h
--- linux-2.4.19/include/linux/ghash.h	Wed Sep 11 10:09:57 2002
+++ linux-2.4.19+ghash-fix/include/linux/ghash.h	Wed Sep 11 10:12:52 2002
@@ -106,7 +106,7 @@
 \
 LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\
 {\
-	int ix = hashfn(pos);\
+	int ix = HASHFN(pos);\
 	TYPE * ptr = tbl->hashtable[ix];\
 	while(ptr && KEYCMP(ptr->KEY, pos))\
 		ptr = ptr->PTRS.next_hash;\
@@ -206,7 +206,7 @@
 \
 LINKAGE TYPE * find_##NAME##_hash(struct NAME##_table * tbl, KEYTYPE pos)\
 {\
-	int ix = hashfn(pos);\
+	int ix = HASHFN(pos);\
 	TYPE * ptr = tbl->hashtable[ix];\
 	while(ptr && KEYCMP(ptr->KEY, pos))\
 		ptr = ptr->PTRS.next_hash;\

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

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

* Re: [PATCH] [2.4.19] fix for fuzzy hash <linux/ghash.h> [Attempt 2]
  2002-10-06 21:01 [PATCH] [2.4.19] fix for fuzzy hash <linux/ghash.h> [Attempt 2] Bart Trojanowski
@ 2002-10-07  5:22 ` Arnaldo Carvalho de Melo
  2002-10-10 19:17   ` Daniel Phillips
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2002-10-07  5:22 UTC (permalink / raw)
  To: Bart Trojanowski; +Cc: linux-kernel

Em Sun, Oct 06, 2002 at 05:01:24PM -0400, Bart Trojanowski escreveu:
> wonder no one has spotted it.  The patch is very trivial and makes me
> think that I am the very first user of the include/linux/ghash.h
> hash-table primitive.   ;)

Somebody told me that this was used in when dentry was introduced to the
kernel, but then after rewrites it stopped being used, I was even thinking
about submitting a patch removing it from the tree, but now there is one user,
you :-)

- Arnaldo

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

* Re: [PATCH] [2.4.19] fix for fuzzy hash <linux/ghash.h> [Attempt 2]
  2002-10-07  5:22 ` Arnaldo Carvalho de Melo
@ 2002-10-10 19:17   ` Daniel Phillips
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Phillips @ 2002-10-10 19:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Bart Trojanowski; +Cc: linux-kernel

On Monday 07 October 2002 07:22, Arnaldo Carvalho de Melo wrote:
> Em Sun, Oct 06, 2002 at 05:01:24PM -0400, Bart Trojanowski escreveu:
> > wonder no one has spotted it.  The patch is very trivial and makes me
> > think that I am the very first user of the include/linux/ghash.h
> > hash-table primitive.   ;)
> 
> Somebody told me that this was used in when dentry was introduced to the
> kernel, but then after rewrites it stopped being used, I was even thinking
> about submitting a patch removing it from the tree, but now there is one user,
> you :-)

Too bad, should have acted faster ;-)

This attempt is much like the single linked lists: it looks like something you
ought to be able to generalize, but somehow it never quite works.  Writing
the code out in full gives you a more efficient, more compact result every
time.

-- 
Daniel

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

end of thread, other threads:[~2002-10-10 19:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-06 21:01 [PATCH] [2.4.19] fix for fuzzy hash <linux/ghash.h> [Attempt 2] Bart Trojanowski
2002-10-07  5:22 ` Arnaldo Carvalho de Melo
2002-10-10 19:17   ` Daniel Phillips

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