public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Squashfs without ./..
@ 2005-03-22 15:47 Jan Engelhardt
  2005-03-22 15:59 ` Jesper Juhl
  0 siblings, 1 reply; 26+ messages in thread
From: Jan Engelhardt @ 2005-03-22 15:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Phillip Lougher

Hello,


I have observed that squashfs, when mounted, does not return any "." or ".." 
pseudo-directories upon readdir.
Could this be added? Would there be any objections?


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: Squashfs without ./..
@ 2005-03-27  8:11 Adam J. Richter
  2005-03-27  8:51 ` Jan Engelhardt
  0 siblings, 1 reply; 26+ messages in thread
From: Adam J. Richter @ 2005-03-27  8:11 UTC (permalink / raw)
  To: jengelh; +Cc: linux-kernel

Jan Engelhardt wrote:
>[...] . and .. do not need to show up (even they have been the 
>"leaders" of ls -l ;-), Midnight Commander (`mc`) for example synthesizes ".." 
>nevertheless.
>
>So - what about removing . and .. in readdir for all "standard harddisk 
>filesystems" (ext*,reiser*, [jx]fs)? I mean, one party always has to loose...~v

	Eliminating the "." and ".." emulation in many individual
file systems would probably eliminate a moderate amount of code
from libfs/fs.c, a number of other virtual file systems and probably
every physical file system that does not actually store "." and "..".
It is very appealing to me.

	Unfortunately, the description of readdir() in the Single Unix
Specification version 3 says:

| [...] If entries for dot or dot-dot exist, one entry shall be returned
| for dot and one entry shall be returned for dot-dot; otherwise, they
| shall not be returned.

	Unless attempts to access "." and ".." would really return -ENOENT,
then at least the C library's readdir() function has to return them.  
At least that's how I read it.

	Although I do not believe that absolute compliance to SUSPv3
is a requirement demanded by those who make the "official" kernel
releases, I think that complying closely to SUSPv3 and many other
standards is considered to be worth a lot (in terms of technical
trade-offs) so that software that complies to these standards
is more likely to run properly on systems running the Linux kernel.
So, I would expect that patches changing squashfs and other file systems
whose readdir functions currently fail to return "." and ".." would 
be likely to be integrated (if they meet all the other usual quality
standards), at least for now.

	That said, I can think of at least two approaches by which
we could eliminate the "." and ".." emulation littering most Linux
file system drivers.

	The first way would be to change the kernel so that the
underlying readdir system call does not return "." or "..", but
have the C library do the emulation.  The C library can maintain
the state information for this purpose easily because opendir()
returns a pointer to an opaque structure that the C library
allocates.

	Alternatively, we could preserve the opendir system call's
behavior, but pick apart a few of the routines in fs/libfs.c to come
up with some more general utiity routines to implement the common case
where the first readdir returns ".", the second returns "..", a seek
pointer of 0 means before the ".", a seek pointer of 1 means before
the "..", and a seek pointer of 1 means immediately after the "..".
The actual implementation would be pretty short, but having an
interface that the client file systems could easily accomodate might
take some care (for example, accomodating their locking schemes while
keeping the interface simple enough so that the client file system
drivers are still made smaller by using it).

                    __     ______________ 
Adam J. Richter        \ /
adam@yggdrasil.com      | g g d r a s i l

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2005-04-20  4:39 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22 15:47 Squashfs without ./ Jan Engelhardt
2005-03-22 15:59 ` Jesper Juhl
2005-03-23 16:40   ` Pietro Zuco
2005-03-23 17:31     ` Jan Engelhardt
2005-03-23 17:49       ` Tom Vier
2005-03-24  7:01         ` Jan Engelhardt
2005-03-24 17:55         ` Geert Uytterhoeven
2005-03-24 19:36           ` Tommy Reynolds
2005-03-24 19:47             ` Jan Engelhardt
2005-03-24 22:31               ` Andreas Schwab
2005-03-24 19:59             ` H. Peter Anvin
2005-03-24 20:13               ` Kyle Moffett
2005-03-24 20:36                 ` H. Peter Anvin
2005-03-25 13:59                   ` Jesper Juhl
2005-03-27  4:05                     ` Jan Harkes
2005-03-27  9:16                       ` Jesper Juhl
2005-03-25 14:39                 ` Eric W. Biederman
2005-03-26  3:48                 ` Phil Lougher
2005-03-26  3:52                   ` H. Peter Anvin
2005-03-26  2:14                     ` Phillip Lougher
2005-04-20  4:39                       ` Jörn Engel
2005-03-26 10:03                   ` Jan Engelhardt
2005-03-27  1:56                     ` H. Peter Anvin
2005-03-26  2:39           ` Paul Jackson
  -- strict thread matches above, loose matches on Subject: below --
2005-03-27  8:11 Adam J. Richter
2005-03-27  8:51 ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox