patch-2_6_7-vs1_9_1_12
[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,
23                                         const char __user *buffer,
24                                         unsigned long count, void *data)
25 {
26         cpumask_t *mask = (cpumask_t *)data;
27         unsigned long full_count = count, err;
28         cpumask_t new_value;
29
30         err = cpumask_parse(buffer, count, new_value);
31         if (err)
32                 return err;
33
34         *mask = new_value;
35         return full_count;
36 }
37
38 cpumask_t prof_cpu_mask = CPU_MASK_ALL;
39
40 void init_irq_proc(void)
41 {
42         struct proc_dir_entry *entry;
43
44         /* create /proc/irq */
45         root_irq_dir = proc_mkdir("irq", 0);
46
47         /* create /proc/irq/prof_cpu_mask */
48         entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir);
49
50         if (!entry)
51                 return;
52
53         entry->nlink = 1;
54         entry->data = (void *)&prof_cpu_mask;
55         entry->read_proc = prof_cpu_mask_read_proc;
56         entry->write_proc = prof_cpu_mask_write_proc;
57 }