Skip to content
  • NeilBrown's avatar
    fs/seq_file.c: simplify seq_file iteration code and interface · 1f4aace6
    NeilBrown authored
    The documentation for seq_file suggests that it is necessary to be able
    to move the iterator to a given offset, however that is not the case.
    If the iterator is stored in the private data and is stable from one
    read() syscall to the next, it is only necessary to support first/next
    interactions.  Implementing this in a client is a little clumsy.
    
     - if ->start() is given a pos of zero, it should go to start of
       sequence.
    
     - if ->start() is given the name pos that was given to the most recent
       next() or start(), it should restore the iterator to state just
       before that last call
    
     - if ->start is given another number, it should set the iterator one
       beyond the start just before the last ->start or ->next call.
    
    Also, the documentation says that the implementation can interpret the
    pos however it likes (other than zero meaning start), but seq_file
    increments the pos sometimes which does impose on the implementation.
    
    This patch simplifies...
    1f4aace6