me.jahnen.libaums.core.driver.scsi.ScsiBlockDevice.kt
line 326
require(buffer.remaining() % blockSize == 0) { "buffer.remaining() must be multiple of blockSize!" }
This will check the remaining buffer is multiple of the blockSize, but in Fat/Fat32, file size which recorded at x1c offset is the FILE SIZE, not the REAL occupied size.
For the fatfile, it returns the FILE SIZE:
(1)me.jahnen.libaums.core.fs.fat32.FatFile.kt, line 54
get() = entry.fileSize
(2)me.jahnen.libaums.core.fs.fat32.FatLfnDirectoryEntry.kt, line 117
get() = actualEntry.fileSize
(3)me.jahnen.libaums.core.fs.fat32.FatDirectoryEntry.kt, line 282
get() = getUnsignedInt32(FILE_SIZE_OFF)
I think either rewrite the FatFile.fileSize with adding some "round to blockSize" codes, or add a getRealFileSize() function would be OK.
Problem
me.jahnen.libaums.core.driver.scsi.ScsiBlockDevice.kt line 326 require(buffer.remaining() % blockSize == 0) { "buffer.remaining() must be multiple of blockSize!" } This will check the remaining buffer is multiple of the blockSize, but in Fat/Fat32, file size which recorded at x1c offset is the FILE SIZE, not the REAL occupied size.
For the fatfile, it returns the FILE SIZE: (1)me.jahnen.libaums.core.fs.fat32.FatFile.kt, line 54 get() = entry.fileSize (2)me.jahnen.libaums.core.fs.fat32.FatLfnDirectoryEntry.kt, line 117 get() = actualEntry.fileSize (3)me.jahnen.libaums.core.fs.fat32.FatDirectoryEntry.kt, line 282 get() = getUnsignedInt32(FILE_SIZE_OFF)
I think either rewrite the FatFile.fileSize with adding some "round to blockSize" codes, or add a getRealFileSize() function would be OK.