-------------------- AmigaOS 3.1.4.(1) project -----------------------

hdtoolbox 40.5 (9.11.2016)

- Removed _main.c, hdtoolbox.lnk, preptest.c, printf.c, rdb.h, scsidisk.h,
  sure.h and verify.s

- Small rework to reduce the number of compiler warnings produced.

- Dropped unused code.

- Rebuilt the function prototype header file from source.

- All system header files are included through "headers.h", which also
  includes all global library base pointers.

hdtoolbox 40.6 (10.11.2016)

- Added notes on where partition/volume size calculations are being made
  which may be in need of updating.

- Fixed more compiler warnings, e.g. with regard to possibly uninitialized
  variables.

- Replaced all calls to _exit() with exit(). The _exit() shortcut, which
  would reduce the program size if a custom startup code was used, should
  not be necessary. It certainly can cause problems with the regular
  SAS/C startup code which may not release all the resources allocated

hdtoolbox 40.7 (11.11.2016)

- Changed 'long' to 'LONG' type, 'short' to 'int', etc. where possible.

- Fixed the last few compiler warnings with regard to assignments being
  used as truth values.

- Added workarounds for code that could run into NULL pointers and would
  not stop and abort.

- Memory allocation failure in handlefsm.c/MakeFileSys() is now handled
  correctly.

hdtoolbox 40.8 (11.11.2016)

- Added notes on the ranges of the various drive parameters (number of
  cylinders, number of blocks per cylinder, bytes per sector, etc.).

- RecalcSizeSetup() now prints the sizes of disks in TBytes, GBytes, MBytes
  and KBytes, depending upon how large it is.

- Added subtract_64_minus_32_to_64() function.

- ReCalcSizeText() now prints the sizes of partitions in TBytes, GBytes,
  MBytes, KBytes or bytes depending upon how large they are.

- ChangeDriveType() calculates the product of cylinders per drive and
  number of blocks per cylinder as a 64 bit integer. The warning message
  buffers now have enough room for both this product and the total number of
  blocks (an unsigned 32 bit integer) to be displayed without overflowing.

- DoQuickSetup() now correctly calculates the size of the medium before
  it chooses the sizes of the partitions to be added.

hdtoolbox 40.9 (11.11.2016)

- With scsi.device versions < 43 the sizes and positions of new partitions
  to be added will be limited to the first 4 GBytes of the disk.

hdtoolbox 40.10 (12.11.2016)

- PropGadget parameters are now calculated using 64 bit integer math,
  because all input parameters are 24 bit values. Note: to be on the safe
  side, this code should use 64 bit integer division, too. This is not
  implemented yet.

- Dropped unused math functions from "big_math.c".

- The command line parameters now support a keyword "No4GLimit" which may
  appear at any position in the argument list. If the "No4GLimit" is
  present, then the 4 GByte disk size limit will be deactivated.

- If the icon tool types include an entry "No4GLimit" then the 4 GByte disk
  size limit will be deactivated.

- Simplified the library/font/screen/visualinfo cleanup code.

- Removed the stcl_d() kludge, replacing the conversion with sprintf().

- The total number of cylinders is no longer printed as "*****", but as
  whatever that number is, although it might just overflow the display
  area intended for it.

hdtoolbox 40.11 (12.11.2016)

- The partition default setup (two partitions per disk) miscalculated
  the cylinder size. Fixed.

- The function which converts 64 bit integers to text now makes sure
  that the first digit comes out as the first byte of the buffer.

- You can no longer define new "XT" drive types, but you may edit or
  delete them.

- Disk and partition sizes on display are now rounded up, if necessary.
  For example, a partition smaller than 2 GByte by only a few MBytes
  would previously be shown as being 1 GByte in size only: it now
  shows up as being 2 GBytes in size.

- PropGadget size and position calculations are now being performed
  using 64 bit integers, too, because the involve cylinder numbers.

- The block storage device driver version is now cached, so that
  resizing and dragging partitions does not need to reopen the
  driver again and again.

- Added 4GLIMIT command line option, as well as a tool type.

