diff options
-rw-r--r-- | Documentation/filesystems/seq_file.txt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Documentation/filesystems/seq_file.txt b/Documentation/filesystems/seq_file.txt index 92975ee7942c..cc6cdb95b73a 100644 --- a/Documentation/filesystems/seq_file.txt +++ b/Documentation/filesystems/seq_file.txt | |||
@@ -107,8 +107,8 @@ complete. Here's the example version: | |||
107 | 107 | ||
108 | static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) | 108 | static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos) |
109 | { | 109 | { |
110 | loff_t *spos = (loff_t *) v; | 110 | loff_t *spos = v; |
111 | *pos = ++(*spos); | 111 | *pos = ++*spos; |
112 | return spos; | 112 | return spos; |
113 | } | 113 | } |
114 | 114 | ||
@@ -127,8 +127,8 @@ something goes wrong. The example module's show() function is: | |||
127 | 127 | ||
128 | static int ct_seq_show(struct seq_file *s, void *v) | 128 | static int ct_seq_show(struct seq_file *s, void *v) |
129 | { | 129 | { |
130 | loff_t *spos = (loff_t *) v; | 130 | loff_t *spos = v; |
131 | seq_printf(s, "%Ld\n", *spos); | 131 | seq_printf(s, "%lld\n", (long long)*spos); |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
134 | 134 | ||
@@ -136,7 +136,7 @@ We will look at seq_printf() in a moment. But first, the definition of the | |||
136 | seq_file iterator is finished by creating a seq_operations structure with | 136 | seq_file iterator is finished by creating a seq_operations structure with |
137 | the four functions we have just defined: | 137 | the four functions we have just defined: |
138 | 138 | ||
139 | static struct seq_operations ct_seq_ops = { | 139 | static const struct seq_operations ct_seq_ops = { |
140 | .start = ct_seq_start, | 140 | .start = ct_seq_start, |
141 | .next = ct_seq_next, | 141 | .next = ct_seq_next, |
142 | .stop = ct_seq_stop, | 142 | .stop = ct_seq_stop, |
@@ -204,7 +204,7 @@ line, as in the example module: | |||
204 | static int ct_open(struct inode *inode, struct file *file) | 204 | static int ct_open(struct inode *inode, struct file *file) |
205 | { | 205 | { |
206 | return seq_open(file, &ct_seq_ops); | 206 | return seq_open(file, &ct_seq_ops); |
207 | }; | 207 | } |
208 | 208 | ||
209 | Here, the call to seq_open() takes the seq_operations structure we created | 209 | Here, the call to seq_open() takes the seq_operations structure we created |
210 | before, and gets set up to iterate through the virtual file. | 210 | before, and gets set up to iterate through the virtual file. |
@@ -219,7 +219,7 @@ The other operations of interest - read(), llseek(), and release() - are | |||
219 | all implemented by the seq_file code itself. So a virtual file's | 219 | all implemented by the seq_file code itself. So a virtual file's |
220 | file_operations structure will look like: | 220 | file_operations structure will look like: |
221 | 221 | ||
222 | static struct file_operations ct_file_ops = { | 222 | static const struct file_operations ct_file_ops = { |
223 | .owner = THIS_MODULE, | 223 | .owner = THIS_MODULE, |
224 | .open = ct_open, | 224 | .open = ct_open, |
225 | .read = seq_read, | 225 | .read = seq_read, |