Staging: batman-adv: atomic variable for vis-srv activation
[safe/jmp/linux-2.6] / drivers / staging / batman-adv / proc.c
1 /*
2  * Copyright (C) 2007-2009 B.A.T.M.A.N. contributors:
3  *
4  * Marek Lindner, Simon Wunderlich
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of version 2 of the GNU General Public
8  * License as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA
19  *
20  */
21
22 #include "main.h"
23 #include "proc.h"
24 #include "routing.h"
25 #include "translation-table.h"
26 #include "hard-interface.h"
27 #include "types.h"
28 #include "hash.h"
29 #include "vis.h"
30
31 static struct proc_dir_entry *proc_batman_dir, *proc_interface_file;
32 static struct proc_dir_entry *proc_orig_interval_file, *proc_originators_file;
33 static struct proc_dir_entry *proc_transt_local_file;
34 static struct proc_dir_entry *proc_transt_global_file;
35 static struct proc_dir_entry *proc_vis_srv_file, *proc_vis_data_file;
36 static struct proc_dir_entry *proc_aggr_file;
37
38 static int proc_interfaces_read(struct seq_file *seq, void *offset)
39 {
40         struct batman_if *batman_if;
41
42         rcu_read_lock();
43         list_for_each_entry_rcu(batman_if, &if_list, list) {
44                 seq_printf(seq, "[%8s] %s %s \n",
45                            (batman_if->if_active == IF_ACTIVE ?
46                             "active" : "inactive"),
47                            batman_if->dev,
48                            (batman_if->if_active == IF_ACTIVE ?
49                             batman_if->addr_str : " "));
50         }
51         rcu_read_unlock();
52
53         return 0;
54 }
55
56 static int proc_interfaces_open(struct inode *inode, struct file *file)
57 {
58         return single_open(file, proc_interfaces_read, NULL);
59 }
60
61 static ssize_t proc_interfaces_write(struct file *instance,
62                                      const char __user *userbuffer,
63                                      size_t count, loff_t *data)
64 {
65         char *if_string, *colon_ptr = NULL, *cr_ptr = NULL;
66         int not_copied = 0, if_num = 0;
67         struct batman_if *batman_if = NULL;
68
69         if_string = kmalloc(count, GFP_KERNEL);
70
71         if (!if_string)
72                 return -ENOMEM;
73
74         if (count > IFNAMSIZ - 1) {
75                 printk(KERN_WARNING "batman-adv:Can't add interface: device name is too long\n");
76                 goto end;
77         }
78
79         not_copied = copy_from_user(if_string, userbuffer, count);
80         if_string[count - not_copied - 1] = 0;
81
82         colon_ptr = strchr(if_string, ':');
83         if (colon_ptr)
84                 *colon_ptr = 0;
85
86         if (!colon_ptr) {
87                 cr_ptr = strchr(if_string, '\n');
88                 if (cr_ptr)
89                         *cr_ptr = 0;
90         }
91
92         if (strlen(if_string) == 0) {
93                 shutdown_module();
94                 num_ifs = 0;
95                 goto end;
96         }
97
98         /* add interface */
99         rcu_read_lock();
100         list_for_each_entry_rcu(batman_if, &if_list, list) {
101                 if (strncmp(batman_if->dev, if_string, count) == 0) {
102                         printk(KERN_ERR "batman-adv:Given interface is already active: %s\n", if_string);
103                         rcu_read_unlock();
104                         goto end;
105
106                 }
107
108                 if_num++;
109         }
110         rcu_read_unlock();
111
112         hardif_add_interface(if_string, if_num);
113
114         if ((atomic_read(&module_state) == MODULE_INACTIVE) &&
115             (hardif_get_active_if_num() > 0))
116                 activate_module();
117
118         rcu_read_lock();
119         if (list_empty(&if_list)) {
120                 rcu_read_unlock();
121                 goto end;
122         }
123         rcu_read_unlock();
124
125         num_ifs = if_num + 1;
126         return count;
127
128 end:
129         kfree(if_string);
130         return count;
131 }
132
133 static int proc_orig_interval_read(struct seq_file *seq, void *offset)
134 {
135         seq_printf(seq, "%i\n", atomic_read(&originator_interval));
136
137         return 0;
138 }
139
140 static ssize_t proc_orig_interval_write(struct file *file,
141                                         const char __user *buffer,
142                                         size_t count, loff_t *ppos)
143 {
144         char *interval_string;
145         int not_copied = 0;
146         unsigned long originator_interval_tmp;
147         int retval;
148
149         interval_string = kmalloc(count, GFP_KERNEL);
150
151         if (!interval_string)
152                 return -ENOMEM;
153
154         not_copied = copy_from_user(interval_string, buffer, count);
155         interval_string[count - not_copied - 1] = 0;
156
157         retval = strict_strtoul(interval_string, 10, &originator_interval_tmp);
158         if (retval) {
159                 printk(KERN_ERR "batman-adv:New originator interval invalid\n");
160                 goto end;
161         }
162
163         if (originator_interval_tmp <= JITTER * 2) {
164                 printk(KERN_WARNING "batman-adv:New originator interval too small: %li (min: %i)\n",
165                        originator_interval_tmp, JITTER * 2);
166                 goto end;
167         }
168
169         printk(KERN_INFO "batman-adv:Changing originator interval from: %i to: %li\n",
170                atomic_read(&originator_interval), originator_interval_tmp);
171
172         atomic_set(&originator_interval, originator_interval_tmp);
173
174 end:
175         kfree(interval_string);
176         return count;
177 }
178
179 static int proc_orig_interval_open(struct inode *inode, struct file *file)
180 {
181         return single_open(file, proc_orig_interval_read, NULL);
182 }
183
184 static int proc_originators_read(struct seq_file *seq, void *offset)
185 {
186         HASHIT(hashit);
187         struct orig_node *orig_node;
188         struct neigh_node *neigh_node;
189         int batman_count = 0;
190         char orig_str[ETH_STR_LEN], router_str[ETH_STR_LEN];
191         unsigned long flags;
192
193         rcu_read_lock();
194         if (list_empty(&if_list)) {
195                 rcu_read_unlock();
196                 seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
197                 goto end;
198         }
199
200         if (((struct batman_if *)if_list.next)->if_active != IF_ACTIVE) {
201                 rcu_read_unlock();
202                 seq_printf(seq, "BATMAN disabled - primary interface not active \n");
203                 goto end;
204         }
205
206         seq_printf(seq,
207                    "  %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s] \n",
208                    "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF",
209                    "Potential nexthops", SOURCE_VERSION, REVISION_VERSION_STR,
210                    ((struct batman_if *)if_list.next)->dev,
211                    ((struct batman_if *)if_list.next)->addr_str);
212
213         rcu_read_unlock();
214         spin_lock_irqsave(&orig_hash_lock, flags);
215
216         while (hash_iterate(orig_hash, &hashit)) {
217
218                 orig_node = hashit.bucket->data;
219
220                 if (!orig_node->router)
221                         continue;
222
223                 if (orig_node->router->tq_avg == 0)
224                         continue;
225
226                 batman_count++;
227
228                 addr_to_string(orig_str, orig_node->orig);
229                 addr_to_string(router_str, orig_node->router->addr);
230
231                 seq_printf(seq, "%-17s  (%3i) %17s [%10s]:",
232                            orig_str, orig_node->router->tq_avg,
233                            router_str, orig_node->router->if_incoming->dev);
234
235                 list_for_each_entry(neigh_node, &orig_node->neigh_list, list) {
236                         addr_to_string(orig_str, neigh_node->addr);
237                         seq_printf(seq, " %17s (%3i)",
238                                    orig_str, neigh_node->tq_avg);
239                 }
240
241                 seq_printf(seq, "\n");
242
243         }
244
245         spin_unlock_irqrestore(&orig_hash_lock, flags);
246
247         if (batman_count == 0)
248                 seq_printf(seq, "No batman nodes in range ... \n");
249
250 end:
251         return 0;
252 }
253
254 static int proc_originators_open(struct inode *inode, struct file *file)
255 {
256         return single_open(file, proc_originators_read, NULL);
257 }
258
259 static int proc_transt_local_read(struct seq_file *seq, void *offset)
260 {
261         char *buf;
262
263         buf = kmalloc(4096, GFP_KERNEL);
264         if (!buf)
265                 return 0;
266
267         rcu_read_lock();
268         if (list_empty(&if_list)) {
269                 rcu_read_unlock();
270                 seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
271                 goto end;
272         }
273
274         rcu_read_unlock();
275
276         seq_printf(seq, "Locally retrieved addresses (from %s) announced via HNA:\n", soft_device->name);
277
278         hna_local_fill_buffer_text(buf, 4096);
279         seq_printf(seq, "%s", buf);
280
281 end:
282         kfree(buf);
283         return 0;
284 }
285
286 static int proc_transt_local_open(struct inode *inode, struct file *file)
287 {
288         return single_open(file, proc_transt_local_read, NULL);
289 }
290
291 static int proc_transt_global_read(struct seq_file *seq, void *offset)
292 {
293         char *buf;
294
295         buf = kmalloc(4096, GFP_KERNEL);
296         if (!buf)
297                 return 0;
298
299         rcu_read_lock();
300         if (list_empty(&if_list)) {
301                 rcu_read_unlock();
302                 seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
303                 goto end;
304         }
305         rcu_read_unlock();
306
307
308         seq_printf(seq, "Globally announced HNAs received via the mesh (translation table):\n");
309
310         hna_global_fill_buffer_text(buf, 4096);
311         seq_printf(seq, "%s", buf);
312
313 end:
314         kfree(buf);
315         return 0;
316 }
317
318 static int proc_transt_global_open(struct inode *inode, struct file *file)
319 {
320         return single_open(file, proc_transt_global_read, NULL);
321 }
322
323 /* setting the mode of the vis server by the user */
324 static ssize_t proc_vis_srv_write(struct file *file, const char __user * buffer,
325                               size_t count, loff_t *ppos)
326 {
327         char *vis_mode_string;
328         int not_copied = 0;
329
330         vis_mode_string = kmalloc(count, GFP_KERNEL);
331
332         if (!vis_mode_string)
333                 return -ENOMEM;
334
335         not_copied = copy_from_user(vis_mode_string, buffer, count);
336         vis_mode_string[count - not_copied - 1] = 0;
337
338         if ((strcmp(vis_mode_string, "client") == 0) ||
339                         (strcmp(vis_mode_string, "disabled") == 0)) {
340                 printk(KERN_INFO "batman-adv:Setting VIS mode to client (disabling vis server)\n");
341                 atomic_set(&vis_mode, VIS_TYPE_CLIENT_UPDATE);
342         } else if ((strcmp(vis_mode_string, "server") == 0) ||
343                         (strcmp(vis_mode_string, "enabled") == 0)) {
344                 printk(KERN_INFO "batman-adv:Setting VIS mode to server (enabling vis server)\n");
345                 atomic_set(&vis_mode, VIS_TYPE_SERVER_SYNC);
346         } else
347                 printk(KERN_ERR "batman-adv:Unknown VIS mode: %s\n",
348                        vis_mode_string);
349
350         kfree(vis_mode_string);
351         return count;
352 }
353
354 static int proc_vis_srv_read(struct seq_file *seq, void *offset)
355 {
356         int vis_server = atomic_read(&vis_mode);
357
358         seq_printf(seq, "[%c] client mode (server disabled) \n",
359                         (vis_server == VIS_TYPE_CLIENT_UPDATE) ? 'x' : ' ');
360         seq_printf(seq, "[%c] server mode (server enabled) \n",
361                         (vis_server == VIS_TYPE_SERVER_SYNC) ? 'x' : ' ');
362
363         return 0;
364 }
365
366 static int proc_vis_srv_open(struct inode *inode, struct file *file)
367 {
368         return single_open(file, proc_vis_srv_read, NULL);
369 }
370
371 static int proc_vis_data_read(struct seq_file *seq, void *offset)
372 {
373         HASHIT(hashit);
374         struct vis_info *info;
375         struct vis_info_entry *entries;
376         HLIST_HEAD(vis_if_list);
377         int i;
378         char tmp_addr_str[ETH_STR_LEN];
379         unsigned long flags;
380         int vis_server = atomic_read(&vis_mode);
381
382         rcu_read_lock();
383         if (list_empty(&if_list) || (vis_server == VIS_TYPE_CLIENT_UPDATE)) {
384                 rcu_read_unlock();
385                 goto end;
386         }
387
388         rcu_read_unlock();
389
390         spin_lock_irqsave(&vis_hash_lock, flags);
391         while (hash_iterate(vis_hash, &hashit)) {
392                 info = hashit.bucket->data;
393                 entries = (struct vis_info_entry *)
394                         ((char *)info + sizeof(struct vis_info));
395                 addr_to_string(tmp_addr_str, info->packet.vis_orig);
396                 seq_printf(seq, "%s,", tmp_addr_str);
397
398                 for (i = 0; i < info->packet.entries; i++) {
399                         proc_vis_read_entry(seq, &entries[i], &vis_if_list,
400                                             info->packet.vis_orig);
401                 }
402
403                 /* add primary/secondary records */
404                 proc_vis_read_prim_sec(seq, &vis_if_list);
405                 seq_printf(seq, "\n");
406         }
407         spin_unlock_irqrestore(&vis_hash_lock, flags);
408
409 end:
410         return 0;
411 }
412
413 static int proc_vis_data_open(struct inode *inode, struct file *file)
414 {
415         return single_open(file, proc_vis_data_read, NULL);
416 }
417
418 static int proc_aggr_read(struct seq_file *seq, void *offset)
419 {
420         seq_printf(seq, "%i\n", atomic_read(&aggregation_enabled));
421
422         return 0;
423 }
424
425 static ssize_t proc_aggr_write(struct file *file, const char __user *buffer,
426                                size_t count, loff_t *ppos)
427 {
428         char *aggr_string;
429         int not_copied = 0;
430         unsigned long aggregation_enabled_tmp;
431         int retval;
432
433         aggr_string = kmalloc(count, GFP_KERNEL);
434
435         if (!aggr_string)
436                 return -ENOMEM;
437
438         not_copied = copy_from_user(aggr_string, buffer, count);
439         aggr_string[count - not_copied - 1] = 0;
440
441         retval = strict_strtoul(aggr_string, 10, &aggregation_enabled_tmp);
442
443         if (retval || aggregation_enabled_tmp > 1) {
444                 printk(KERN_ERR "batman-adv:Aggregation can only be enabled (1) or disabled (0), given value: %li\n", aggregation_enabled_tmp);
445         } else {
446                 printk(KERN_INFO "batman-adv:Changing aggregation from: %s (%i) to: %s (%li)\n",
447                        (atomic_read(&aggregation_enabled) == 1 ?
448                         "enabled" : "disabled"),
449                        atomic_read(&aggregation_enabled),
450                        (aggregation_enabled_tmp == 1 ? "enabled" : "disabled"),
451                        aggregation_enabled_tmp);
452                 atomic_set(&aggregation_enabled,
453                            (unsigned)aggregation_enabled_tmp);
454         }
455
456         kfree(aggr_string);
457         return count;
458 }
459
460 static int proc_aggr_open(struct inode *inode, struct file *file)
461 {
462         return single_open(file, proc_aggr_read, NULL);
463 }
464
465 /* satisfying different prototypes ... */
466 static ssize_t proc_dummy_write(struct file *file, const char __user *buffer,
467                                 size_t count, loff_t *ppos)
468 {
469         return count;
470 }
471
472 static const struct file_operations proc_aggr_fops = {
473         .owner          = THIS_MODULE,
474         .open           = proc_aggr_open,
475         .read           = seq_read,
476         .write          = proc_aggr_write,
477         .llseek         = seq_lseek,
478         .release        = single_release,
479 };
480
481 static const struct file_operations proc_vis_srv_fops = {
482         .owner          = THIS_MODULE,
483         .open           = proc_vis_srv_open,
484         .read           = seq_read,
485         .write          = proc_vis_srv_write,
486         .llseek         = seq_lseek,
487         .release        = single_release,
488 };
489
490 static const struct file_operations proc_vis_data_fops = {
491         .owner          = THIS_MODULE,
492         .open           = proc_vis_data_open,
493         .read           = seq_read,
494         .write          = proc_dummy_write,
495         .llseek         = seq_lseek,
496         .release        = single_release,
497 };
498
499 static const struct file_operations proc_originators_fops = {
500         .owner          = THIS_MODULE,
501         .open           = proc_originators_open,
502         .read           = seq_read,
503         .write          = proc_dummy_write,
504         .llseek         = seq_lseek,
505         .release        = single_release,
506 };
507
508 static const struct file_operations proc_transt_local_fops = {
509         .owner          = THIS_MODULE,
510         .open           = proc_transt_local_open,
511         .read           = seq_read,
512         .write          = proc_dummy_write,
513         .llseek         = seq_lseek,
514         .release        = single_release,
515 };
516
517 static const struct file_operations proc_transt_global_fops = {
518         .owner          = THIS_MODULE,
519         .open           = proc_transt_global_open,
520         .read           = seq_read,
521         .write          = proc_dummy_write,
522         .llseek         = seq_lseek,
523         .release        = single_release,
524 };
525
526 static const struct file_operations proc_interfaces_fops = {
527         .owner          = THIS_MODULE,
528         .open           = proc_interfaces_open,
529         .read           = seq_read,
530         .write          = proc_interfaces_write,
531         .llseek         = seq_lseek,
532         .release        = single_release,
533 };
534
535 static const struct file_operations proc_orig_interval_fops = {
536         .owner          = THIS_MODULE,
537         .open           = proc_orig_interval_open,
538         .read           = seq_read,
539         .write          = proc_orig_interval_write,
540         .llseek         = seq_lseek,
541         .release        = single_release,
542 };
543
544 void cleanup_procfs(void)
545 {
546         if (proc_transt_global_file)
547                 remove_proc_entry(PROC_FILE_TRANST_GLOBAL, proc_batman_dir);
548
549         if (proc_transt_local_file)
550                 remove_proc_entry(PROC_FILE_TRANST_LOCAL, proc_batman_dir);
551
552         if (proc_originators_file)
553                 remove_proc_entry(PROC_FILE_ORIGINATORS, proc_batman_dir);
554
555         if (proc_orig_interval_file)
556                 remove_proc_entry(PROC_FILE_ORIG_INTERVAL, proc_batman_dir);
557
558         if (proc_interface_file)
559                 remove_proc_entry(PROC_FILE_INTERFACES, proc_batman_dir);
560
561         if (proc_vis_data_file)
562                 remove_proc_entry(PROC_FILE_VIS_DATA, proc_batman_dir);
563
564         if (proc_vis_srv_file)
565                 remove_proc_entry(PROC_FILE_VIS_SRV, proc_batman_dir);
566
567         if (proc_aggr_file)
568                 remove_proc_entry(PROC_FILE_AGGR, proc_batman_dir);
569
570         if (proc_batman_dir)
571 #ifdef __NET_NET_NAMESPACE_H
572                 remove_proc_entry(PROC_ROOT_DIR, init_net.proc_net);
573 #else
574                 remove_proc_entry(PROC_ROOT_DIR, proc_net);
575 #endif
576 }
577
578 int setup_procfs(void)
579 {
580 #ifdef __NET_NET_NAMESPACE_H
581         proc_batman_dir = proc_mkdir(PROC_ROOT_DIR, init_net.proc_net);
582 #else
583         proc_batman_dir = proc_mkdir(PROC_ROOT_DIR, proc_net);
584 #endif
585
586         if (!proc_batman_dir) {
587                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s' folder failed\n", PROC_ROOT_DIR);
588                 return -EFAULT;
589         }
590
591         proc_interface_file = create_proc_entry(PROC_FILE_INTERFACES,
592                                                 S_IWUSR | S_IRUGO,
593                                                 proc_batman_dir);
594         if (proc_interface_file) {
595                 proc_interface_file->proc_fops = &proc_interfaces_fops;
596         } else {
597                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_INTERFACES);
598                 cleanup_procfs();
599                 return -EFAULT;
600         }
601
602         proc_orig_interval_file = create_proc_entry(PROC_FILE_ORIG_INTERVAL,
603                                                     S_IWUSR | S_IRUGO,
604                                                     proc_batman_dir);
605         if (proc_orig_interval_file) {
606                 proc_orig_interval_file->proc_fops = &proc_orig_interval_fops;
607         } else {
608                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIG_INTERVAL);
609                 cleanup_procfs();
610                 return -EFAULT;
611         }
612
613         proc_originators_file = create_proc_entry(PROC_FILE_ORIGINATORS,
614                                                   S_IRUGO, proc_batman_dir);
615         if (proc_originators_file) {
616                 proc_originators_file->proc_fops = &proc_originators_fops;
617         } else {
618                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_ORIGINATORS);
619                 cleanup_procfs();
620                 return -EFAULT;
621         }
622
623         proc_transt_local_file = create_proc_entry(PROC_FILE_TRANST_LOCAL,
624                                                    S_IRUGO, proc_batman_dir);
625         if (proc_transt_local_file) {
626                 proc_transt_local_file->proc_fops = &proc_transt_local_fops;
627         } else {
628                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_LOCAL);
629                 cleanup_procfs();
630                 return -EFAULT;
631         }
632
633         proc_transt_global_file = create_proc_entry(PROC_FILE_TRANST_GLOBAL,
634                                                     S_IRUGO, proc_batman_dir);
635         if (proc_transt_global_file) {
636                 proc_transt_global_file->proc_fops = &proc_transt_global_fops;
637         } else {
638                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_TRANST_GLOBAL);
639                 cleanup_procfs();
640                 return -EFAULT;
641         }
642
643         proc_vis_srv_file = create_proc_entry(PROC_FILE_VIS_SRV,
644                                                 S_IWUSR | S_IRUGO,
645                                                 proc_batman_dir);
646         if (proc_vis_srv_file) {
647                 proc_vis_srv_file->proc_fops = &proc_vis_srv_fops;
648         } else {
649                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_SRV);
650                 cleanup_procfs();
651                 return -EFAULT;
652         }
653
654         proc_vis_data_file = create_proc_entry(PROC_FILE_VIS_DATA, S_IRUGO,
655                                           proc_batman_dir);
656         if (proc_vis_data_file) {
657                 proc_vis_data_file->proc_fops = &proc_vis_data_fops;
658         } else {
659                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_DATA);
660                 cleanup_procfs();
661                 return -EFAULT;
662         }
663
664         proc_aggr_file = create_proc_entry(PROC_FILE_AGGR, S_IWUSR | S_IRUGO,
665                                            proc_batman_dir);
666         if (proc_aggr_file) {
667                 proc_aggr_file->proc_fops = &proc_aggr_fops;
668         } else {
669                 printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_AGGR);
670                 cleanup_procfs();
671                 return -EFAULT;
672         }
673
674         return 0;
675 }