Subject: Re: problem with tmpfs and linux emulation?
To: Matt Thomas <matt@3am-software.com>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: current-users
Date: 11/12/2005 13:52:26
In message <437637E2.6010101@3am-software.com>, Matt Thomas writes:
>Bill Studenmund wrote:
>> On Thu, Nov 10, 2005 at 10:50:07PM +0000, Matthias Scheler wrote:
>> 
>>>In article <43722C24.7020308@3am-software.com>,
>>>	Matt Thomas <matt@3am-software.com> writes:
>>>
>>>>This implies that the linux_sys_read syscall (and friends) needs to know
>>>>if it's reading from a directory, and if so, do the getdents dance itself.
>>>
>>>Yes, indeed.
>>>
>>>
>>>>This would be filesystem independent.  And ugly as hell.
>>>
>>>Why? Figuring out that it is a directory can be done by looking on the vnode
>.
>> 
>> 
>> I think the problem is that the layering doesn't make this convenient. The 
>> level that can easily see the vnode, the vn layer, is deep past the place 
>> where we abstract away the emulation. So we either add a hook to determine 
>> emulation, teach all emulations how to read directories, or cook up a way 
>> so that linux opens of directories get a different vn vector which will do 
>> the right thing.
>
>I don't see the problem.  Instead of using sys_read, linux would have its
>linux_sys_read.  It would look up the fd, see if it's a DTYPE_VNODE, and if so
>check to see if it's a directory.  It's only a problem is you are relying on t
>he
>standard sys_read routine.

Presumably, though, the behavior of linux_sys_read would have to depend 
on the underlying file system type -- it does the right thing for, say, 
ffs and ext2fs, but not for tmpfs.

		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb