2 * This file is part of the SPL: Solaris Porting Layer.
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef _SPL_CONDVAR_H
28 #define _SPL_CONDVAR_H
34 #include <linux/module.h>
35 #include <linux/wait.h>
36 #include <sys/mutex.h>
38 /* The kcondvar_t struct is protected by mutex taken externally before
39 * calling any of the wait/signal funs, and passed into the wait funs.
41 #define CV_MAGIC 0x346545f4
42 #define CV_POISON 0x95
48 wait_queue_head_t cv_event
;
54 typedef enum { CV_DEFAULT
=0, CV_DRIVER
} kcv_type_t
;
56 extern void __cv_init(kcondvar_t
*cvp
, char *name
, kcv_type_t type
, void *arg
);
57 extern void __cv_destroy(kcondvar_t
*cvp
);
58 extern void __cv_wait(kcondvar_t
*cvp
, kmutex_t
*mp
);
59 extern clock_t __cv_timedwait(kcondvar_t
*cvp
, kmutex_t
*mp
,
61 extern void __cv_signal(kcondvar_t
*cvp
);
62 extern void __cv_broadcast(kcondvar_t
*cvp
);
64 #define cv_init(cvp, name, type, arg) \
67 __cv_init(cvp, #cvp, type, arg); \
69 __cv_init(cvp, name, type, arg); \
71 #define cv_destroy(cvp) __cv_destroy(cvp)
72 #define cv_wait(cvp, mp) __cv_wait(cvp, mp)
73 #define cv_timedwait(cvp, mp, t) __cv_timedwait(cvp, mp, t)
74 #define cv_signal(cvp) __cv_signal(cvp)
75 #define cv_broadcast(cvp) __cv_broadcast(cvp)
77 #endif /* _SPL_CONDVAR_H */