From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Thu, 30 Jul 2009 17:25:12 +0200 Message-ID: <138575260907300825p4b005c50o990df6ff2a0c68cc@mail.gmail.com> From: hugo rivera To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [9fans] 9p fids and references Topicbox-Message-UUID: 324e0e66-ead5-11e9-9d60-3106f5b1d025 Hi, I am trying to implement a toy fs using the 9p protocol. I've been reading Francisco's intro to plan 9 and section 5 of the manual pages, and I have to say I am surprised because I am actually learning from them; plan 9 man pages are really readable :-) (not to mention Francisco's fine intro). Anyway, there's one thing unclear for me and it's about fids and references: when a client opens a connection to my server, it chooses fids for all the files I have inside and also navigates the fs and performs operations using these fids (which are somehow mapped to qids in my server, but this isn't cristal clear for me; tough I know qids are unique and fids not necessarily so). The Fid structure contains an aux pointer to whatever I want and I am using it, but my problems start when I want to get rid of the data pointed by aux. In my fs, it's guaranteed that each file points to its unique data structure (pointed by aux) and there's no way two different files point to the same data structure (but maybe two different fids do?) so reference counting is unnecessary, am I right? I believe that clone shouldn't be a problem since I am creating copies of the structure instead of passing just a reference. I am trying to avoid dangling pointers when a file is removed without using reference counting, is it possible? Saludos -- Hugo