i'm reading LDD3 and i can see the prototype for the "start" method
for a seq_file:
void* start(struct seq_file *sfile, loff_t *pos) ;
does that offset position always start at zero for a seq_file?
everything suggests it does, but the book doesn't come right out and
say it. and if it doesn't, how as a programmer could you open a
seq_file to start at some other offset? thanks.
rday
No. the offset position is not zero always. It will be zero at the 'first read' after an open call to the file.
For consequent calls to 'read', start is called each time with the updates positions.
e.g.
Open
----> Initialize (pos = 0)
Now, if there are 3 consecutive calls to read the file, this can be the picture.
Read 1
------> start(0)
if it updates pos to 10
------> next(10)
if it updates pos to 20
------> next(20)
if it updates pos to 30
pos = 30
----> stop
Read 2
------> start(30)
if it updates pos to 40
------> next(40)
if it updates pos to 50
-------> next(50)
if it updates pos to 60
pos = 60
-------> stop
Read 3:
.
.
Close
Please CMIIW
Regards,
- Ratnadeep