aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/filesystems
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2008-03-28 15:09:39 -0400
committerJonathan Corbet <corbet@lwn.net>2008-03-30 13:05:04 -0400
commitf3271f656458063e9bb0da9ba920771ecc6f024c (patch)
tree417eff2d05186b90a65097da5c90a921c13defa9 /Documentation/filesystems
parentef40203a09823bc2c69168ffa626c46365e3ca2c (diff)
Fixes to the seq_file document
On Friday 2008-03-28 19:20, Jonathan Corbet wrote: >commit 9756ccfda31b4c4544aa010aacf71b6672d668e8 >Date: Fri Mar 28 11:19:56 2008 -0600 > > Add the seq_file documentation patch on top: - add const qualifiers - remove void* casts - use proper specifier (%Ld is not valid) Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r--Documentation/filesystems/seq_file.txt14
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
136seq_file iterator is finished by creating a seq_operations structure with 136seq_file iterator is finished by creating a seq_operations structure with
137the four functions we have just defined: 137the 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
209Here, the call to seq_open() takes the seq_operations structure we created 209Here, the call to seq_open() takes the seq_operations structure we created
210before, and gets set up to iterate through the virtual file. 210before, and gets set up to iterate through the virtual file.
@@ -219,7 +219,7 @@ The other operations of interest - read(), llseek(), and release() - are
219all implemented by the seq_file code itself. So a virtual file's 219all implemented by the seq_file code itself. So a virtual file's
220file_operations structure will look like: 220file_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,