- PixelCyl() and CylPixel() calculations are no longer macros, but
  functions which use 64 bit integer calculation.

- If the disk size is limited to 4 GBytes, resizing and moving partitions
  beyond the 4 GByte boundary no longer works.

- The test which verifies the scsi.device driver version now correctly
  handles 2nd.scsi.device, 3rd.scsi.device, etc. properly, too.

- Recalculation of the number of cylinders used by a partition now uses
  64 bit integers, too.

hdtoolbox 40.12 (12.11.2016)

- Added another NULL pointer check in the drive parameter test code,
  just to be on the safe side.

hdtoolbox 40.13 (15.11.2016)

- Converting BCPL strings to 'C' strings no longer immediately runs into
  trouble with strings longer than 127 character.

- Fixed a few more compiler warnings related to the use of strlen().

- Figured out that readwrite.c/GetRDB() expects to read RigidDiskBlock
  data with each block containing as many bytes as there are in a sector,
  as reported by a READ_CAPACITY SCSI command. This means that the
  RigidDiskBlock is by no means independent of the medium which it is
  stored on.

hdtoolbox 40.14 (15.11.2016)

- If there is a RigidDiskBlock data structure on the medium which
  uses a shorter sector size than was reported by the medium, it will
  be examined and, if necessary, scanning for valid RDB data will
  resume with the shorter sector size.

- RDB blocks which report themselves as containing more data than
  was read from the medium are now ignored and their block checksums
  are no longer verified.

hdtoolbox 40.15 (16.11.2016)

- Check for number of summed long words was compared directly with
  sector size in bytes. Fixed.

hdtoolbox 40.16 (26.11.2016)

- Shell parameters are now read and processed with ReadArgs(). The
  names of the template parameters match the tool types which the
  correspond to.

- Dropped the 4GLIMIT and NO4GLIMIT parameters and tool types. They
  are replaced by LIMIT_4GBYTE, which can be ON/OFF/TRUE/FALSE.

- The sector size reported by the storage hardware can now be overridden
  with the MIN_SECTOR_SIZE and MAX_SECTOR_SIZE parameters/tool types.
  Each override value must be a multiple of 512 bytes, and it must be
  a power of two.

hdtoolbox 40.17 (11.12.2016)

- Added MASK, BUFMEMTYPE and MAXTRANSFER tool types/command line
  parameters. These options can be used to override the default values
  used by the RDB settings written to disk. The MASK, BUFMEMTYPE and
  MAXTRANSFER  parameters must all be given in hexadecimal notation,
  just as you would in a mount file.

- HDToolbox will respect the MASK and BUFMEMTYPE settings when
  performing disk I/O. It also respects the sector size which the
  disk hardware prefers, even if it differs from the MIN_SECTOR_SIZE and
  MAX_SECTOR_SIZE settings. This is accomplished through a new disk
  I/O translation layer.

- More low level code cleanup to improve readability, e.g. replacing
  bit shift operations by multiplication and division operations,
  respectively, removing unnecessary casts, adding function
  prototypes, declaring local functions as static, etc.

- Added checks for failed memory allocation attempts when copying
  RDB data structures. Previously, this would instantly lead to
  crashes.

- Reading the drive init code did not handle errors properly,
  leading to memory leaks. Fixed.

- Reading the bad block list leaked memory in the same way as
  reading the drive init code. Fixed.

- Converting bad block data into BadBlockLists through MakeBadBlockList()
  no longer crashes if memory allocations should fail. It no longer
  leaks memory or returns a truncated BadBlockList.

- Memory allocated for the DriveInit code is now released properly.
  The DriveInit data is also copied properly.

- Memory allocation failure while copying the contents of a
  RigidDiskBlock structure no longer results in the copy to
  contain truncated information.

- Setting up the default partition layout (two partitions of the
  same size, filling all the available storage space; one single
  partition if push comes to shove) may fail due to memory
  allocation problems. This situation is handled a bit better,
  but there's a whole lot of code which is built on top of it
  which will leak memory...

