you are confused; but this is your normal state
I don’t feel like I’ve got much to write, since I’ve spent the weekend just reading code and getting more and more confused, but Tom_Kun (of AROSAmp fame) told me to just write about the confusion and bemoan the lack of documentation. Sounds at least at interesting as what I usually write about, so I accept his challenge :)
I’ve given alot of thought to how to make packets happen. Going back to pencil-and-paper design, I came up with a block diagram that had IOFileSys and packets operating “side-by-side” so I started digging into the code.
I seem to have a weird sixth sense that fires when I’m coding something wrong. I usually can’t point to exactly where its wrong, but I’ve learnt to trust that sense. In this case, it fired, and I could work it out. The new system needs to be able to allow IOFileSys commands sent via DoIO() still reach a packet-based handler if appropriate. This means DoIO() accepting the command, translating to a packet, then calling DoPkt().
The problem? DoIO() is in
exec.library, while DoPkt() is in
dos.library. Thus, Exec gains a dependency on DOS. Thats wrong.
This forced me to look deeper, so I went into the AROS port of AmiCDROM, the CD-ROM handler. Both AmiCDROM and SFS were ported by adding a IOFileSys-to-packet translation layer to the handler itself. This model seems reasonable, so I’ve changed tack. I’m going to try and build a “generic”
packet.handler that can load and wrap packet-based handlers.
The model is pretty straightforward, and I plan to copy and cleanup code from AmiCDROM/SFS to get it running. But now I have to deal with the problem of getting the handler online. I figure its something loadable, like a device or library, so I’ve dug deep to find how to do this. As far as I can tell, I want a combination of LoadSeg() and CreateNewProc() with the NP_Seglist tag.
Mount and the
Mountlist also need some extending so that you can specify to use the packet handler as well as a real handler (unless some sort of auto-detection can be done), but I think thats the way forward, at least as a first implementation.
The hardest part of all this is that I have barely any examples of how the packet layer is supposed to work. I’ve learnt heaps, but I’ll really have no way of knowing if its right until someone tries to port a filesystem to it. I hate working with so many unknowns.
There’s a massive documentation void in AROS - I can muddle through the code, but there’s not a lot of commentary, and what is there is often vague or unhelpful. I’m going to turn this around at least in my corner - this project will have good comments and full higher-level documentation that explains how the whole thing hangs together.
Hoping to write a little code tomorrow, haha.