1 /* $NetBSD: rf_shutdown.h,v 1.5 2004/03/09 02:15:33 oster Exp $ */
2 /*
3 * rf_shutdown.h
4 */
5 /*
6 * Copyright (c) 1996 Carnegie-Mellon University.
7 * All rights reserved.
8 *
9 * Author: Jim Zelenka
10 *
11 * Permission to use, copy, modify and distribute this software and
12 * its documentation is hereby granted, provided that both the copyright
13 * notice and this permission notice appear in all copies of the
14 * software, derivative works or modified versions, and any portions
15 * thereof, and that both notices appear in supporting documentation.
16 *
17 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
18 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
19 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
20 *
21 * Carnegie Mellon requests users of this software to return to
22 *
23 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
24 * School of Computer Science
25 * Carnegie Mellon University
26 * Pittsburgh PA 15213-3890
27 *
28 * any improvements or extensions that they make and grant Carnegie the
29 * rights to redistribute these changes.
30 */
31 /*
32 * Maintain lists of cleanup functions. Also, mechanisms for coordinating
33 * thread startup and shutdown.
34 */
35
36 #ifndef _RF__RF_SHUTDOWN_H_
37 #define _RF__RF_SHUTDOWN_H_
38
39 #include <dev/raidframe/raidframevar.h>
40
41 #include "rf_threadstuff.h"
42
43 /*
44 * Important note: the shutdown list is run like a stack, new
45 * entries pushed on top. Therefore, the most recently added
46 * entry (last started) is the first removed (stopped). This
47 * should handle system-dependencies pretty nicely- if a system
48 * is there when you start another, it'll be there when you
49 * shut down another. Hopefully, this subsystem will remove
50 * more complexity than it introduces.
51 */
52
53 struct RF_ShutdownList_s {
54 void (*cleanup) (void *arg);
55 void *arg;
56 #if RF_DEBUG_SHUTDOWN
57 char *file;
58 int line;
59 #endif
60 RF_ShutdownList_t *next;
61 };
62 #if RF_DEBUG_SHUTDOWN
63 #define rf_ShutdownCreate(_listp_,_func_,_arg_) \
64 _rf_ShutdownCreate(_listp_,_func_,_arg_,__FILE__,__LINE__)
65 void _rf_ShutdownCreate(RF_ShutdownList_t **, void (*cleanup) (void *),
66 void *, char *, int);
67 #else
68 #define rf_ShutdownCreate(_listp_,_func_,_arg_) \
69 _rf_ShutdownCreate(_listp_,_func_,_arg_)
70 void _rf_ShutdownCreate(RF_ShutdownList_t **, void (*cleanup) (void *),
71 void *);
72 #endif
73 void rf_ShutdownList(RF_ShutdownList_t **);
74
75 #endif /* !_RF__RF_SHUTDOWN_H_ */
Cache object: fdad6dcb16a6444d7475a82030b63f40
|