aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/litmus_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/litmus_proc.c')
-rw-r--r--litmus/litmus_proc.c70
1 files changed, 2 insertions, 68 deletions
diff --git a/litmus/litmus_proc.c b/litmus/litmus_proc.c
index ee0ad56d445c..c10a6a6d3975 100644
--- a/litmus/litmus_proc.c
+++ b/litmus/litmus_proc.c
@@ -4,6 +4,7 @@
4 4
5#include <linux/uaccess.h> 5#include <linux/uaccess.h>
6 6
7#include <litmus/litmus.h>
7#include <litmus/litmus_proc.h> 8#include <litmus/litmus_proc.h>
8 9
9/* in litmus/litmus.c */ 10/* in litmus/litmus.c */
@@ -13,11 +14,10 @@ static struct proc_dir_entry *litmus_dir = NULL,
13 *curr_file = NULL, 14 *curr_file = NULL,
14 *stat_file = NULL, 15 *stat_file = NULL,
15 *plugs_dir = NULL, 16 *plugs_dir = NULL,
16 *plugs_file = NULL,
17#ifdef CONFIG_RELEASE_MASTER 17#ifdef CONFIG_RELEASE_MASTER
18 *release_master_file = NULL, 18 *release_master_file = NULL,
19#endif 19#endif
20 *clus_cache_idx_file = NULL; 20 *plugs_file = NULL;
21 21
22/* in litmus/sync.c */ 22/* in litmus/sync.c */
23int count_tasks_waiting_for_release(void); 23int count_tasks_waiting_for_release(void);
@@ -93,60 +93,6 @@ static int proc_write_curr(struct file *file,
93 return len; 93 return len;
94} 94}
95 95
96static int proc_read_cluster_size(char *page, char **start,
97 off_t off, int count,
98 int *eof, void *data)
99{
100 int len;
101 if (cluster_cache_index == 2)
102 len = snprintf(page, PAGE_SIZE, "L2\n");
103 else if (cluster_cache_index == 3)
104 len = snprintf(page, PAGE_SIZE, "L3\n");
105 else if (cluster_cache_index == 1)
106 len = snprintf(page, PAGE_SIZE, "L1\n");
107 else
108 len = snprintf(page, PAGE_SIZE, "ALL\n");
109
110 return len;
111}
112
113static int proc_write_cluster_size(struct file *file,
114 const char *buffer,
115 unsigned long count,
116 void *data)
117{
118 int len;
119 /* L2, L3 */
120 char cache_name[33];
121
122 if(count > 32)
123 len = 32;
124 else
125 len = count;
126
127 if(copy_from_user(cache_name, buffer, len))
128 return -EFAULT;
129
130 cache_name[len] = '\0';
131 /* chomp name */
132 if (len > 1 && cache_name[len - 1] == '\n')
133 cache_name[len - 1] = '\0';
134
135 /* do a quick and dirty comparison to find the cluster size */
136 if (!strcmp(cache_name, "L2"))
137 cluster_cache_index = 2;
138 else if (!strcmp(cache_name, "L3"))
139 cluster_cache_index = 3;
140 else if (!strcmp(cache_name, "L1"))
141 cluster_cache_index = 1;
142 else if (!strcmp(cache_name, "ALL"))
143 cluster_cache_index = num_online_cpus();
144 else
145 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name);
146
147 return len;
148}
149
150#ifdef CONFIG_RELEASE_MASTER 96#ifdef CONFIG_RELEASE_MASTER
151static int proc_read_release_master(char *page, char **start, 97static int proc_read_release_master(char *page, char **start,
152 off_t off, int count, 98 off_t off, int count,
@@ -229,16 +175,6 @@ int __init init_litmus_proc(void)
229 release_master_file->write_proc = proc_write_release_master; 175 release_master_file->write_proc = proc_write_release_master;
230#endif 176#endif
231 177
232 clus_cache_idx_file = create_proc_entry("cluster_cache",
233 0644, litmus_dir);
234 if (!clus_cache_idx_file) {
235 printk(KERN_ERR "Could not allocate cluster_cache "
236 "procfs entry.\n");
237 return -ENOMEM;
238 }
239 clus_cache_idx_file->read_proc = proc_read_cluster_size;
240 clus_cache_idx_file->write_proc = proc_write_cluster_size;
241
242 stat_file = create_proc_read_entry("stats", 0444, litmus_dir, 178 stat_file = create_proc_read_entry("stats", 0444, litmus_dir,
243 proc_read_stats, NULL); 179 proc_read_stats, NULL);
244 180
@@ -265,8 +201,6 @@ void exit_litmus_proc(void)
265 remove_proc_entry("stats", litmus_dir); 201 remove_proc_entry("stats", litmus_dir);
266 if (curr_file) 202 if (curr_file)
267 remove_proc_entry("active_plugin", litmus_dir); 203 remove_proc_entry("active_plugin", litmus_dir);
268 if (clus_cache_idx_file)
269 remove_proc_entry("cluster_cache", litmus_dir);
270#ifdef CONFIG_RELEASE_MASTER 204#ifdef CONFIG_RELEASE_MASTER
271 if (release_master_file) 205 if (release_master_file)
272 remove_proc_entry("release_master", litmus_dir); 206 remove_proc_entry("release_master", litmus_dir);