- Scanned the "Using a hard disk" chapter from the 1990 "Using the
  system software" manual which shipped with the Amiga 3000. This
  is the only comprehensive documentation for the program which
  I could find.

hdtoolbox 40.18 (16.12.2016)

- Converted memory allocations and deallocations from AllocMem()
  and FreeMem() to use memory pools.

hdtoolbox 40.19 (18.12.2016)

- Overriding the sector size reported by the drive now adjusts
  the number of cylinders accordingly, preserving the size of
  the medium (if possible). Previously, the total size of the
  medium would be misrepresented, which would lead to all sorts
  of strange effects.

hdtoolbox 40.20 (31.12.2016)

- SCSI transfer buffers and IO buffers are now always allocated
  consistently of the proper BufMemType, and are no longer taken
  from the stack. This should avoid massive problems in setups
  where DMA is not possible into specific memory types.

- The drive detection mechanism always checked for SCSI-1 and
  disregarded SCSI-2 drive types. Fixed.

- Drive scanning made too many redundant requests and was
  therefore unnecessarily slow.

- Bad block scanning made too many redundant requests and caused
  on some drive/host adapter combinations recoverable warnings.
  40.20 at least attempts to minimize the number of warnings.

- Previous releases read the sector size once, and then continued
  to use the physical sectorsize of the first drive (whether
  detected or undetected) for all further activities. This release
  resets the sector size accordingly before attempting to switch
  to a new drive.

- SCSI direct transfers were indicated with the wrong io_Data size
  and did not follow the recommendations in the RKRMs. This release
  fixes this and sets IO_Length to sizeof(struct HDScsiCmd) as it
  should. The size of the SCSI transfer is in HDScsiCmd, as always.

hdtoolbox 40.21 (21.1.2017)

- Also uses MODE_SENSE now as an attempt to read the block size
  from a device. Apparently, some optical storage devices do not
  support READ_CAPACITY correctly.

- Runs now INQUIRY first before attempting any other command, and
  does not attempt to run this command again if the first try
  fails. This speeds up scanning by a factor of two.

hdtoolbox 40.22 (22.3.2017)

- Following the discussion with Ralph, HDToolBox now first tries to
  check for the presence of drives with TEST_UNIT_READY and assumes
  a direct access device class if the drive does not respond to
  INQUIRY.

- Ensured that the code now communicates the LUN back to the SCSI
  interface layer. Previous code just always used the LUN 0 (and, hence
  potentially formatted the wrong drive... Ooops!)

- In case a drive does not react on TEST_UNIT_READY, it is not added
  to the drive list anymore.

- Still need to fiddle in a flag for direct SCSI transfer... TODO.

hdtoolbox 40.23 (2.4.2017)

- Added a new checkmark gadget to enable the SCSI direct transfer.
  Seems to work according to my tests, at least.

hdtoolbox 40.24 (3.4.2017)

- Modified the manually created gadgets in the intuition requesters
  to draw in the correct color (though not inverse).

hdtoolbox 40.25 (28.4.2017)

- Added support for DOS\8, FFS with long file names. The FFS itself
  is still experimental.

hdtoolbox 40.26 (12.8.2017)

- A couple of pointers were not reset correctly, causing memory corruption
  in case the file system page was re-openend.

- The DirCache and LongFileName flags were not un-checked correctly.

- The memory release of the gadget structures were very questionable
  and could have leaked (or worse)

hdtoolbox 46.1 (12.8.2017)

- This release replaces DOS\8 support with DOS\6 and DOS\7 support.

- Some minor cleanup avoids code replication in multiple places.
	
hdtoolbox 46.2 (23.9.2017)

- The partition size always selected the largest unit such that the partition
  size is at least one digit large, then rounds up. This is confusing if only
  a single digit remains. Changed this.
  
hdtoolbox 46.3 (24.9.2017)

- Scanning for drives failed as soon as a device failed to open. While this
  works according to the specs, some devices don't seem to like to open even
  just because no medium is attached.
  
hdtoolbox 46.4 (2.10.2017)

