Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!motcsd!xdos!doug From: doug@xdos.UUCP (Doug Merritt) Newsgroups: comp.sys.amiga.tech Subject: Re: yet another 1.4 request Summary: Playing devil's advocate: "pro's of hard links" Message-ID: <398@xdos.UUCP> Date: 30 Jun 89 16:30:36 GMT References: <8906300342.AA12274@postgres.Berkeley.EDU> Reply-To: doug@xdos.UUCP (Doug Merritt) Organization: Hunter Systems, Mountain View CA (Silicon Valley) Lines: 90 In article <8906300342.AA12274@postgres.Berkeley.EDU> dillon@POSTGRES.BERKELEY.EDU (Matt Dillon) writes: > > Soft links are better than hard links period. > > * Removing a softlink removes the softlink, NOT the file it is pointing > to And yet there are times when you want to set things up so that removing the softlink *does* remove the file itself, if the file (inode) reference count goes to zero. This can't happen with soft links, where only one of the file references is the real file. > * You can create soft links to non existant (or not yet existant) paths And yet there are times when you *want* a complaint if the file doesn't exist yet, or to be able to preserve a file simply by linking to it. With hard links, you can link to someone else's file, and they can delete it when they're done with it without worry, because you can do the same independently. With soft links you'd have to take the extra steps of copying the file somewhere safe, replacing the original sole definition of the file with a soft link, and then eventually coordinating with everyone to see when and whether the file body should be deleted. Or in practice forgetting about it, everybody deletes their soft links, and the file needlessly takes up disk space. Although this can come up with a single person & multiple projects, clearly it is more likely to in a multiuser environment. But since we can safely assume that Amiga's will never be used in such environments, like LANs, we can ignore this, eh? :-) > * You can have soft links across filesystems On Unix, using hard links to files on the same file system gives a performance advantage over soft links, since opening the hardlink immediately gives the inode reference, whereas soft links require a second path search to find the real inode. So far it seems to me that the same could be true on AmigaDos. > * You can have soft links to devices Bogus, on both AmigaDOS and on Unix you can hard link to devices. On Unix you just do it; "ln /dev/tty ~doug/my_tty" works. On AmigaDOS you can create a second device list entry, or do an assign. And if AmigaDOS had a consistent name space, where device names *really* lived inside a file system, then you could just plain link them, too. > * It doesn't require any hacking on low level FS structures Implementation detail. > Hard links are dangerous because: > > * They are not easily supportable under AmigaDOS due to the filename > being in the file header (inode) instead of the directory entry > (what directory entry!). Implementation problems are a secondary issue after consideration of desirability. > * backup programs would have to deal with circularities and, even when > found, since there is no distinction between a master or slave link > the user can get very very confused. At least with soft links you > know where you stand. The circularites don't come about on Unix because you are prevented from hard linking to directories. Multiple backups are prevented on AmigaDOS by the archived protection bit. I grant you the confusion, except that even soft links can lead to a great deal of confusion, as we find out daily on Sun 3.5. (And on Sun 386i 4.0, they lead to nothing *but* confusion due to brain damaged system setup. But that's Sun's problem.) > * Hardlinks look like normal files or directories... all the more > confusing. Harlinks *are* normal files (but again, not directories). The only point of confusion with hardlinks is that you may not know where other copies of a file are, but "find . -inum ..." can fix that in the rare cases where it matters. In any event, it's not clear that a small amount of confusion means that they should be tossed altogether. Especially considering that soft links really are *more* confusing. I hate to do "cd directory; cd .." and discover that I haven't returned to where I started. This never happens with hard links. Doug P.S. I'm ignoring the limited exceptions to the rule that you can't hardlink to Unix directories because those exceptions don't seem important in this context. -- Doug Merritt {pyramid,apple}!xdos!doug Member, Crusaders for a Better Tomorrow Professional Wildeyed Visionary