~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to modules/linux/vsock/include/compat_slab.h

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2008-08-15 21:21:40 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080815212140-05fhxj8wroosysmj
Tags: 2008.08.08-109361-1ubuntu1
* Merge from Debian unstable (LP: #258393), remaining Ubuntu change:
  - add ubuntu_toolchain_FTBFS.dpatch patch, fix FTBFS
* Update ubuntu_toolchain_FTBFS.dpatch patch for the new version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*********************************************************
 
2
 * Copyright (C) 2005 VMware, Inc. All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License as published by the
 
6
 * Free Software Foundation version 2 and no later version.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
10
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 
11
 * for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
15
 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
16
 *
 
17
 *********************************************************/
 
18
 
 
19
#ifndef __COMPAT_SLAB_H__
 
20
#   define __COMPAT_SLAB_H__
 
21
 
 
22
 
 
23
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 2, 0)
 
24
#   include <linux/slab.h>
 
25
#else
 
26
#   include <linux/malloc.h>
 
27
#endif
 
28
 
 
29
/*
 
30
 * Before 2.6.20, kmem_cache_t was the accepted way to refer to a kmem_cache
 
31
 * structure.  Prior to 2.6.15, this structure was called kmem_cache_s, and
 
32
 * afterwards it was renamed to kmem_cache.  Here we keep things simple and use
 
33
 * the accepted typedef until it became deprecated, at which point we switch
 
34
 * over to the kmem_cache name.
 
35
 */
 
36
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)
 
37
#   define compat_kmem_cache struct kmem_cache
 
38
#else
 
39
#   define compat_kmem_cache kmem_cache_t
 
40
#endif
 
41
 
 
42
/*
 
43
 * Up to 2.6.22 kmem_cache_create has 6 arguments - name, size, alignment, flags,
 
44
 * constructor, and destructor.  Then for some time kernel was asserting that
 
45
 * destructor is NULL, and since 2.6.23-pre1 kmem_cache_create takes only 5
 
46
 * arguments - destructor is gone.
 
47
 */
 
48
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
 
49
#define compat_kmem_cache_create(name, size, align, flags, ctor) \
 
50
                kmem_cache_create(name, size, align, flags, ctor, NULL)
 
51
#else
 
52
#define compat_kmem_cache_create(name, size, align, flags, ctor) \
 
53
                kmem_cache_create(name, size, align, flags, ctor)
 
54
#endif
 
55
 
 
56
/*
 
57
 * Up to 2.6.23 kmem_cache constructor has three arguments - pointer to block to
 
58
 * prepare (aka "this"), from which cache it came, and some unused flags.  After
 
59
 * 2.6.23 flags were removed, and order of "this" and cache parameters was swapped...
 
60
 */
 
61
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23) && !defined(VMW_KMEMCR_CTOR_HAS_3_ARGS)
 
62
#  define VMW_KMEMCR_CTOR_HAS_3_ARGS
 
63
#endif
 
64
#ifdef VMW_KMEMCR_CTOR_HAS_3_ARGS
 
65
typedef void compat_kmem_cache_ctor(void *, compat_kmem_cache *, unsigned long);
 
66
#else
 
67
typedef void compat_kmem_cache_ctor(compat_kmem_cache *, void *);
 
68
#endif
 
69
 
 
70
#endif /* __COMPAT_SLAB_H__ */