Re: seq_file's and iterators

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

 



On Sat, Feb 24, 2007 at 08:50:12AM -0500, Robert P. J. Day wrote:
> 
>   for those with a copy of LDD3, i'm looking at the example of using a
> seq_file interface for the book's "scull" example, and i'm a bit
> puzzled by how the iterator is being used.
> 
>   as i read it, the routines defined for that interface are constantly
> being *told* where the current location is -- the scull_seq_next(),
> rather than acting as a true iterator, accepts as input the position
> from which to calculate and returns the next position.
>

I think seq mechanism applies well to your definition of a 
true iterator.

1) seq_next updates the given *pos pointer to the next node
2) seq_start or seq_next returns a pointer
   (*v in the example) that represents the current node. 

updated *pos in `1' can be sent again to another seq_next to 
represent the following node.

The returned pointer in `2)' can be passed to seq_show to 
display the desired node info.

Though this is the work of the seq layer itself.

regards,
-- 
Ahmed S. Darwish
http://darwish.07.googlepages.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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