Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!bagate!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: Checking to see if a file's a link Message-ID: <21540@cbmvax.commodore.com> Date: 14 May 91 06:30:30 GMT References: <15127@darkstar.ucsc.edu> <1991Apr30.070121.24535@watdragon.waterloo.edu> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 28 In article <1991Apr30.070121.24535@watdragon.waterloo.edu> ccplumb@rose.waterloo.edu (Colin Plumb) writes: >(Question: under AmigaDOS 2.0, it seems that a file or directory is >distinguishable from a hard link to it. If this is so, obviously >my Unix understanding of hard links is invalid. What exactly are >the semantics of one? Are they low-level pointers, and can one remove >the file pointed to? How does the FS ensure the dangling link isn't >picked up?) They're not quite indistinguishable. You can detect them in a directory (via ST_LINKDIR, etc). If you lock something, you can find out if the thing (or rather last portion of the path) was a link by checking both Examine against the filename portion of the path, and ParentDir against what "should" be the parentdir (lock on the PathPart of the path). In most ways they're indistinguishable, though, just not quite as much as Unix (because of the difference between an inode setup and the way things are linked in the Amiga FS.) If the "real" file is deleted (the one that NameFromLock(Lock(...)...) gives you), the next link in the chain becomes the "real" file. When the last link is deleted, the file disappears. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup Disclaimer: Nothing I say is anything other than my personal opinion. Thus spake the Master Ninjei: "To program a million-line operating system is easy, to change a man's temperament is more difficult." (From "The Zen of Programming") ;-)