On 08/08/2013 10:05 AM, Mark Tinguely wrote: > On 07/24/13 07:44, Brian Foster wrote: >> readdir reads the directory entries from an open directory from >> the provided offset (or 0 if not specified). On completion, >> readdir prints summary information regarding the number of >> operations and bytes transferred. Options are available to specify >> the starting offset, length and verbose mode to dump directory >> entry information. >> >> Signed-off-by: Brian Foster<bfoster@xxxxxxxxxx> >> --- >> >> v2: >> - Convert from getdents to readdir. >> - Use configure mechanism for libc readdir() availability (zab). >> - Add extra dirent fields to verbose output (zab). >> > > Just started to look at this. > Hi Mark, Thanks for looking at this... > Shouldn't there be a "closedir(dir);" to close the directory stream and > release the directory structure? > According to the man page, closedir() would also close the fd. I gave it a quick test to be sure and I end up with behavior like this: xfs_io> open /export/test xfs_io> readdir [00000000 [00000004 [00000006 [00000009 [00000200 read 104 bytes from offset 0 104.000000 bytes, 4 ops, 0.0000 sec (5.220 MiB/sec and 210526.3158 ops/sec) xfs_io> close close: Bad file descriptor That said, I'm not sure what the ramifications of repeated readdir commands might be (i.e., repeated fdopendir() calls on the same fd). Perhaps the right thing to do here is dup() file->fd prior to fdopendir() and then add the closedir(). > Could we get a little info for the xfs_io man page? > Ok. Brian > Looks like a nice feature. > > Thanks. > > --Mark. _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs