On Tue, 2004-07-06 at 21:58, Maneesh Soni wrote: > On Sun, Jul 04, 2004 at 07:31:29PM +0000, FabF wrote: > > Hi, > > > > I try to understand how readdir process works and I can't understand > > f_pos management : > > > > Having in mind things work that way : > > > > user : ls > > glibc : > > open (->sys_open) > > getdentries64 (->sys_getdentries64) > > > > kernel: > > sys_getdentries64 > > ->vfs_readdir > > ->ext2_readdir > > > > At that point, I don't understand why ext2_readdir is playing with > > filp->f_pos .... It should be 0 ...Why does it care about offset ? > > > > I think it may not be 0 all the time. A seekdir() could change could change > the offset to non-zero. Thanks Maneesh :) Anton brightly explained me readdir : it can be called more than once (buffering ...) so the reason for that offset.Action taking place in filldir return.'over' in ext2 readdir could bring confusion though....It's 'over' for kernel duty but the whole path is not necessarily explored yet. I think the trivial comment patch attached (against 2.6.7-mm6) could be interesting for that issue. Regards, FabF > > Thanks > Maneesh