]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - fs/pstore/internal.h
pstore: Add persistent function tracing
[mirror_ubuntu-zesty-kernel.git] / fs / pstore / internal.h
1 #ifndef __PSTORE_INTERNAL_H__
2 #define __PSTORE_INTERNAL_H__
3
4 #include <linux/pstore.h>
5
6 #if NR_CPUS <= 2 && defined(CONFIG_ARM_THUMB)
7 #define PSTORE_CPU_IN_IP 0x1
8 #elif NR_CPUS <= 4 && defined(CONFIG_ARM)
9 #define PSTORE_CPU_IN_IP 0x3
10 #endif
11
12 struct pstore_ftrace_record {
13 unsigned long ip;
14 unsigned long parent_ip;
15 #ifndef PSTORE_CPU_IN_IP
16 unsigned int cpu;
17 #endif
18 };
19
20 static inline void
21 pstore_ftrace_encode_cpu(struct pstore_ftrace_record *rec, unsigned int cpu)
22 {
23 #ifndef PSTORE_CPU_IN_IP
24 rec->cpu = cpu;
25 #else
26 rec->ip |= cpu;
27 #endif
28 }
29
30 static inline unsigned int
31 pstore_ftrace_decode_cpu(struct pstore_ftrace_record *rec)
32 {
33 #ifndef PSTORE_CPU_IN_IP
34 return rec->cpu;
35 #else
36 return rec->ip & PSTORE_CPU_IN_IP;
37 #endif
38 }
39
40 extern struct pstore_info *psinfo;
41
42 extern void pstore_set_kmsg_bytes(int);
43 extern void pstore_get_records(int);
44 extern int pstore_mkfile(enum pstore_type_id, char *psname, u64 id,
45 char *data, size_t size,
46 struct timespec time, struct pstore_info *psi);
47 extern int pstore_is_mounted(void);
48
49 #endif