Coda File System

readdir can of worms ....

From: Phil Nelson <phil_at_cs.wwu.edu>
Date: Wed, 2 Feb 2000 11:06:33 -0800 (PST)
Hi,

  I just got coda working on Solaris 7 on the i386 platform.  In doing
that I discovered an interesting can of worms .... and would like to
visit the topic.

  Here is what is happening:

  a) Venus converts directory information into a BSD directory formatted
     container file.

  b) Depending on the OSes native directory structure various things may happen
     when a readdir operation is requested of the kernel:

	NetBSD/FreeBSD -> just use the OSes VOP_READDIR code to do the job.
	Solaris/sparc  -> just happens to have the structure on disk as written by
				venus be the local format and uses VOP_READDIR to read.
				(BSD format has one extra field but type sizes
				make the entries have the same size.)
	Linux	       -> has a incompatible format due to field types and an
				extra field in the BSD format and must convert
				the on-disk format to the correct format
				for the readdir call.
	Solaris/x86    -> Due to being little endian, the disk layout does not
				look like the native OS format.  To do this
				without any changes to venus would require a
				similar thing to Linux.  (two bytes are swapped
				from the correct format.)

  c) All of these have very similar directory entry structures.  With the exception
	of the d_type field, they all have the same fields in the same order, but
	the types vary for some of the fields.  long vs short vs char ....

  d) I got Solaris/x86 working by:

	1) providing the correctly typed structure
	2) ifdefing out accesses to the d_type field (all 2 of them)
		(coda/coda-src/dir/dirbody.c always set d_type to 0,
		so it really wasn't being used!)
	3) and recompiling.

  e) This may go against previous decisions, but I'd like to be able to have
	the solaris code pass off the venus written container file to the
	local OS readdir code.  As pointed out, this requires an different
	dirent structure and no access to the d_type field.  (Both small changes.)

  f) Does venus need to read this directory container file or does it keep
	the vice directory structure in RVM?

  What do you think?

  Should venus convert to Linux version dirent also?  From my reading code in
NetBSD libc, it looks like the only common format is from the readdir libc
code and that does a final conversion from the local OS dirent to the final
format.  Why should we force yet another conversion from BSD -> local OS format?

-- 
Phil Nelson                    NetBSD: http://www.netbsd.org
e-mail: phil@cs.wwu.edu        Coda: http://www.coda.cs.cmu.edu
http://www.cs.wwu.edu/~phil    
Received on 2000-02-02 14:36:18