aboutsummaryrefslogtreecommitdiffstats
path: root/include/litmus/litmus_proc.h
blob: a5db24c03ec010bca728b913437c104667eae066 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <litmus/sched_plugin.h>
#include <linux/proc_fs.h>

int __init init_litmus_proc(void);
void exit_litmus_proc(void);

struct cd_mapping
{
	int id;
	cpumask_var_t mask;
	struct proc_dir_entry *proc_file;
};

struct domain_proc_info
{
	int num_cpus;
	int num_domains;

	struct cd_mapping *cpu_to_domains;
	struct cd_mapping *domain_to_cpus;
};

/*
 * On success, returns 0 and sets the pointer to the location of the new
 * proc dir entry, otherwise returns an error code and sets pde to NULL.
 */
long make_plugin_proc_dir(struct sched_plugin* plugin,
		struct proc_dir_entry** pde);

/*
 * Plugins should deallocate all child proc directory entries before
 * calling this, to avoid memory leaks.
 */
void remove_plugin_proc_dir(struct sched_plugin* plugin);

/*
 * Setup the CPU <-> sched domain mappings in proc
 */
long activate_domain_proc(struct domain_proc_info* map);

/*
 * Remove the CPU <-> sched domain mappings from proc
 */
long deactivate_domain_proc(void);

/*
 * Alloc memory for the mapping
 * Note: Does not set up proc files. Use make_sched_domain_maps for that.
 */
long init_domain_proc_info(struct domain_proc_info* map,
	int num_cpus, int num_domains);

/*
 * Free memory of the mapping
 * Note: Does not clean up proc files. Use deactivate_domain_proc for that.
 */
void destroy_domain_proc_info(struct domain_proc_info* map);

/* Copy at most size-1 bytes from ubuf into kbuf, null-terminate buf, and
 * remove a '\n' if present. Returns the number of bytes that were read or
 * -EFAULT. */
int copy_and_chomp(char *kbuf, unsigned long ksize,
		   __user const char* ubuf, unsigned long ulength);