Johannes Berg | 833c954 | 2014-09-12 09:01:56 +0200 | [diff] [blame^] | 1 | #ifndef __DEVCOREDUMP_H |
| 2 | #define __DEVCOREDUMP_H |
| 3 | |
| 4 | #include <linux/device.h> |
| 5 | #include <linux/module.h> |
| 6 | #include <linux/vmalloc.h> |
| 7 | |
| 8 | #ifdef CONFIG_DEV_COREDUMP |
| 9 | void dev_coredumpv(struct device *dev, const void *data, size_t datalen, |
| 10 | gfp_t gfp); |
| 11 | |
| 12 | void dev_coredumpm(struct device *dev, struct module *owner, |
| 13 | const void *data, size_t datalen, gfp_t gfp, |
| 14 | ssize_t (*read)(char *buffer, loff_t offset, size_t count, |
| 15 | const void *data, size_t datalen), |
| 16 | void (*free)(const void *data)); |
| 17 | #else |
| 18 | static inline void dev_coredumpv(struct device *dev, const void *data, |
| 19 | size_t datalen, gfp_t gfp) |
| 20 | { |
| 21 | vfree(data); |
| 22 | } |
| 23 | |
| 24 | static inline void |
| 25 | dev_coredumpm(struct device *dev, struct module *owner, |
| 26 | const void *data, size_t datalen, gfp_t gfp, |
| 27 | ssize_t (*read)(char *buffer, loff_t offset, size_t count, |
| 28 | const void *data, size_t datalen), |
| 29 | void (*free)(const void *data)) |
| 30 | { |
| 31 | free(data); |
| 32 | } |
| 33 | #endif /* CONFIG_DEV_COREDUMP */ |
| 34 | |
| 35 | #endif /* __DEVCOREDUMP_H */ |