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