Re: ulogd - hashtable_find function - question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you,

In this function jhash(const void *key, u32 length, u32 initval), what
is the purpose of initval?

Thanks & Regards,




On Wed, Aug 8, 2012 at 7:50 AM, Steffen Heil (Mailinglisten)
<lists@xxxxxxxxxxxxxxx> wrote:
> Hi
>
> This is for hash collisions:
> What if 2 values have the same hash value?
>
> Regards,
>    Steffen
>
>
>> -----Original Message-----
>> From: netfilter-owner@xxxxxxxxxxxxxxx [mailto:netfilter-
>> owner@xxxxxxxxxxxxxxx] On Behalf Of Gomathivinayagam Muthuvinayagam
>> Sent: Wednesday, August 08, 2012 4:28 PM
>> To: netfilter@xxxxxxxxxxxxxxx
>> Subject: ulogd - hashtable_find function - question
>>
>> I'm going through ulogd hash.c code. I have a question on hashtable_find
>> function.
>>
>> struct hashtable_node *
>> hashtable_find(const struct hashtable *table, const void *data, int id) {
>>       struct llist_head *e;
>>       struct hashtable_node *n;
>>
>>       llist_for_each(e, &table->members[id]) {
>>               n = llist_entry(e, struct hashtable_node, head);
>>               if (table->compare(n, data)) {
>>                       return n;
>>               }
>>       }
>>       errno = ENOENT;
>>       return NULL;
>> }
>>
>> In the above function, you are passing the id which is the hash value.
>> Basically it allows you to find the hashnode in the hashtable.
>> But why we are again calling  compare function and check the equivalence
> of
>> the values? Is the id itself not enough?
>>
>> Thanks & Regards,
>> --
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
> the body
>> of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
>> http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux