Date: Mon, 24 Apr 2006 03:51:22 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95985 for review Message-ID: <200604240351.k3O3pMmF008805@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95985 Change 95985 by jb@jb_freebsd2 on 2006/04/24 03:51:00 Add hacks to dummy up something resembling kmem_cache by completely ignoring why it was required in the first place. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.c#5 edit .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#6 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.c#5 (text+ko) ==== @@ -31,7 +31,39 @@ { free(vmp, M_DTRACE); } +kmem_cache_t * +kmem_cache_create( + char *name, /* descriptive name for this cache */ + size_t bufsize, /* size of the objects it manages */ + size_t align, /* required object alignment */ + int (*constructor)(void *, void *, int), /* object constructor */ + void (*destructor)(void *, void *), /* object destructor */ + void (*reclaim)(void *), /* memory reclaim callback */ + void *private, /* pass-thru arg for constr/destr/reclaim */ + vmem_t *vmp, /* vmem source for slab allocation */ + int cflags) /* cache creation flags */ +{ + kmem_cache_t *p = malloc(sizeof(kmem_cache_t), M_DTRACE, M_WAITOK); + p->size = bufsize; + return(p); +} +void * +kmem_cache_alloc(kmem_cache_t *a, int b) +{ + return (malloc(a->size, M_DTRACE, M_WAITOK | M_ZERO)); +} +void +kmem_cache_free(kmem_cache_t *a, void *b) +{ + free(b, M_DTRACE); +} +void +kmem_cache_destroy(kmem_cache_t *a) +{ + free(a, M_DTRACE); +} + dtrace_cacheid_t dtrace_predcache_id; void *hack_refs[] = @@ -163,15 +195,6 @@ { return 0; } -void * -kmem_cache_alloc(kmem_cache_t *a, int b) -{ - return 0; -} -void -kmem_cache_free(kmem_cache_t *a, void *b) -{ -} void dtrace_xcall(processorid_t a, dtrace_xcall_t b, void *c) { ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#6 (text+ko) ==== @@ -123,7 +123,9 @@ #define PRIV_POLICY_ONLY(cred, priv, all) \ priv_policy_only((cred), (priv), (all)) -typedef struct kmem_cache kmem_cache_t; +typedef struct kmem_cache { + size_t size; +} kmem_cache_t; kmem_cache_t *kmem_cache_create(char *, size_t, size_t, int (*)(void *, void *, int), void (*)(void *, void *), void (*)(void *), void *, vmem_t *, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604240351.k3O3pMmF008805>