From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <7359f0490708200802g2ba8abc0jd61b4f9550bc382f@mail.gmail.com> Date: Mon, 20 Aug 2007 08:02:58 -0700 From: "Rob Pike" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] everything is a directory In-Reply-To: <46C9A3E8.5A6BE67D@null.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46C4E86C.CD73F5D@null.net> <13426df10708170600u40bd2dcat14f02aa7c192fb0e@mail.gmail.com> <46C61B21.67B15E89@null.net> <46C9A3E8.5A6BE67D@null.net> Topicbox-Message-UUID: ad2bc02c-ead2-11e9-9d60-3106f5b1d025 This is only possible because someone said it was OK to break directories in the first place. Not too long ago, if you wanted to read a directory you could use a read system call. I see no functional reason that that symmetry was worth breaking. Also, I dispute your claim that tools have to change. For instance, ls will misbehave: it will think your file is a directory. And there will be lots more instances because, fundamentally, stat will be misleading. Then all the existing tools will be changed because people will want to use them on attributed files and their attributes. It reminds me of symlinks, which I detest. I understand why they were created - cross-device links didn't work - but they broke just about everything by introducing a second kind of file. Half the time you want the file, half the time you want the file it describes. They're pointers, and deciding whether the operation wants the pointer's value or referent means a new system call shows up, a new flag appears everywhere, and one usually guesses wrong the first time. Attributes, as created or as posited here, are better only because for the most part one can ignore them altogether. Except when you can't. If you want attributes, rethink the system, don't hack it. -rob On 8/20/07, Douglas A. Gwyn wrote: > I was thinking more about the subject, and extended attributes. > Here is an alternative proposal to implement extended attributes: > > (1) Everything stays the same as it is (Plan 9 or old-Unix) > except: > (2) An attempt to read(2) or write(2) a directory will succeed > if and only if there is a .data entry, in which case it will > access contents of the .data object. > > None of the existing tools need to be changed. > > To add attributes (all done in user space): > (a) Move the current file (terminal node) to a temp name. > (b) Make a directory in its place, with the original name. > (c) Move the temp name to original_name/.data . > (d) Create a file (subdirectory?) .attributes . > (e) Populate the .attributes . >