xref: /netbsd-src/sys/dev/raidframe/rf_callback.h (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1 /*	$NetBSD: rf_callback.h,v 1.7 2019/10/10 03:43:59 christos Exp $	*/
2 /*
3  * Copyright (c) 1995 Carnegie-Mellon University.
4  * All rights reserved.
5  *
6  * Author: Mark Holland
7  *
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.
13  *
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.
17  *
18  * Carnegie Mellon requests users of this software to return to
19  *
20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
21  *  School of Computer Science
22  *  Carnegie Mellon University
23  *  Pittsburgh PA 15213-3890
24  *
25  * any improvements or extensions that they make and grant Carnegie the
26  * rights to redistribute these changes.
27  */
28 
29 /*****************************************************************************************
30  *
31  * callback.h -- header file for callback.c
32  *
33  * the reconstruction code must manage concurrent I/Os on multiple drives.
34  * it sometimes needs to suspend operation on a particular drive until some
35  * condition occurs.  we can't block the thread, of course, or we wouldn't
36  * be able to manage our other outstanding I/Os.  Instead we just suspend
37  * new activity on the indicated disk, and create a callback descriptor and
38  * put it someplace where it will get invoked when the condition that's
39  * stalling us has cleared.  When the descriptor is invoked, it will call
40  * a function that will restart operation on the indicated disk.
41  *
42  ****************************************************************************************/
43 
44 #ifndef _RF__RF_CALLBACK_H_
45 #define _RF__RF_CALLBACK_H_
46 
47 #include <dev/raidframe/raidframevar.h>
48 
49 struct RF_CallbackFuncDesc_s {
50 	void    (*callbackFunc) (void *);	/* function to call */
51 	void *callbackArg;	/* args to give to function, or just
52 				 * info about this callback  */
53 	RF_CallbackFuncDesc_t *next;/* next entry in list */
54 };
55 
56 struct RF_CallbackValueDesc_s {
57 	RF_uint64 v;
58 	RF_RowCol_t col;	/* column IDs to give to the callback func */
59 	RF_CallbackValueDesc_t *next;/* next entry in list */
60 };
61 
62 int     rf_ConfigureCallback(RF_ShutdownList_t ** listp);
63 RF_CallbackFuncDesc_t *rf_AllocCallbackFuncDesc(void);
64 void    rf_FreeCallbackFuncDesc(RF_CallbackFuncDesc_t * p);
65 RF_CallbackValueDesc_t *rf_AllocCallbackValueDesc(void);
66 void    rf_FreeCallbackValueDesc(RF_CallbackValueDesc_t * p);
67 
68 #endif				/* !_RF__RF_CALLBACK_H_ */
69