Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 1 | #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 |
| 8 | extern int kmemcheck_enabled; |
| 9 | |
Vegard Nossum | 2dff440 | 2008-05-31 15:56:17 +0200 | [diff] [blame] | 10 | /* The slab-related functions. */ |
| 11 | void kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node, |
| 12 | struct page *page, int order); |
| 13 | void kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order); |
| 14 | void kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, |
| 15 | size_t size); |
| 16 | void kmemcheck_slab_free(struct kmem_cache *s, void *object, size_t size); |
| 17 | |
| 18 | void kmemcheck_show_pages(struct page *p, unsigned int n); |
| 19 | void kmemcheck_hide_pages(struct page *p, unsigned int n); |
| 20 | |
| 21 | bool kmemcheck_page_is_tracked(struct page *p); |
| 22 | |
| 23 | void kmemcheck_mark_unallocated(void *address, unsigned int n); |
| 24 | void kmemcheck_mark_uninitialized(void *address, unsigned int n); |
| 25 | void kmemcheck_mark_initialized(void *address, unsigned int n); |
| 26 | void kmemcheck_mark_freed(void *address, unsigned int n); |
| 27 | |
| 28 | void kmemcheck_mark_unallocated_pages(struct page *p, unsigned int n); |
| 29 | void kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n); |
| 30 | |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 31 | int kmemcheck_show_addr(unsigned long address); |
| 32 | int kmemcheck_hide_addr(unsigned long address); |
| 33 | #else |
| 34 | #define kmemcheck_enabled 0 |
| 35 | |
Vegard Nossum | 2dff440 | 2008-05-31 15:56:17 +0200 | [diff] [blame] | 36 | static inline void |
| 37 | kmemcheck_alloc_shadow(struct kmem_cache *s, gfp_t flags, int node, |
| 38 | struct page *page, int order) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | static inline void |
| 43 | kmemcheck_free_shadow(struct kmem_cache *s, struct page *page, int order) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | static inline void |
| 48 | kmemcheck_slab_alloc(struct kmem_cache *s, gfp_t gfpflags, void *object, |
| 49 | size_t size) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | static inline void kmemcheck_slab_free(struct kmem_cache *s, void *object, |
| 54 | size_t size) |
| 55 | { |
| 56 | } |
| 57 | |
| 58 | static inline bool kmemcheck_page_is_tracked(struct page *p) |
| 59 | { |
| 60 | return false; |
| 61 | } |
Vegard Nossum | d700285 | 2008-07-20 10:44:54 +0200 | [diff] [blame^] | 62 | |
| 63 | static inline void kmemcheck_mark_unallocated(void *address, unsigned int n) |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | static inline void kmemcheck_mark_uninitialized(void *address, unsigned int n) |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | static inline void kmemcheck_mark_initialized(void *address, unsigned int n) |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | static inline void kmemcheck_mark_freed(void *address, unsigned int n) |
| 76 | { |
| 77 | } |
Vegard Nossum | dfec072 | 2008-04-04 00:51:41 +0200 | [diff] [blame] | 78 | #endif /* CONFIG_KMEMCHECK */ |
| 79 | |
| 80 | #endif /* LINUX_KMEMCHECK_H */ |