DragonFly submit List (threaded) for 2007-11
DragonFly BSD
DragonFly submit List (threaded) for 2007-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

[patch] hwpmc [2/13]


From: Aggelos Economopoulos <aoiko@xxxxxxxxxxxxxx>
Date: Sat, 24 Nov 2007 20:53:48 +0200

Add hashdestroy(). Required for hwpmc.

Obtained-from: FreeBSD

Index: kern/kern_subr.c
===================================================================
retrieving revision 1.27
diff -u -p -r1.27 kern_subr.c
--- kern/kern_subr.c
+++ kern/kern_subr.c
@@ -277,6 +277,18 @@ hashinit(int elements, struct malloc_typ
 	return (hashtbl);
 }
 
+void
+hashdestroy(void *vhashtbl, struct malloc_type *type, u_long hashmask)
+{
+	LIST_HEAD(generic, generic) *hashtbl, *hp;
+
+	hashtbl = vhashtbl;
+	for (hp = hashtbl; hp <= &hashtbl[hashmask]; hp++)
+		if (!LIST_EMPTY(hp))
+			panic("hashdestroy: hash not empty");
+	kfree(hashtbl, type);
+}
+
 static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039,
 			2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653,
 			7159, 7673, 8191, 12281, 16381, 24571, 32749 };
Index: sys/systm.h
===================================================================
retrieving revision 1.74
diff -u -p -r1.74 systm.h
--- sys/systm.h
+++ sys/systm.h
@@ -142,6 +142,7 @@ int	dumpstatus (vm_offset_t addr, off_t 
 int	nullop (void);
 int	seltrue (cdev_t dev, int which);
 int	ureadc (int, struct uio *);
+void	hashdestroy(void *, struct malloc_type *, u_long);
 void	*hashinit (int count, struct malloc_type *type, u_long *hashmask);
 void	*phashinit (int count, struct malloc_type *type, u_long *nentries);
 



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