Home | History | Annotate | Line # | Download | only in raidframe
rf_shutdown.h revision 1.3
      1 /*	$NetBSD: rf_shutdown.h,v 1.3 2001/10/04 15:58:56 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 (at) 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 	char   *file;
     57 	int     line;
     58 	RF_ShutdownList_t *next;
     59 };
     60 #define rf_ShutdownCreate(_listp_,_func_,_arg_) \
     61   _rf_ShutdownCreate(_listp_,_func_,_arg_,__FILE__,__LINE__)
     62 
     63 int     _rf_ShutdownCreate(RF_ShutdownList_t ** listp, void (*cleanup) (void *arg),
     64             void *arg, char *file, int line);
     65 int     rf_ShutdownList(RF_ShutdownList_t ** listp);
     66 
     67 #endif				/* !_RF__RF_SHUTDOWN_H_ */
     68