mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-09 07:09:35 -04:00
f3probe: suggest f3fix when the drive is fake
This commit is contained in:
parent
6fbe096089
commit
05eff6e76c
4
f3fix.c
4
f3fix.c
@ -7,10 +7,6 @@
|
|||||||
/* XXX Refactor utils library since f3probe barely uses it. */
|
/* XXX Refactor utils library since f3probe barely uses it. */
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
/* TODO Modify f3probe to suggest using f3fix when the drive is fake.
|
|
||||||
* Wait until f3fix is stable to implement this.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Argp's global variables. */
|
/* Argp's global variables. */
|
||||||
const char *argp_program_version = "F3 Fix " F3_STR_VERSION;
|
const char *argp_program_version = "F3 Fix " F3_STR_VERSION;
|
||||||
|
|
||||||
|
15
f3probe.c
15
f3probe.c
@ -361,6 +361,7 @@ static int test_device(struct args *args)
|
|||||||
uint64_t write_count, write_time_us;
|
uint64_t write_count, write_time_us;
|
||||||
uint64_t reset_count, reset_time_us;
|
uint64_t reset_count, reset_time_us;
|
||||||
const char *final_dev_filename;
|
const char *final_dev_filename;
|
||||||
|
uint64_t last_good_sector;
|
||||||
|
|
||||||
dev = args->debug
|
dev = args->debug
|
||||||
? create_file_device(args->filename, args->real_size_byte,
|
? create_file_device(args->filename, args->real_size_byte,
|
||||||
@ -435,6 +436,7 @@ static int test_device(struct args *args)
|
|||||||
printf("\nWARNING: device `%s' moved to `%s' due to the resets\n\n",
|
printf("\nWARNING: device `%s' moved to `%s' due to the resets\n\n",
|
||||||
args->filename, final_dev_filename);
|
args->filename, final_dev_filename);
|
||||||
|
|
||||||
|
last_good_sector = (real_size_byte >> 9) - 1;
|
||||||
fake_type = dev_param_to_type(real_size_byte, announced_size_byte,
|
fake_type = dev_param_to_type(real_size_byte, announced_size_byte,
|
||||||
wrap, block_order);
|
wrap, block_order);
|
||||||
switch (fake_type) {
|
switch (fake_type) {
|
||||||
@ -444,11 +446,18 @@ static int test_device(struct args *args)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FKTY_BAD:
|
case FKTY_BAD:
|
||||||
|
printf("Bad news: The device `%s' is damaged\n",
|
||||||
|
final_dev_filename);
|
||||||
|
break;
|
||||||
|
|
||||||
case FKTY_LIMBO:
|
case FKTY_LIMBO:
|
||||||
case FKTY_WRAPAROUND:
|
case FKTY_WRAPAROUND:
|
||||||
case FKTY_CHAIN:
|
case FKTY_CHAIN:
|
||||||
printf("Bad news: The device `%s' is a counterfeit of type %s\n",
|
printf("Bad news: The device `%s' is a counterfeit of type %s\n\n"
|
||||||
final_dev_filename, fake_type_to_name(fake_type));
|
"You can \"fix\" this device using the following command:\n"
|
||||||
|
"f3fix --last-sec=%" PRIu64 " %s\n",
|
||||||
|
final_dev_filename, fake_type_to_name(fake_type),
|
||||||
|
last_good_sector, final_dev_filename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -463,7 +472,7 @@ static int test_device(struct args *args)
|
|||||||
report_order("\t Module:", wrap);
|
report_order("\t Module:", wrap);
|
||||||
report_order("\t Block size:", block_order);
|
report_order("\t Block size:", block_order);
|
||||||
assert(block_order >= 9);
|
assert(block_order >= 9);
|
||||||
report_sector("\tLast good sector:", (real_size_byte >> 9) - 1);
|
report_sector("\tLast good sector:", last_good_sector);
|
||||||
printf("\nProbe time: %.2f seconds\n", time_s);
|
printf("\nProbe time: %.2f seconds\n", time_s);
|
||||||
|
|
||||||
if (args->time_ops) {
|
if (args->time_ops) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user