From 925a6287c8c5c8b3f565cf25fd920eb853ba262e Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 12 Dec 2007 14:47:20 +0000 Subject: [PATCH] Added compatibility header for . --- include/linux/Makefile.am | 2 +- include/linux/mutex.h | 56 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 include/linux/mutex.h diff --git a/include/linux/Makefile.am b/include/linux/Makefile.am index 925d5a53..0c198053 100644 --- a/include/linux/Makefile.am +++ b/include/linux/Makefile.am @@ -1,4 +1,4 @@ noinst_HEADERS=comedidev.h comedi.h comedilib.h comedi_rt.h compiler.h config.h delay.h device.h \ - interrupt.h isapnp.h kernel.h kref.h mm.h mod_devicetable.h module.h moduleparam.h pci.h \ + interrupt.h isapnp.h kernel.h kref.h mm.h mod_devicetable.h module.h moduleparam.h mutex.h pci.h \ pci_ids.h pnp.h sched.h slab.h stddef.h time.h types.h usb.h version.h wrapper.h diff --git a/include/linux/mutex.h b/include/linux/mutex.h new file mode 100644 index 00000000..90218156 --- /dev/null +++ b/include/linux/mutex.h @@ -0,0 +1,56 @@ +/* + * linux/mutex.h compatibility header + */ +/* + Copyright (C) 2007 Ian Abbott + + Based on "FUSE: Filesystem in Userspace", + Copyright (C) 2001-2007 Miklos Szeredi + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef __COMPAT_LINUX_MUTEX_H_ +#define __COMPAT_LINUX_MUTEX_H_ + +#ifdef HAVE_MUTEX_H + +#include_next + +#ifndef CONFIG_DEBUG_MUTEXES +#ifndef mutex_destroy +/* Some Redhat kernels include a backported mutex.h, lacking mutex_destroy */ +#define mutex_destroy(m) do; while (0) +#endif +#endif + +#else /* HAVE_MUTEX_H */ + +#include + +#define DEFINE_MUTEX(m) DECLARE_MUTEX(m) +#define mutex_init(m) init_MUTEX(m) +#define mutex_destroy(m) do; while (0) +#define mutex_lock(m) down(m) +#define mutex_lock_interruptible(m) down_interruptible(m) +#define mutex_trylock(m) (!down_trylock(m)) +#define mutex_unlock(m) up(m) +/* There is some unfortunate name-space pollution in the following macro, so any + * code using 'mutex' as an identifier has to be careful with include order. */ +#define mutex semaphore /* "struct mutex" becomes "struct semaphore" */ + +#endif /* HAVE_MUTEX_H */ + +#endif /* __COMPAT_LINUX_MUTEX_H_ */ -- 2.26.2