Short: Sector size converter, with Cache. Author: sndev@bigfoot.com (Steven Norburn) Uploader: sndev@bigfoot.com (Steven Norburn) Type: disk/misc Requires: a device to patch. Version: 0.10 This is part of range of packages designed originally for use with DVD-RAM drives, which has now become useful for other types of drives. About SectorCache: ------------------ This is a CLI Shell device patch program for changing the sector size of a device, but it also features a cache and command converter. The minimum sector size of DVD-RAM for example is 2048 bytes, the maximum PFS3 sector size is 1024 bytes, so we have a problem ! The SectorCache patch lets PFS3 think DVD-RAM is a 512 or 1024 bytes per sector device and converts the sizes accordingly. It also caches small reads by age and can convert 64 bit device commands into another form. It doesn't just work with PFS and DVD-RAM, it can work with any track disk type device or any filesystem. It can also be used to mount for example a 512 bytes per sector partition, which has been block copied to device with a larger sector size (maybe CD-R or CD-RW), the FileSystem will still see 512 byte sectors. * Warning * This is a not completely tested * BETA * and because it patches the device, any remaining bugs may destroy your data or corrupt your disk filesystem structure. * USE AT YOUR OWN RISK ! * I've been having problems with FastFileSystem fs 45.9 (03/09/2000) locking or crashing the system when mounting and quick formatting DVD-RAM discs, especially with odd sector alinements !?! Like all patches, the code can also be corrupted by other programs, it's only therefore recommended to be used when needed. Usage: SectorCache Device/A,Unit/A/N, E=EmuSize/N,D=DevSize/N,C=CacheBlock/N,L=LineLength/N,S=SetSize/N, ETD64/S,NSD64/S,TD64/S,SD=SCSIDirect/S,DType/N,Chip/S, NDR=NoDirectRead/S,NDW=NoDirectWrite/S,NC=NoConvert/S Device/A, the name of the device to patch, i.e. scsi.device. Unit/A/N, the unit number to patch, i.e. 3. E=EmuSize/N [DevSize], the size of the sector to emulate, i.e. 512. Note, SectorCache needs to be active before the driver is mounted ! D=DevSize/N [???], this is normally set automatically and shouldn't be changed. With this you can manually set the value. C=CacheBlock/N [4096], this is the size in bytes of a single cache block, it will always be divisible by DevSize. When a sector is requested which is not in the cache, the whole cache block will be filled with data. Each cache block has a identification key with the age it was created. When the cache is full, the oldest cache blocks will be reused. The key is the alined sector number at the start of a cache block. L=LineLength/N [32], cache blocks are grouped together by dividing sectors into blocks of cache lines. A sector will always occupy the same place in a cache block and a cache block will always occupy the same place in the cache line. This helps to also improve cache searching speeds. S=SetSize/N [8], independent cache lines are grouped together in a set. This allows sectors to be cached which have the same relative position in a cache line. If a free cache block is not found in any of the lines, the oldest cache block will be reused. ETD64/S, convert some SCSI Direct and other types of 64 bit commands to New Style Extended Track Disk 64 bit commands. NSD64/S, convert some SCSI Direct and other types of 64 bit commands to New Style Track Disk 64 bit commands and ignore extended data. TD64/S, convert some SCSI Direct and other types of 64 bit commands to Track Disk 64 bit commands. SD=SCSIDirect/S, convert other types of 64 bit commands to SCSI Direct 12 byte commands. DType/N, this changes the SCSI-2 Device Type number returned from the device. So setting DType to 0 (Direct-access device) allows HDToolBox to use DVD-RAM discs which normally return 5 (CD-ROM). Chip/S, this forces the cache memory to be allocated from DMA CHIP memory for older devices that cannot directly access FAST memory. NDR=NoDirectRead/S, large reads of incremental sectors are not normally cached, this forces all reads to go through the cache system. NDW=NoDirectWrite/S, large writes of incremental sectors are not normally cached, this forces all writes to go through the cache system. NC=NoConvert/S, try to use a similar type of device commands as those originally requested. +=======================================================================+ | DType Doc. Description | |-----------------------------------------------------------------------| | 00 SBC Direct-access device (e.g. magnetic disk). | | 01 SSC Sequential-access device (e.g. magnetic tape). | | 02 SSC Printer device. | | 03 SPC-2 Processor device. | | 04 SBC Write-once device (e.g. some optical disks). | | 05 MMC-2 CD-ROM device. | | 06 SCSI-2 Scanner device. | | 07 SBC Optical memory device (e.g. some optical disks). | | 08 SMC Medium changer device (e.g. jukeboxes). | | 09 SCSI-2 Communications device. | |10 -> 11 Defined by ASC IT8 (Graphic arts pre-press devices). | | 12 SCC-2 Storage array controller device (e.g. RAID). | | 13 SES Enclosure services device. | | 14 RBC Simplified direct-access device (e.g. magnetic disk). | | 15 OCRW Optical card reader/writer device | | 16 Reserved for use by Bridging Expanders. | | 17 OSD Object-based Storage Device. | |18 -> 30 Reserved. | | 31 Unknown or no device type. | +=======================================================================+ For example, to use the cache with DF2: trackdisk.device unit 2, 'SectorCache trackdisk.device 2' Possible result, * Beta Release, Use at your Own Risk ! * SectorCache Removable Media, unit 2 on trackdisk.device It's a New Style (TD) device. Emulated Sector = 512 Bytes Device Sector = 512 Bytes Cache Block = 4096 Bytes Line Length = 32 Blocks Set Size = 8 Lines Maximum Cache = 1048576 Bytes Active on Device (0x70083C4) [ After Ctrl C ] Read : Cached = 3229, Direct = 0 Write : Cached = 0, Direct = 0 Cache : Hit = 3039, Miss = 0, Made = 190, Flush = 0 IO Commands = 3273 Removed from, unit 2 on trackdisk.device Silly example, to use HDToolBox with an emulated sector size 512 bytes, 'SectorCache scsi.device 3 512 dtype=0' Possible result, * Beta Release, Use at your Own Risk ! * SectorCache Removable Media, unit 3 on scsi.device It's a New Style (TD, SD, NSD64) & SCSI Direct device. The recommended 64 bit command type is New Style (NSD64). Converting SCSI & 64 bit commands to New Style (NSD64). Changing from a Type 5 to a Type 0 device. Emulated Sector = 512 Bytes Device Sector = 2048 Bytes Cache Block = 4096 Bytes Line Length = 32 Blocks Set Size = 8 Lines Maximum Cache = 1048576 Bytes Active on Device (0x700A08C) [ After Ctrl C ] Read : Cached = 906, Direct = 0 Write : Cached = 118, Direct = 0 Cache : Hit = 992, Miss = 0, Made = 32, Flush = 0 IO Commands = 1238 Removed from, unit 3 on scsi.device If you don't want the above output to be displayed, you can always redirect it to >NIL: Supported 32 bit Device Commands: --------------------------------- TD_GETGEOMETRY CMD_CLEAR CMD_READ, CMD_WRITE, CMD_SEEK, CMD_FORMAT ETD_READ, ETD_WRITE, ETD_SEEK, ETD_FORMAT Supported 64 bit Device Commands: --------------------------------- TD_READ64, TD_WRITE64, TD_SEEK64, TD_FORMAT64 NSCMD_TD_READ64, NSCMD_TD_WRITE64, NSCMD_TD_SEEK64, NSCMD_TD_FORMAT64 NSCMD_ETD_READ64, NSCMD_ETD_WRITE64, NSCMD_ETD_SEEK64, NSCMD_ETD_FORMAT64 Supported SCSI Direct Commands: ------------------------------- SCSI_READ6, SCSI_READ10, SCSI_READ12, SCSI_READ16 SCSI_WRITE6, SCSI_WRITE10, SCSI_WRITE12, SCSI_WRITE16 SCSI_INQUIRY, SCSI_READCAPACITY, SCSI_TESTREADY This Distribution: ------------------ This is still a beta and may have some bugs that I've missed, but the more time I take trying to find bugs, the longer it takes to get released. Any reported and confirmed bugs will be corrected in a hopefully quickly released next version. If you have any suggestions or improvement you would like to see included in the next released version, please feel free to contact me. History: -------- 0.10ß (24.09.01) First release. Thanks To: ---------- All the people who have sent encouragement. David Le Blanc - for SmartDisk 1.3. Some Final Thoughts: -------------------- This is all Freeware ! If you have any problems, feel free to contact me. Best Regards, Steven Norburn Legal Stuff: ------------ License: -------- This is released under the concept of freeware. This means you are allowed to use and copy this archive freely, as long as the following requirements are fulfilled: All files are copied without any alterations or modifications. If any extra files are added, it must be obvious that they do not belong to the original distribution, and that they do not need to be included in any redistribution. Exception: So called "BBS ads" may not be added. The copying is done on a non-commercial basis. A small fee to cover media costs etc. may be charged. The copier is not claiming the copyright of this archive. Any exceptions from the above require a written permission from the author. If you want to publish this archive on a cover disk or similar, contact me first for approval (to make sure you have the latest version etc.). No Warranty: ------------ There is no warranty for the archive, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holder and/or other parties provide the archive "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the archive is with you. Should the archive prove defective, you assume the cost of all necessary servicing, repair or correction. In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may redistribute the archive as permitted above, be liable to you for damages, including any general, special, incidental or consequential damages arising out of the use or inability to use the archive (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the archive to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages.