diff options
Diffstat (limited to 'include/litmus/litmus_proc.h')
-rw-r--r-- | include/litmus/litmus_proc.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/include/litmus/litmus_proc.h b/include/litmus/litmus_proc.h new file mode 100644 index 000000000000..a5db24c03ec0 --- /dev/null +++ b/include/litmus/litmus_proc.h | |||
@@ -0,0 +1,63 @@ | |||
1 | #include <litmus/sched_plugin.h> | ||
2 | #include <linux/proc_fs.h> | ||
3 | |||
4 | int __init init_litmus_proc(void); | ||
5 | void exit_litmus_proc(void); | ||
6 | |||
7 | struct cd_mapping | ||
8 | { | ||
9 | int id; | ||
10 | cpumask_var_t mask; | ||
11 | struct proc_dir_entry *proc_file; | ||
12 | }; | ||
13 | |||
14 | struct domain_proc_info | ||
15 | { | ||
16 | int num_cpus; | ||
17 | int num_domains; | ||
18 | |||
19 | struct cd_mapping *cpu_to_domains; | ||
20 | struct cd_mapping *domain_to_cpus; | ||
21 | }; | ||
22 | |||
23 | /* | ||
24 | * On success, returns 0 and sets the pointer to the location of the new | ||
25 | * proc dir entry, otherwise returns an error code and sets pde to NULL. | ||
26 | */ | ||
27 | long make_plugin_proc_dir(struct sched_plugin* plugin, | ||
28 | struct proc_dir_entry** pde); | ||
29 | |||
30 | /* | ||
31 | * Plugins should deallocate all child proc directory entries before | ||
32 | * calling this, to avoid memory leaks. | ||
33 | */ | ||
34 | void remove_plugin_proc_dir(struct sched_plugin* plugin); | ||
35 | |||
36 | /* | ||
37 | * Setup the CPU <-> sched domain mappings in proc | ||
38 | */ | ||
39 | long activate_domain_proc(struct domain_proc_info* map); | ||
40 | |||
41 | /* | ||
42 | * Remove the CPU <-> sched domain mappings from proc | ||
43 | */ | ||
44 | long deactivate_domain_proc(void); | ||
45 | |||
46 | /* | ||
47 | * Alloc memory for the mapping | ||
48 | * Note: Does not set up proc files. Use make_sched_domain_maps for that. | ||
49 | */ | ||
50 | long init_domain_proc_info(struct domain_proc_info* map, | ||
51 | int num_cpus, int num_domains); | ||
52 | |||
53 | /* | ||
54 | * Free memory of the mapping | ||
55 | * Note: Does not clean up proc files. Use deactivate_domain_proc for that. | ||
56 | */ | ||
57 | void destroy_domain_proc_info(struct domain_proc_info* map); | ||
58 | |||
59 | /* Copy at most size-1 bytes from ubuf into kbuf, null-terminate buf, and | ||
60 | * remove a '\n' if present. Returns the number of bytes that were read or | ||
61 | * -EFAULT. */ | ||
62 | int copy_and_chomp(char *kbuf, unsigned long ksize, | ||
63 | __user const char* ubuf, unsigned long ulength); | ||