ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / s390 / kernel / profile.c
1 /*
2  * arch/s390/kernel/profile.c
3  *
4  * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
5  * Author(s): Thomas Spatzier (tspat@de.ibm.com)
6  *
7  */
8 #include <linux/proc_fs.h>
9
10 static struct proc_dir_entry * root_irq_dir;
11
12 static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
13                                         int count, int *eof, void *data)
14 {
15         int len = cpumask_scnprintf(page, count, *(cpumask_t *)data);
16         if (count - len < 2)
17                 return -EINVAL;
18         len += sprintf(page + len, "\n");
19         return len;
20 }
21
22 static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
23                                         unsigned long count, void *data)
24 {
25         cpumask_t *mask = (cpumask_t *)data;
26         unsigned long full_count = count, err;
27         cpumask_t new_value;
28
29         err = cpumask_parse(buffer, count, new_value);
30         if (err)
31                 return err;
32
33         *mask = new_value;
34         return full_count;
35 }
36
37 cpumask_t prof_cpu_mask = CPU_MASK_ALL;
38
39 void init_irq_proc(void)
40 {
41         struct proc_dir_entry *entry;
42
43         /* create /proc/irq */
44         root_irq_dir = proc_mkdir("irq", 0);
45
46         /* create /proc/irq/prof_cpu_mask */
47         entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
48
49         if (!entry)
50                 return;
51
52         entry->nlink = 1;
53         entry->data = (void *)&prof_cpu_mask;
54         entry->read_proc = prof_cpu_mask_read_proc;
55         entry->write_proc = prof_cpu_mask_write_proc;
56 }