[K42-discussion] Bug or Feature? getdents() returns d_type DT_UNKNOWN for NFS and KFS

Dilma DaSilva dilma at watson.ibm.com
Fri Jan 27 08:59:52 EST 2006


Calin and Bob noticed that their scandir() invocation was not working
properly. It turned out that their filter function was using
the comparison d_type == DT_REG, and K42's support for getdents()
always return DT_UNKNOWN.  This has not caused us problems so far
because most programs will first check for DT_UNKNOWN before
trying to use the field.

I've fixed the behavior in our ramfs to return the proper type; it
was trivial because the file system is caching everything.

Regarding NFS: NFSv2 client only receives from the server on a GETDENTS the
fileid (i_no) and the entry name, so if we want the type we'll have to
perform a server lookup. This will make our normal getdent operations (the
normal case, where d_type is not used) much slower (in particular when
running on the simulator). 

For KFS, there is no relevant performance penalty. It's a matter of
changing the current implementation of the struct Entry to cache
the type in LSOBasic. Probably fixing and testing would take a couple
of hours (for me or Orran; probably less for Livio for example).

I have two questions:
(1) Does anyone care about having this fixed, i.e., can't get work
done if DT_UNKNOWN is returned ?
(2) Is anyone interested in doing this? (It's probably a good concrete 
task to do and get used to playing with k42)

dilma





More information about the K42-discussion mailing list