blob: 71f21ae33d1df54002ae12f2b20ba8deddf7dacb [file] [log] [blame]
Vegard Nossumdfec0722008-04-04 00:51:41 +02001#ifndef LINUX_KMEMCHECK_H
2#define LINUX_KMEMCHECK_H
3
4#include <linux/mm_types.h>
5#include <linux/types.h>
6
7#ifdef CONFIG_KMEMCHECK
8extern int kmemcheck_enabled;
9
Vegard Nossum2dff4402008-05-31 15:56:17 +020010/* The slab-related functions. */
11void kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node,
12 struct page *page, int order);
13void kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order);
14void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
15 size_t size);
16void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size);
17
18void kmemcheck_show_pages(struct page *p, unsigned int n);
19void kmemcheck_hide_pages(struct page *p, unsigned int n);
20
21bool kmemcheck_page_is_tracked(struct page *p);
22
23void kmemcheck_mark_unallocated(void *address, unsigned int n);
24void kmemcheck_mark_uninitialized(void *address, unsigned int n);
25void kmemcheck_mark_initialized(void *address, unsigned int n);
26void kmemcheck_mark_freed(void *address, unsigned int n);
27
28void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n);
29void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n);
30
Vegard Nossumdfec0722008-04-04 00:51:41 +020031int kmemcheck_show_addr(unsigned long address);
32int kmemcheck_hide_addr(unsigned long address);
33#else
34#define kmemcheck_enabled 0
35
Vegard Nossum2dff4402008-05-31 15:56:17 +020036static inline void
37kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node,
38 struct page *page, int order)
39{
40}
41
42static inline void
43kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order)
44{
45}
46
47static inline void
48kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object,
49 size_t size)
50{
51}
52
53static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object,
54 size_t size)
55{
56}
57
58static inline bool kmemcheck_page_is_tracked(struct page *p)
59{
60 return false;
61}
Vegard Nossumd7002852008-07-20 10:44:54 +020062
63static inline void kmemcheck_mark_unallocated(void *address, unsigned int n)
64{
65}
66
67static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n)
68{
69}
70
71static inline void kmemcheck_mark_initialized(void *address, unsigned int n)
72{
73}
74
75static inline void kmemcheck_mark_freed(void *address, unsigned int n)
76{
77}
Vegard Nossumdfec0722008-04-04 00:51:41 +020078#endif /* CONFIG_KMEMCHECK */
79
80#endif /* LINUX_KMEMCHECK_H */