- Due to a pointer mismatch, the bad block list and the file system table
  was never written back to the drive. Due to another pointer mismatch the
  file system segment failed to update.

hdtoolbox 46.5 (29.10.2017)

- Added a file requester for the file system selection.

- Default gadget settings for custom file systems were wrong. The
  file type selection gadgets should be disabled, and the file type
  identifier should be enabled.
  
hdtoolbox 46.6 (7.11.2017)

- The file requester gadget is now disabled in case HDToolBox
  cannot open ASL. Note that evn the 46.5 code worked correctly
  in the absence of ASL.
  
hdtoolbox 46.7 (3.1.2018)

- Refreshes now the window frame after dragging the partition size arrow
  to avoid a graphical glitch.

hdtoolbox 46.8 (13.1.2018)

- Default DOS type for newly created drive types is now DOS/3, not DOS/1.

- Fixed the logic by which selection of drive types disables or enables
  the identifier button.

- Standard FFS/DOS file types no longer appear in the checkbox gadget but
  are selected by the buttons below.
  
hdtoolbox 46.9 (21.1.2018)

- Fixed an off-by-one error in the computation of the high cylinder within
  a 4GB boundary.

hdtoolbox 46.10 (7.2.2018)

- Fixed a graphical glitch leading to partition size arrow label's text 
  damaging the right window border

- Window is now opening in the center of the screen

- Rewrote the startup code, shortening the binary a bit by removing
  all the SAS/C cruft.
  
hdtoolbox 46.11 (10.2.2018)

- Due to an oversight, the hdtoolbox did not release some resources when aborting.

- The code no longer warns in automatic setup if the FFS is missing on the disk
  but the ROM contains a very recent FFS version (>= V45).

- If the autosetup still warns, "continue" continues now without an FFS being
  installed. This may, unfortunately, result in setups where the user will not be
  able to access all partitions and/or even damage partitions. You asked for it, so
  I afraid this is what you get...

hdtoolbox 46.12 (11.2.2018)

- In case hdtoolbox could not load the FFS, it released the wrong RDB,
  hence causing a complete mess-up.
  
hdtoolbox 46.13 (4.3.2018)

- HDToolBox now also accepts 0x and $ as prefixes for hex numbers in command line
  arguments and tooltypes.
 
hdtoolbox 46.14 (7.3.2018)

- Experimentally requesting at least the defect list header when requesting the
  defect list such that the data size is non-zero.

hdtoolbox 46.15 (7.7.2018)

- In case a file system was deleted from the list of file systems, HDToolBox
  forgot to adjust the active element of the listview gadget showing all
  file systems such that the displayed list was inconsistent with the internally
  selected list.
  
hdtoolbox 46.16 (17.7.2018)

- When probing devices, the HDToolBox no longer continues on the same unit in
  case one of the LUNs already times out.

hdtoolbox 46.17 (28.7.2018)

- The interaction between the long file names and dir cache file system type
  gadgets were not yet correct. Fixed.
  
hdtoolbox 46.18 (6.10.2018)

- The arcane magic how to arrive at a disk geometry was modified a bit such
  that at least the number of heads coincides with what the drive delivers.

- ReadCapacity no longer falls back to mode sense if the track size is
  to be read.

hdtoolbox 46.19 (6.10.2018)

- The HDToolBox stopped scanning when it failed to detect a unit, and did not
  try any further units behind a non-found unit.

hdtoolbox 46.20 (24.11.2018)

- The HDToolBox always set the low cylinder of the first partition to 2,
  even though this may result in too few blocks for the RDB. Instead, the
  computation ensures now that the RDB is at least 128K in size.

----------------------- AmigaOS 3.2 project --------------------------

hdtoolbox 46.21 (29.12.2018)

- In case a harddisk has more than 2^23 blocks (4GB with 512 byte blocks),
  the default block size will be set to 4096 (8 sectors per block) thus
  allowing the FFS to reduce the size of the bitmap.

