diff options
-rw-r--r-- | fs/proc/proc_devtree.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index 7ba79a54948c..123257bb356b 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/init.h> | 7 | #include <linux/init.h> |
8 | #include <linux/time.h> | 8 | #include <linux/time.h> |
9 | #include <linux/proc_fs.h> | 9 | #include <linux/proc_fs.h> |
10 | #include <linux/seq_file.h> | ||
10 | #include <linux/stat.h> | 11 | #include <linux/stat.h> |
11 | #include <linux/string.h> | 12 | #include <linux/string.h> |
12 | #include <asm/prom.h> | 13 | #include <asm/prom.h> |
@@ -25,26 +26,27 @@ static struct proc_dir_entry *proc_device_tree; | |||
25 | /* | 26 | /* |
26 | * Supply data on a read from /proc/device-tree/node/property. | 27 | * Supply data on a read from /proc/device-tree/node/property. |
27 | */ | 28 | */ |
28 | static int property_read_proc(char *page, char **start, off_t off, | 29 | static int property_proc_show(struct seq_file *m, void *v) |
29 | int count, int *eof, void *data) | ||
30 | { | 30 | { |
31 | struct property *pp = data; | 31 | struct property *pp = m->private; |
32 | int n; | ||
33 | 32 | ||
34 | if (off >= pp->length) { | 33 | seq_write(m, pp->value, pp->length); |
35 | *eof = 1; | 34 | return 0; |
36 | return 0; | 35 | } |
37 | } | 36 | |
38 | n = pp->length - off; | 37 | static int property_proc_open(struct inode *inode, struct file *file) |
39 | if (n > count) | 38 | { |
40 | n = count; | 39 | return single_open(file, property_proc_show, PDE(inode)->data); |
41 | else | ||
42 | *eof = 1; | ||
43 | memcpy(page, (char *)pp->value + off, n); | ||
44 | *start = page; | ||
45 | return n; | ||
46 | } | 40 | } |
47 | 41 | ||
42 | static const struct file_operations property_proc_fops = { | ||
43 | .owner = THIS_MODULE, | ||
44 | .open = property_proc_open, | ||
45 | .read = seq_read, | ||
46 | .llseek = seq_lseek, | ||
47 | .release = single_release, | ||
48 | }; | ||
49 | |||
48 | /* | 50 | /* |
49 | * For a node with a name like "gc@10", we make symlinks called "gc" | 51 | * For a node with a name like "gc@10", we make symlinks called "gc" |
50 | * and "@10" to it. | 52 | * and "@10" to it. |
@@ -63,10 +65,9 @@ __proc_device_tree_add_prop(struct proc_dir_entry *de, struct property *pp, | |||
63 | * Unfortunately proc_register puts each new entry | 65 | * Unfortunately proc_register puts each new entry |
64 | * at the beginning of the list. So we rearrange them. | 66 | * at the beginning of the list. So we rearrange them. |
65 | */ | 67 | */ |
66 | ent = create_proc_read_entry(name, | 68 | ent = proc_create_data(name, |
67 | strncmp(name, "security-", 9) | 69 | strncmp(name, "security-", 9) ? S_IRUGO : S_IRUSR, |
68 | ? S_IRUGO : S_IRUSR, de, | 70 | de, &property_proc_fops, pp); |
69 | property_read_proc, pp); | ||
70 | if (ent == NULL) | 71 | if (ent == NULL) |
71 | return NULL; | 72 | return NULL; |
72 | 73 | ||