Hello devs, especially Jeremy,

I reviewed your recent commit 1702 to build 2041 regarding sector sizes  
larger than 512. Here are my thoughts and suggestions.

- First, dsk.h defines the maximum sector size (MAX_SEC_SIZE) as 2048 (as  
the commit comment says) while the relevant LoL entry (maxsecsize) in  
kernel.asm is initialised to 4096.

- Second, maxsecsize is erroneously used once in dsk.c while everything  
else uses the value from the dsk.h definition.

- Third, if I'm not entirely mistaken, the patch makes all buffers grow to  
2048 bytes, even in the absence of any block devices with large sectors.  
This will unnecessarily waste memory on most systems.

MS-DOS initializes its 'maxsecsize' to 512 and will increase it (along  
with each buffer's size) during CONFIG processing whenever a block device  
with larger sectors is registered. (As far as I know/deduced, this works  
up to a sector size of 8192 bytes.) This way, if the need for large  
buffers wasn't apparent during CONFIG, they will stay smaller.

This scheme could obviously be extended by additional tools/interfaces to  
increase the buffer size later on, and a CONFIG option to artificially  
increase it in anticipation of a post-CONFIG requirement.

- Fourth, apart from the other points, I fail to see why you should not be  
able to simply increase MAX_SEC_SIZE to 8192. 4096 is definitely in need  
as evidenced by the list's requests for precisely that size.

- Fifth, I think MS-DOS supports sector sizes below 512 too. If you were  
to look into that, I believe it wouldn't be too hard to implement. Due to  
the filesystem (size of directory entries), 32 bytes is the absolute  

I believe all sizes below 512 will require a slight change to the BPB  
loading (What to do about the sector end signature location?) while you  
might have to get creative for the very small sizes, because a full BPB  
would not fit. I'd suggest just expecting the BPB to stretch several  
sectors then; the filesystem already allows reserved sectors to be  
properly implemented using the BPB.

C. Masloch

Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
Freedos-kernel mailing list

Reply via email to