Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!decwrl!deccrl!news.crl.dec.com!nntpd.lkg.dec.com!tkou02.enet.dec.com!wpowz.enet.dec.com!zambotti From: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC) Newsgroups: comp.os.os9 Subject: Re: open() + sharable file = no disk Message-ID: <1991Jun13.014701.22156@tkou02.enet.dec.com> Date: 13 Jun 91 01:47:01 GMT References: <1991Jun11.012640.904@tkou02.enet.dec.com> <1656@seq.uncwil.edu> <1991Jun12.012958.10534@tkou02.enet.dec.com> <1991Jun12.051830.4900@ncsu.edu> <1661@seq.uncwil.edu> Sender: usenet@tkou02.enet.dec.com (USENET News System) Reply-To: zambotti@wpowz.enet.dec.com (Walter Zambotti DEC) Organization: Digital Equipment Corporation Lines: 71 Hi guys, nothing like a bug to get the blood stiring. I checked the program on a floppy and low and behold I found it works ok. Which confirms what you have already found out. I'll patch my /r0 descriptor and recheck the program. I'm pretty close to finishing the ln(1) command just some debugging to do now! You wont believe how much checking has to be done in order to create this link. Here is a brief overview : ln existing_file/dir new_file/dir does existing_file exist ? does new_file not-exist ? are both existing_file and new_file on the same device ? (cant link across disks!) if existing_file is a file then if existing_file contains a directory path then open directory portion of path else open . endif else must be directory open directory read second 32 byte entry (which is .. ) open .. endif search for existing_file entry in directory extract header sector lsn open raw device and read header sector lsn extract the link count and bump by one don't write back yet if new_file contains directory path then open directory portion of path else open . endif search in directory for empty entry if no empty entry then seek to end of file+1 endif write new entry with existing_file header sector lsn if write succeed then write back header sector now if write failed then erase new entry from directory endif endif done The current version is quit large about 8k. It has every line of code checked for error conditions which I feel is important until I start to trust links on OS9. Links are excellent but if you dont get them wrong it would be easy to screw up a disk quite quickly. The moment I get it going I'll release the source and then start stream lining. see ya round like a beach ball, Walter