The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/raidframe/rf_threadstuff.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: rf_threadstuff.h,v 1.20 2003/12/29 06:30:42 oster Exp $        */
    2 /*
    3  * Copyright (c) 1995 Carnegie-Mellon University.
    4  * All rights reserved.
    5  *
    6  * Author: Mark Holland, Daniel Stodolsky, Jim Zelenka
    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  * threadstuff.h -- definitions for threads, locks, and synchronization
   31  *
   32  * The purpose of this file is provide some illusion of portability.
   33  * If the functions below can be implemented with the same semantics on
   34  * some new system, then at least the synchronization and thread control
   35  * part of the code should not require modification to port to a new machine.
   36  * the only other place where the pthread package is explicitly used is
   37  * threadid.h
   38  *
   39  * this file should be included above stdio.h to get some necessary defines.
   40  *
   41  */
   42 
   43 #ifndef _RF__RF_THREADSTUFF_H_
   44 #define _RF__RF_THREADSTUFF_H_
   45 
   46 #include <sys/types.h>
   47 #include <sys/param.h>
   48 #include <sys/systm.h>
   49 #include <sys/proc.h>
   50 #include <sys/kthread.h>
   51 #include <sys/lock.h>
   52 
   53 #include <dev/raidframe/raidframevar.h>
   54 
   55 #define decl_simple_lock_data(a,b) a struct simplelock b;
   56 
   57 typedef struct proc *RF_Thread_t;
   58 typedef void *RF_ThreadArg_t;
   59 
   60 #define RF_DECLARE_MUTEX(_m_)           decl_simple_lock_data(,(_m_))
   61 #define RF_DECLARE_STATIC_MUTEX(_m_)    decl_simple_lock_data(static,(_m_))
   62 #define RF_DECLARE_EXTERN_MUTEX(_m_)    decl_simple_lock_data(extern,(_m_))
   63 
   64 #define RF_DECLARE_COND(_c_)            int _c_;
   65 
   66 #define RF_LOCK_MUTEX(_m_)              simple_lock(&(_m_))
   67 #define RF_UNLOCK_MUTEX(_m_)            simple_unlock(&(_m_))
   68 
   69 
   70 /* non-spinlock */
   71 #define decl_lock_data(a,b) a struct lock b;
   72 
   73 #define RF_DECLARE_LKMGR_MUTEX(_m_)           decl_lock_data(,(_m_))
   74 #define RF_DECLARE_LKMGR_STATIC_MUTEX(_m_)    decl_lock_data(static,(_m_))
   75 #define RF_DECLARE_LKMGR_EXTERN_MUTEX(_m_)    decl_lock_data(extern,(_m_))
   76 
   77 #define RF_LOCK_LKMGR_MUTEX(_m_)        lockmgr(&(_m_),LK_EXCLUSIVE,NULL)
   78 #define RF_UNLOCK_LKMGR_MUTEX(_m_)      lockmgr(&(_m_),LK_RELEASE,NULL)
   79 
   80 
   81 /*
   82  * In NetBSD, kernel threads are simply processes which share several
   83  * substructures and never run in userspace.
   84  */
   85 #define RF_WAIT_COND(_c_,_m_)           \
   86         ltsleep(&(_c_), PRIBIO, "rfwcond", 0, &(_m_))
   87 #define RF_SIGNAL_COND(_c_)            wakeup_one(&(_c_))
   88 #define RF_BROADCAST_COND(_c_)         wakeup(&(_c_))
   89 #define RF_CREATE_THREAD(_handle_, _func_, _arg_, _name_) \
   90         kthread_create1((void (*)(void *))(_func_), (void *)(_arg_), \
   91             (struct proc **)&(_handle_), _name_)
   92 
   93 #define RF_CREATE_ENGINE_THREAD(_handle_, _func_, _arg_, _fmt_, _fmt_arg_) \
   94         kthread_create1((void (*)(void *))(_func_), (void *)(_arg_), \
   95             (struct proc **)&(_handle_), _fmt_, _fmt_arg_)
   96 
   97 #define rf_mutex_init(m) simple_lock_init(m)
   98 
   99 #endif                          /* !_RF__RF_THREADSTUFF_H_ */

Cache object: dd324deeea4ba5fb740a046bc898309d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.