1 /* $NetBSD: rf_callback.c,v 1.21 2009/03/14 15:36:20 dsl Exp $ */
3 * Copyright (c) 1995 Carnegie-Mellon University.
8 * Permission to use, copy, modify and distribute this software and
9 * its documentation is hereby granted, provided that both the copyright
10 * notice and this permission notice appear in all copies of the
11 * software, derivative works or modified versions, and any portions
12 * thereof, and that both notices appear in supporting documentation.
14 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
15 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
16 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 * Carnegie Mellon requests users of this software to return to
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
25 * any improvements or extensions that they make and grant Carnegie the
26 * rights to redistribute these changes.
29 /*****************************************************************************
31 * callback.c -- code to manipulate callback descriptor
33 ****************************************************************************/
36 #include <sys/cdefs.h>
37 __KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.21 2009/03/14 15:36:20 dsl Exp $");
39 #include <dev/raidframe/raidframevar.h>
43 #include "rf_threadstuff.h"
44 #include "rf_callback.h"
45 #include "rf_debugMem.h"
46 #include "rf_general.h"
47 #include "rf_shutdown.h"
48 #include "rf_netbsd.h"
50 #define RF_MAX_FREE_CALLBACK 64
51 #define RF_MIN_FREE_CALLBACK 32
53 static void rf_ShutdownCallback(void *);
55 rf_ShutdownCallback(void *ignored
)
57 pool_destroy(&rf_pools
.callback
);
61 rf_ConfigureCallback(RF_ShutdownList_t
**listp
)
64 rf_pool_init(&rf_pools
.callback
, sizeof(RF_CallbackDesc_t
),
65 "rf_callbackpl", RF_MIN_FREE_CALLBACK
, RF_MAX_FREE_CALLBACK
);
66 rf_ShutdownCreate(listp
, rf_ShutdownCallback
, NULL
);
72 rf_AllocCallbackDesc(void)
76 p
= pool_get(&rf_pools
.callback
, PR_WAITOK
);
81 rf_FreeCallbackDesc(RF_CallbackDesc_t
*p
)
83 pool_put(&rf_pools
.callback
, p
);