mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] 2.4.19 fix for fuzzy hash <linux/ghash.h>
@ 2002-09-11 18:02 Bart Trojanowski
  2002-09-11 18:13 ` Bart Trojanowski
  2002-09-18  3:11 ` Rusty Russell
  0 siblings, 2 replies; 3+ messages in thread
From: Bart Trojanowski @ 2002-09-11 18:02 UTC (permalink / raw)
  To: linux-kernel

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

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;\
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:49 2002
+++ linux-2.4.19+ghash-fix/include/linux/ghash.h~	Wed Sep 11 10:10:57 2002
@@ -1,4 +1,3 @@
-
 /*
  * include/linux/ghash.h -- generic hashing with fuzzy retrieval
  *

[-- 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>
  2002-09-11 18:02 [PATCH] 2.4.19 fix for fuzzy hash <linux/ghash.h> Bart Trojanowski
@ 2002-09-11 18:13 ` Bart Trojanowski
  2002-09-18  3:11 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Trojanowski @ 2002-09-11 18:13 UTC (permalink / raw)
  To: linux-kernel, linux-kernel

* Bart Trojanowski <bart@jukie.net> [020911 14:04]:
> 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.

Please ignore the garbage at the end of the last patch.

Here is a cleaned up one.

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

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

* Re: [PATCH] 2.4.19 fix for fuzzy hash <linux/ghash.h>
  2002-09-11 18:02 [PATCH] 2.4.19 fix for fuzzy hash <linux/ghash.h> Bart Trojanowski
  2002-09-11 18:13 ` Bart Trojanowski
@ 2002-09-18  3:11 ` Rusty Russell
  1 sibling, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2002-09-18  3:11 UTC (permalink / raw)
  To: Bart Trojanowski; +Cc: linux-kernel

On Wed, 11 Sep 2002 14:02:32 -0400
Bart Trojanowski <bart@jukie.net> wrote:

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

That's why I was going to submit a patch to turf it out in 2.5.
2.5's include/hash.h provides a hashing function: did you really want ghash.h?

Cheers,
Rusty.
-- 
   there are those who do and those who hang on and you don't see too
   many doers quoting their contemporaries.  -- Larry McVoy

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

end of thread, other threads:[~2002-09-18  3:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-11 18:02 [PATCH] 2.4.19 fix for fuzzy hash <linux/ghash.h> Bart Trojanowski
2002-09-11 18:13 ` Bart Trojanowski
2002-09-18  3:11 ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®