Subject: Re: link(1) - when did it disappear?
To: Greg Hudson <ghudson@MIT.EDU>
From: Gandhi woulda smacked you <greywolf@starwolf.com>
List: tech-userlevel
Date: 07/18/1999 10:23:59
On Sun, 18 Jul 1999, Greg Hudson wrote:
# > I know that symbolic links are preferred, but they won't work (if I
# > understand this correctly) for distinct, remote-mounted rootfs's
#
# If you can use a hard link, both directory entries live in the same
# filesystem. A relative symlink will always work in that case.
#
# > and hard linking each file seems an absurd waste of i-nodes.
#
# A hard link doesn't consume any inodes; it's just a directory entry.
# Hard-linking each file will "waste" one i-node per directory, not one
# per file.
Repeat after link(2):
A hard link to a file is indistinguishable from the original
directory entry.
[Shouldn't we s/file/filesystem object/ ?]
Even if you hard link a directory, you're not wasting an inode. What
do you think "." and ".." are, anyway?
[Hint: mkdir foo; ls -id . foo/..; ls -id foo foo/. ]
# So you have two better alternatives to hard-linking directories, a
# concept which the filesystem cannot support and still maintain safety
# and consistency.
In fact, if you have hard links to an empty directory, you will find
that you cannot remove any of them except via clri(8) since the code
for rmdir(2) not only checks directory contents but link count.
This, BTW, seems wrong to me.
--*greywolf;
--
NetBSD: we put the Net in NetBSD.