add rescued sectors count to output and fsync(..) call after writing to image
parent
ef80204e3e
commit
eb6bed5473
6
main.c
6
main.c
|
@ -17,6 +17,8 @@ long devSectorCount = -1;
|
|||
|
||||
char *map;
|
||||
|
||||
int cntReadSectors = 0;
|
||||
|
||||
void printUsage();
|
||||
|
||||
int loadScratchMap(char *filename, int size, char *map);
|
||||
|
@ -124,7 +126,7 @@ int scratch(int dev, int image,int firstSector, int cntSectors, int sectSize){
|
|||
for (int try = 0; try < 16; try ++){
|
||||
for (int sect = firstSector; sect < (firstSector + cntSectors); sect++){
|
||||
long offset = (long)sect * sectSize;
|
||||
printf("\r#%08i 0x%08lX %i", sect, offset, try);
|
||||
printf("\r#%08i 0x%08lX %i (%i rescued / %i to go)", sect, offset, try, cntReadSectors, (cntSectors - cntReadSectors));
|
||||
fflush(stdout);
|
||||
|
||||
if (map[sect])
|
||||
|
@ -147,7 +149,9 @@ int scratch(int dev, int image,int firstSector, int cntSectors, int sectSize){
|
|||
printf("\nshort read!\n");
|
||||
}
|
||||
write(image, p, nread);
|
||||
fsync(image);
|
||||
map[sect] = 0x01;
|
||||
cntReadSectors++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue