Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / raidframe / rf_shutdown.h
blob65e6adff86aea66d8071b5abee2aef274281f556
1 /* $NetBSD: rf_shutdown.h,v 1.3.18.4 2005/03/04 16:50:08 skrll Exp $ */
2 /*
3 * rf_shutdown.h
4 */
5 /*
6 * Copyright (c) 1996 Carnegie-Mellon University.
7 * All rights reserved.
9 * Author: Jim Zelenka
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.
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.
21 * Carnegie Mellon requests users of this software to return to
23 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
24 * School of Computer Science
25 * Carnegie Mellon University
26 * Pittsburgh PA 15213-3890
28 * any improvements or extensions that they make and grant Carnegie the
29 * rights to redistribute these changes.
32 * Maintain lists of cleanup functions. Also, mechanisms for coordinating
33 * thread startup and shutdown.
36 #ifndef _RF__RF_SHUTDOWN_H_
37 #define _RF__RF_SHUTDOWN_H_
39 #include <dev/raidframe/raidframevar.h>
41 #include "rf_threadstuff.h"
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.
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;
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 **);
75 #endif /* !_RF__RF_SHUTDOWN_H_ */