Re: does a seq_file "offset" always start at zero?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




  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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux