![]() |
RTXI 1.3
|
00001 /* 00002 * linux/mutex.h compatibility header 00003 */ 00004 /* 00005 Copyright (C) 2007 Ian Abbott <abbotti@mev.co.uk> 00006 00007 Based on "FUSE: Filesystem in Userspace", 00008 Copyright (C) 2001-2007 Miklos Szeredi 00009 00010 This program is free software; you can redistribute it and/or modify 00011 it under the terms of the GNU General Public License as published by 00012 the Free Software Foundation; either version 2 of the License, or 00013 (at your option) any later version. 00014 00015 This program is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 */ 00024 00025 #ifndef __COMPAT_LINUX_MUTEX_H_ 00026 #define __COMPAT_LINUX_MUTEX_H_ 00027 00028 #include <linux/config.h> 00029 00030 #ifdef CONFIG_COMEDI_HAVE_MUTEX_H 00031 00032 #include_next <linux/mutex.h> 00033 00034 #ifndef CONFIG_DEBUG_MUTEXES 00035 #ifndef mutex_destroy 00036 /* Some Redhat kernels include a backported mutex.h, lacking mutex_destroy */ 00037 #define mutex_destroy(m) do; while (0) 00038 #endif 00039 #endif 00040 00041 #else /* HAVE_MUTEX_H */ 00042 00043 #include <asm/semaphore.h> 00044 00045 #define DEFINE_MUTEX(m) DECLARE_MUTEX(m) 00046 #define mutex_init(m) init_MUTEX(m) 00047 #define mutex_destroy(m) do; while (0) 00048 #define mutex_lock(m) down(m) 00049 #define mutex_lock_interruptible(m) down_interruptible(m) 00050 #define mutex_trylock(m) (!down_trylock(m)) 00051 #define mutex_unlock(m) up(m) 00052 /* There is some unfortunate name-space pollution in the following macro, so any 00053 * code using 'mutex' as an identifier has to be careful with include order. */ 00054 #define mutex semaphore /* "struct mutex" becomes "struct semaphore" */ 00055 00056 #endif /* HAVE_MUTEX_H */ 00057 00058 #endif /* __COMPAT_LINUX_MUTEX_H_ */