Project

General

Profile

Actions

Bug #854

closed

hwpmc [2/13]

Added by aoiko over 16 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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

Actions #1

Updated by alexh about 14 years ago

See Issue1714.

Actions

Also available in: Atom PDF