mirror of
https://github.com/dkgrizzly/GreenSCSI.git
synced 2024-11-21 12:31:20 +00:00
preAllocate fail
preAllocate has angered the TrackZero and must be punished, out with preAllocate, in with writing zeros 512 bytes at a time.
This commit is contained in:
parent
bc114096ac
commit
c5c4c51667
16
src/cmd.ino
16
src/cmd.ino
@ -1196,6 +1196,7 @@ void makeimagecmd(int argc, char **argv) {
|
|||||||
Serial.printf(": Unable to open '%s'.\r\n", tmp_path);
|
Serial.printf(": Unable to open '%s'.\r\n", tmp_path);
|
||||||
} else {
|
} else {
|
||||||
// Take advantage of our cylinders being 1MB
|
// Take advantage of our cylinders being 1MB
|
||||||
|
#if 0
|
||||||
if(!file.preAllocate(fileSize)) {
|
if(!file.preAllocate(fileSize)) {
|
||||||
file.close();
|
file.close();
|
||||||
sd.remove(tmp_path+3);
|
sd.remove(tmp_path+3);
|
||||||
@ -1206,10 +1207,25 @@ void makeimagecmd(int argc, char **argv) {
|
|||||||
Serial.printf(": Pre-allocate failed, SD Card must be formatted as ExFat.\r\n");
|
Serial.printf(": Pre-allocate failed, SD Card must be formatted as ExFat.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(!strcmp(argv[2], "msdos")) {
|
if(!strcmp(argv[2], "msdos")) {
|
||||||
file.write(mbr_bin, 512);
|
file.write(mbr_bin, 512);
|
||||||
|
fileSize -= 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(zero, 0, 512);
|
||||||
|
|
||||||
|
while(fileSize) {
|
||||||
|
if((fileSize & 0x7FFF) == 0)
|
||||||
|
Serial.printf(".");
|
||||||
|
if((fileSize & 0x3FFFFF) == 0)
|
||||||
|
Serial.printf("\r\n");
|
||||||
|
file.write(zero, 512);
|
||||||
|
fileSize -= 512;
|
||||||
|
}
|
||||||
|
Serial.printf("\r\n");
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user