Include the file size in the write job struct for future reference in data rate and progress bar
This commit is contained in:
parent
c11bdd7f47
commit
804a6b1485
1 changed files with 5 additions and 1 deletions
|
|
@ -27,6 +27,8 @@
|
|||
#define BLOCKSIZE (4 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#define BYTES_TO_MIB(bts) ((double)bts / (1024 * 1024))
|
||||
|
||||
// clang-format off
|
||||
const char help[] =
|
||||
"Usage:\n"
|
||||
|
|
@ -50,6 +52,7 @@ struct write_job {
|
|||
char *buffer2; /* For memcmp integrity checks */
|
||||
size_t bufsize;
|
||||
size_t block_size;
|
||||
size_t total_bytes;
|
||||
char verify_only;
|
||||
} wjob = {0};
|
||||
|
||||
|
|
@ -207,6 +210,7 @@ int main(int argc, char *argv[]) {
|
|||
wjob.bufsize = BLOCKSIZE;
|
||||
wjob.block_size = BLOCKSIZE;
|
||||
|
||||
wjob.total_bytes = file_stat.st_size;
|
||||
assert(file_stat.st_size >= 0);
|
||||
|
||||
perform_write(&wjob);
|
||||
|
|
@ -216,7 +220,7 @@ int main(int argc, char *argv[]) {
|
|||
if (wjob.buffer2)
|
||||
free(wjob.buffer2);
|
||||
|
||||
printf("\nOkay!\n");
|
||||
printf("\n%.1f MiB's written and verified.\nAll good!\n", BYTES_TO_MIB(wjob.total_bytes));
|
||||
exit(0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue