9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@terzarima.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Q: moving directories? hard links?
Date: Tue, 19 Apr 2011 16:36:54 +0100	[thread overview]
Message-ID: <8ed20dffacbe4f99152910cbdf908e88@terzarima.net> (raw)
In-Reply-To: <8662qej52i.fsf@cmarib.ramside>

>  Observation 1: There doesn't seem to be any provision for moving a
>  directory from one directory into another directory; that is, moving
>  it to a different directory on the same <type,device> file system.
>
>  Observation 2: There doesn't seem to be any support for hard links.

In http://cm.bell-labs.com/cm/cs/who/dmr/hist.html Ritchie discusses the structure
of the "PDP-7 Unix file system" (see the section with that name). One unusual aspect
(for the time) was the separation between the i-list array of i-nodes, each representing
a file, and directory files that mapped names to i-list indices (i-numbers). A "link"
was just an entry in a directory file, mapping a name to an i-node, and there
could be many such links to a given i-node, just as in later versions of Unix,
although some of the conventions were rather different.

Much later, when Berkeley added symbolic links (following Multics), a distinction was drawn
between those links, now called "hard links" and "symbolic" ones. That obscured a
deeper distinction: the original form either exposes details of a file system implementation
or imposes specific requirements on one (depending on your point of view), but the
symbolic link does not. I'd argue that for what applications typically do,
it's probably an over-specification, and in an environment such as Plan 9
where many different types of resources are represented by file servers,
it's a big nuisance for a small benefit. For instance, structures built on-the-fly
as views of data would need to record all the new links added.

What anyway is the benefit of links? In Unix, directories were made (by a command)
by creating a completely empty directory file, then using sys link to
add "." and ".." links into that directory in separate, explicit steps.
Files were renamed by creating and removing links. This had a certain simplicity and charm,
but also implied constraints on file system implementation.
Even in Unix, links weren't extensively used for other forms of aliasing.

In Plan 9, mkdir is a system call, and "." and ".." aren't explicitly created;
and there's a specific way of renaming a file within its directory.
It's perhaps a little more abstract, and links aren't needed to express those
operations. Later versions of Unix also added mkdir and rename system calls
but absolutely typically, retained links; "." and ".." aren't still
implemented as links, for which rename implementations give thanks, so why keep hard links?
If you really want an operation to move a file or directory from one place in
a hierarchy to another, without always having to copy it, it would be better to
express that explicitly.



      parent reply	other threads:[~2011-04-19 15:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16  2:36 smiley
2011-04-16  2:40 ` Jacob Todd
2011-04-16  4:22 ` ron minnich
2011-04-16 16:53   ` erik quanstrom
2011-04-16 17:33   ` smiley
2011-04-16 17:51     ` erik quanstrom
2011-04-21 15:32       ` smiley
2011-04-21 15:43         ` ron minnich
2011-04-16 18:22     ` Bakul Shah
2011-04-21 15:44       ` smiley
2011-04-21 15:49         ` ron minnich
2011-04-21 16:54         ` Bakul Shah
2011-04-21 20:17           ` Richard Miller
2011-04-21 21:10             ` Bakul Shah
2011-04-21 22:41               ` erik quanstrom
2011-04-21 23:17                 ` ron minnich
2011-04-21 23:54                   ` Bakul Shah
2011-04-21 23:55                   ` erik quanstrom
2011-04-22  0:01                     ` ron minnich
2011-04-22  0:04                       ` erik quanstrom
2011-04-22  8:03                 ` Bakul Shah
2011-04-22  8:27                   ` dexen deVries
2011-04-22 13:05                   ` erik quanstrom
2011-04-22 17:47                     ` Bakul Shah
2011-04-24 18:58                       ` erik quanstrom
2011-04-16 18:03   ` Richard Miller
2011-04-16 18:17     ` Skip Tavakkolian
2011-04-16 18:56       ` Rob Pike
2011-04-18  9:08         ` Aharon Robbins
2011-04-18 12:41           ` erik quanstrom
2011-04-18 12:59             ` Lucio De Re
2011-04-18 13:00               ` erik quanstrom
2011-04-18 13:11                 ` Lucio De Re
2011-04-23  3:48                   ` Ethan Grammatikidis
2011-04-21  9:22       ` Balwinder S Dheeman
2011-04-16 16:58 ` erik quanstrom
2011-04-19 15:36 ` Charles Forsyth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ed20dffacbe4f99152910cbdf908e88@terzarima.net \
    --to=forsyth@terzarima.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).