Date: Mon, 16 Mar 2015 15:18:53 -0400 From: Yue Chen <ycyc321@gmail.com> To: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Hash table in FreeBSD kernel? Message-ID: <CAKtBrB4czEv29u-t-Hi09vus8tbACew363nqSvWd1z04oL8kXA@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Dear all,
Is there a good hash table implementation for FreeBSD kernel, x86_64? I
tried "uthash", but encountered some memory problems (during HASH_FIND())
when the entry number becomes large. The cause may be my replacements for
the user-space header functions and types are incorrect.
=====================================================================
The userland functions/types need to be replaced:
#include <string.h> /* memcmp,strlen */
#include <stddef.h> /* ptrdiff_t */
#include <stdlib.h> /* exit() */ /* malloc() */
=====================================================================
I use:
#include <sys/systm.h> /* memcmp */
#include <sys/_types.h>
typedef __ptrdiff_t ptrdiff_t;
#include <sys/types.h>
#include <sys/malloc.h> /* the malloc() */
------------------------------------------------------------------------------------------------------------------------
size_t strlen(const char *str)
{
const char *s;
for (s = str; *s; ++s);
return(s - str);
}
=====================================================================
Any suggestions for using "uthash" in kernel, or any other alternatives
that I can use? (the FreeBSD kernel's "hash32" function set seems only
support 32-bit key hash)
Best regards and thanks,
Yue
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKtBrB4czEv29u-t-Hi09vus8tbACew363nqSvWd1z04oL8kXA>
