[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Format1 made easy

Bjarke Hammersholt Roune wrote:

>After some speculation on wheter there really wasn't an easier way to do
>format 1 than what we are planning, I came up with this possible simpler
>solution: Store dir info in the end of the file.
>That way, if you want to add a file for a format 1 pak file, simply load the
>pak info, write to the end of the file and write back the loaded pak info
>along with info for the added file.

Cool idea. And very simple...

>This is much simpler, since the exact same serialization method can be used
>for both format 0 and format 1 paks this way. It also makes mounting MUCH
>faster, since we don't have to ever reposition the drive read head, which is
>very expensive, and can just do a simple serial read operation (perhaps only
>ONE with caching), which is very inexpensive.
>Performance might lag a little at writing format 1 paks if we have to
>rewrite the ending information each time we want to add a file, but then we
>can just make it possible to do format 1 pak writes in one go (can that
>already be done? I'm not sure), so we only have to write it once.

It's actually quite easy. We read the complete dir info at mounting time
(we do that anyway), and when some file is added, we just append its file
data and take a note that the dir info has been (partially) overwritten. We
do that for all files that are added (one at a time, as before - otherwise
it is too complicated/slow) and finally when the thing is umounted we write
(serialize) the dir info.

>Actually, that way, we both gets things simpler and more effecient.

Exactly. Great idea!
Well, it adds another rule to format 1 (dirinfo has to be at the end), but
I think that's ok. Yes, I'm sure it is :-)


Drive A: not responding...Formatting C: instead