* AW: [gentoo-user] [OT] Why directories aren't files?
@ 2006-09-18 9:49 Noack, Sebastian
2006-09-18 11:50 ` Matteo Pillon
0 siblings, 1 reply; 2+ messages in thread
From: Noack, Sebastian @ 2006-09-18 9:49 UTC (permalink / raw
To: gentoo-user
Hi,
the question is, what is a file? I would say; a file is an object related to a specific inode. So a directory would be a file as well as FIFOs, unix-sockets, char, block-devices, symlinks and of course regular files.
The problem is, that not each kind of file is threaded the same way on Linux. And also it isn't on FreeBSD and the most unix-like systems. If you want an OS, where really everything is a file without exceptions and special kind of files, you should use Plan9.
But independent from this aspect, a file refers in its inode to a chunk of storage on the hard disk (or other storage medias), which contains its data. But some files like directories don't contain data. And when you read from a file for example by cat, the content of its allocated chunk of storage will be read. But if there is no such data, for example because of it is a directory, the most clean way IMHO would be to show a corresponding error message.
Best Regards
Sebastian Noack
> -----Ursprüngliche Nachricht-----
> Von: Matteo Pillon [mailto:matteo.pillon@gmail.com]
> Gesendet: Montag, 18. September 2006 11:11
> An: gentoo-user@lists.gentoo.org
> Betreff: [gentoo-user] [OT] Why directories aren't files?
>
> Hi all,
>
> I was wondering why Linux doesn't treat directories like files, as many
> other unix implementations do.
> For example, in Linux, you can't do 'cat .' while on FreeBSD you can.
> Why? There is a practical reason?
>
> Forgive me this OT, I wasn't able to find a suitable list.
>
> Thanks for replies.
> Bye.
>
> --
> * Pillon Matteo
> --
> gentoo-user@gentoo.org mailing list
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: AW: [gentoo-user] [OT] Why directories aren't files?
2006-09-18 9:49 AW: [gentoo-user] [OT] Why directories aren't files? Noack, Sebastian
@ 2006-09-18 11:50 ` Matteo Pillon
0 siblings, 0 replies; 2+ messages in thread
From: Matteo Pillon @ 2006-09-18 11:50 UTC (permalink / raw
To: gentoo-user
Hi,
On Mon, Sep 18, 2006 at 11:49:38AM +0200, Noack, Sebastian wrote:
> But independent from this aspect, a file refers in its inode to a
> chunk of storage on the hard disk (or other storage medias), which
> contains its data. But some files like directories don't contain data.
A directory IS like a file (in my opinion), it's an inode with
data, you can also see it doing an ls -l:
drwxr-xr-x 2 pmatthew users 4096 27 dic 2005 a
drwxr-xr-x 2 pmatthew users 40960 22 mar 16:20 b
Directory 'a' shows a size of 4096, the block size, as it contains
only a few files and listing them with their associated inode, needs
only a block, but 'b' contains a lot of files and so needs 10 blocks
to store the inode-filename list.
I don't have much knoledge of how ext2 works under the hood, just
guessing from the behaviour I see from higher-level tools.
Thanks for your replies.
Bye.
--
* Pillon Matteo
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-18 11:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 9:49 AW: [gentoo-user] [OT] Why directories aren't files? Noack, Sebastian
2006-09-18 11:50 ` Matteo Pillon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox