[news.groups] symlinks, pointers & GOTO's

maart@cs.vu.nl (Maarten Litmaath) (11/01/89)

This article is crossposted to comp.unix.questions, to which followups have
been directed.
bzs@world.std.com (Barry Shein) writes:
\>A symbolic link is a POINTER to a file, | [...]
\> a hard link is the file system's GOTO. | [...]
\
\huh? a symbolic link is a call by name and a hard link is a call by
\reference. Your analogy has conformability problems.

To get this straight once and for all: I wanted to point out how neatly
symlinks can be used, compared to hard links.  Symbolic links are often
regarded as hacks to link across devices only.  But compare them with
pointers: what do you use pointers for, aren't you glad they exist?
Pointers always make me think of *shared* data.  Of course one might object:
multiple hard links allow data to be shared too.  Quite so, but hard links
have the following not-so-neat property: when you want to replace a multiply
hard-linked file with an updated version, you have to *cat* the new file over
the old one; using mv will lead to `interesting' effects...

Of course symlinks have a drawback too: when you move the file pointed to,
you have to adjust the symlink as well, *if* you want it still to point to
the original data.

The cross-device link problems can be overcome if the file system uses a
universal inode (vnode) scheme: don't let every partition have the same set
of inode numbers, instead let each have a private non-overlapping share of
inodes.
Symlinks, however, still have their use.
-- 
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
 a hard link is the file system's GOTO. | maart@cs.vu.nl, mcsun!botter!maart