Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 88282
b: refs/heads/master
c: f3271f6
h: refs/heads/master
v: v3
  • Loading branch information
Jan Engelhardt authored and Jonathan Corbet committed Mar 30, 2008
1 parent 1206318 commit 7322f1a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ef40203a09823bc2c69168ffa626c46365e3ca2c
refs/heads/master: f3271f656458063e9bb0da9ba920771ecc6f024c
14 changes: 7 additions & 7 deletions trunk/Documentation/filesystems/seq_file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ complete. Here's the example version:

static void *ct_seq_next(struct seq_file *s, void *v, loff_t *pos)
{
loff_t *spos = (loff_t *) v;
*pos = ++(*spos);
loff_t *spos = v;
*pos = ++*spos;
return spos;
}

Expand All @@ -127,16 +127,16 @@ something goes wrong. The example module's show() function is:

static int ct_seq_show(struct seq_file *s, void *v)
{
loff_t *spos = (loff_t *) v;
seq_printf(s, "%Ld\n", *spos);
loff_t *spos = v;
seq_printf(s, "%lld\n", (long long)*spos);
return 0;
}

We will look at seq_printf() in a moment. But first, the definition of the
seq_file iterator is finished by creating a seq_operations structure with
the four functions we have just defined:

static struct seq_operations ct_seq_ops = {
static const struct seq_operations ct_seq_ops = {
.start = ct_seq_start,
.next = ct_seq_next,
.stop = ct_seq_stop,
Expand Down Expand Up @@ -204,7 +204,7 @@ line, as in the example module:
static int ct_open(struct inode *inode, struct file *file)
{
return seq_open(file, &ct_seq_ops);
};
}

Here, the call to seq_open() takes the seq_operations structure we created
before, and gets set up to iterate through the virtual file.
Expand All @@ -219,7 +219,7 @@ The other operations of interest - read(), llseek(), and release() - are
all implemented by the seq_file code itself. So a virtual file's
file_operations structure will look like:

static struct file_operations ct_file_ops = {
static const struct file_operations ct_file_ops = {
.owner = THIS_MODULE,
.open = ct_open,
.read = seq_read,
Expand Down

0 comments on commit 7322f1a

Please sign in to comment.