~ubuntu-branches/ubuntu/precise/linux-ti-omap/precise

« back to all changes in this revision

Viewing changes to ubuntu/ndiswrapper/wrapmem.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (C) 2006 Giridhar Pemmasani
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 */
 
15
 
 
16
#ifndef _WRAPMEM_H_
 
17
 
 
18
/* set ALLOC_DEBUG to 1 to get information about memory used by both
 
19
 * ndiswrapper and Windows driver by reading
 
20
 * /proc/net/ndiswrapper/debug; this will also show memory leaks
 
21
 * (memory allocated but not freed) when ndiswrapper module is
 
22
 * unloaded.
 
23
 
 
24
 * ALLOC_DEBUG=2: details about individual allocations leaking is printed
 
25
 * ALLOC_DEBUG=3: tags in ExAllocatePoolWithTag leaking printed
 
26
*/
 
27
 
 
28
//#ifndef ALLOC_DEBUG
 
29
//#define ALLOC_DEBUG 1
 
30
//#endif
 
31
 
 
32
enum alloc_type { ALLOC_TYPE_KMALLOC_ATOMIC, ALLOC_TYPE_KMALLOC_NON_ATOMIC,
 
33
                  ALLOC_TYPE_VMALLOC_ATOMIC, ALLOC_TYPE_VMALLOC_NON_ATOMIC,
 
34
                  ALLOC_TYPE_SLACK, ALLOC_TYPE_PAGES, ALLOC_TYPE_MAX };
 
35
 
 
36
int wrapmem_init(void);
 
37
void wrapmem_exit(void);
 
38
void *slack_kmalloc(size_t size);
 
39
void slack_kfree(void *ptr);
 
40
void wrapmem_info(void);
 
41
 
 
42
#ifdef ALLOC_DEBUG
 
43
void *wrap_kmalloc(size_t size, gfp_t flags, const char *file, int line);
 
44
void *wrap_kzalloc(size_t size, gfp_t flags, const char *file, int line);
 
45
void wrap_kfree(void *ptr);
 
46
void *wrap_vmalloc(unsigned long size, const char *file, int line);
 
47
void *wrap__vmalloc(unsigned long size, gfp_t flags, pgprot_t prot,
 
48
                    const char *file, int line);
 
49
void wrap_vfree(void *ptr);
 
50
void *wrap_alloc_pages(gfp_t flags, unsigned int size,
 
51
                       const char *file, int line);
 
52
void wrap_free_pages(unsigned long ptr, int order);
 
53
int alloc_size(enum alloc_type type);
 
54
 
 
55
#ifndef _WRAPMEM_C_
 
56
#undef kmalloc
 
57
#undef kzalloc
 
58
#undef kfree
 
59
#undef vmalloc
 
60
#undef __vmalloc
 
61
#undef vfree
 
62
#define kmalloc(size, flags)                            \
 
63
        wrap_kmalloc(size, flags, __FILE__, __LINE__)
 
64
#define kzalloc(size, flags)                            \
 
65
        wrap_kzalloc(size, flags, __FILE__, __LINE__)
 
66
#define vmalloc(size)                           \
 
67
        wrap_vmalloc(size, __FILE__, __LINE__)
 
68
#define __vmalloc(size, flags, prot)                            \
 
69
        wrap__vmalloc(size, flags, prot, __FILE__, __LINE__)
 
70
#define kfree(ptr) wrap_kfree(ptr)
 
71
#define vfree(ptr) wrap_vfree(ptr)
 
72
 
 
73
#define wrap_get_free_pages(flags, size)                        \
 
74
        wrap_alloc_pages(flags, size, __FILE__, __LINE__)
 
75
#undef free_pages
 
76
#define free_pages(ptr, order) wrap_free_pages(ptr, order)
 
77
 
 
78
#if ALLOC_DEBUG > 1
 
79
void *wrap_ExAllocatePoolWithTag(enum pool_type pool_type, SIZE_T size,
 
80
                                 ULONG tag, const char *file, int line);
 
81
#define ExAllocatePoolWithTag(pool_type, size, tag)                     \
 
82
        wrap_ExAllocatePoolWithTag(pool_type, size, tag, __FILE__, __LINE__)
 
83
#endif
 
84
 
 
85
#endif // _WRAPMEM_C_
 
86
 
 
87
#else
 
88
 
 
89
#define wrap_get_free_pages(flags, size)                        \
 
90
        (void *)__get_free_pages(flags, get_order(size))
 
91
 
 
92
#endif // ALLOC_DEBUG
 
93
 
 
94
#endif