- Under the same conditions, the number of blocks per cylinder is rounded
  down to the next multiple of 8 to ensure that partition boundaries lie
  at 4K block bounds. This may help to reduce write-amplification on SD
  cards and harddisks using 4K sectors internally.

hdtoolbox 46.22 (13.05.2019)

- Fixed a bug that caused SCSI Address and Lun always being printed as 
  zero in the partitioning window. Possibly introduced with switching
  compiler from Lattice to SAS/C.

hdtoolbox 46.23 (11.06.2019)

- When creating a new file system, HDToolBox now also fills in a more
  reasonable stacksize as the default stack size of 600 bytes is
  probably a bit too low to be practical.

hdtoolbox 46.24 (23.06.2019)

- When changing the block size to something different than 512 bytes/block,
  HDToolBox always created a file system entry with patch flags that patch
  up the byte size. This has the side effect that this file system uses
  the indicated number of bytes per block, regardless of what the RDB has to
  say about it, potentially causing invalid mounts or even data loss. As
  I have no idea what this feature was supposed to do, I am disabling it
  and instead relying on the RDB to provide valid information.

hdtoolbox 46.25 (26.08.2019)

- hdtoolbox resets now some fields before it attempts to read them.

- The READ CAPACITY command used to return the track size interpreted
  the return code incorrectly as track size, so it is the block number
  of the last block within the track. There is now a conditional fix
  for this problem.

hdtoolbox 47.1 (19.10.2019)

- Added the possibility to modify the BUFMEMTYPE of the partition.

hdtoolbox 47.2 (19.10.2019)

- A bit of cleanup: utility.library used for math, exec functions
  instead of sc.lib function, zero-initialized variables moved into
  the bss segment.

- The size of the BufMemType selector was adjusted to fit to the
  rest of the gadgets above.

- Enabling/Disabling the BufMemType gadget did not work consistently.

hdtoolbox 47.3 (7.12.2019)

- For some strange reason, HDToolBox did not refresh the arrow for
  partition dragging if it was at the left edge of the dragging
  area.

hdtoolbox 47.4 (27.1.2020)

- The partition size gadget was not recomputed in case the partition
  was moved by dragging.

- The computation of the partition size for the decision of the default
  file system block size was wrong.

hdtoolbox 47.5 (10.04.2020)

- All figures are now KB, MB, GB, TB

hdtoolbox 47.6 (06.08.2020)

- Fixed a cosmetic issue of the drive type view

hdtoolbox 47.7 (17.8.2020)

- Updated the function which writes the drive definitions to disk.
  It now checks every step along the way that seeking, reading and
  writing works and will show an error message if this does not
  work out. Only if there is no existing drive definition file will
  it attempt to create a new one (previously, it would have tried this
  if any other kind of error had occured). The names of the function
  parameters now follow their purpose, e.g. "flag" now reads as
  "overwrite_def", indicating whether or not an existing definition
  should be overwritten instead of appended to an existing file.

- Updated the function which deals with removal of drive definition
  records from the drive definition file. It now pays closer attention
  to the results/error indications returned by the dos.library functions
  it uses.

- Added a new commmand line parameter and corresponding tool type
  SKIP_WRITE_PROTECTED which can be set to YES/ON or NO/OFF. If
  this switch is enabled, then any attempt to update or overwrite
  the drive definitions file will be skipped if either an existing
  drive definitions file is protected from deletion, or if the
  volume on which the drive definitions file would reside is not
  write-enabled.

hdtoolbox 47.8 (29.8.2020)

- The possible options for the LIMIT_4GBYTE and SKIP_WRITE_PROTECTED
  parameters used to be on/off/true/no, which is more than a little
  inconsistent. The options now are: on/off, true/false and yes/no.

- The partition memory type validation which is part of reading the
  RDB structures should be a little bit more robust now.

hdtoolbox 47.9 (29.10.2020)

- The cylinder numbers could only be up to 6 digits- now extended to 7 digits
  Let's hope no ill overflow happens - at least a test worked nicely

hdtoolbox 47.10 (05.11.2020)

- Move some elements a little bit further to make space for max cylinder number
