ia64/xen-unstable

changeset 11985:ecc1782f6968

PV-on-HVM: Add a compatibility linux/mutex.h for kernels before
2.6.16. This implements the new mutex type in terms of the old
semaphore type.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
Signed-off-by: K. Y. Srinivasan <ksrinivasan@novell.com>
Signed-off-by: Tsunehisa Doi <Doi.Tsunehisa@jp.fujitsu.com>
author Ian Campbell <ian.campbell@xensource.com>
date Wed Oct 25 13:58:30 2006 +0100 (2006-10-25)
parents d008b6b44f3c
children e09720caf72d
files unmodified_drivers/linux-2.6/compat-include/linux/mutex.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/unmodified_drivers/linux-2.6/compat-include/linux/mutex.h	Wed Oct 25 13:58:30 2006 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +/*
     1.5 + * Copyright (c) 2006 Cisco Systems.  All rights reserved.
     1.6 + *
     1.7 + * This file is released under the GPLv2.
     1.8 + */
     1.9 +
    1.10 +/* mutex compatibility for pre-2.6.16 kernels */
    1.11 +
    1.12 +#ifndef __LINUX_MUTEX_H
    1.13 +#define __LINUX_MUTEX_H
    1.14 +
    1.15 +#include <linux/version.h>
    1.16 +
    1.17 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
    1.18 +#error "This version of Linux should not need compat mutex.h"
    1.19 +#endif
    1.20 +
    1.21 +#include <linux/version.h>
    1.22 +#include <asm/semaphore.h>
    1.23 +
    1.24 +#define mutex semaphore
    1.25 +#define DEFINE_MUTEX(foo) DECLARE_MUTEX(foo)
    1.26 +#define mutex_init(foo) init_MUTEX(foo)
    1.27 +#define mutex_lock(foo) down(foo)
    1.28 +#define mutex_lock_interruptible(foo) down_interruptible(foo)
    1.29 +/* this function follows the spin_trylock() convention, so        *
    1.30 + * it is negated to the down_trylock() return values! Be careful  */
    1.31 +#define mutex_trylock(foo) !down_trylock(foo)
    1.32 +#define mutex_unlock(foo) up(foo)
    1.33 +
    1.34 +#endif /* __LINUX_MUTEX_H */