This patch makes f3probe issue single calls of
sequential reads and writes wherever is possible to speed up
the non-destructive (i.e. conservative) mode.
Notice that the non-destructive mode only recovers the usable
blocks of fake drives, and all blocks of legit drives.
Although I (Michel) am not 100% sure, the kernel seemed to be
allowing reads to get data from an internal cache in the kernel;
the condition is tricky to reproduce, and trickier to be sure
since fake drives are not reliable or preditable.
The results seems more stable with this patch, though.
probe_device_max_blocks() was returning an int that once multiplied
by block_size was out range.
This patch just enforces probe_device_max_blocks() to return
an uint64_t, and does the needed adjustments in the code.
libdevs.c had error messages that mentioned f3probe.
Given that f3brew also uses libdevs.c, this was causing nonsense
error messages such as the following:
==================================================================
$ ./f3brew /dev/sdc
F3 brew 5.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
Your username doesn't have access to device `/dev/sdc'.
Try to run this program as root:
sudo f3probe /dev/sdc
In case you don't have access to root, use f3write/f3read.
Application cannot continue, finishing...
==================================================================
F3 users have identified fake flashes that reserve a portion of
their good memory to use as a permanent cache.
This patch adds this feature to our model in order to allow us to
develop a new probe algorithm to deal with it.
f3probe was using a kernel-recommended logical block size.
This patch allows f3probe to always find
the last good physical block of devices.
This patch also renames option --block-order to --debug-block-order
since f3probe detects the physical block size of devices.
During manual resets, the drive was being identified by
idVendor, idProduct, and serial, what is NOT enough when
the USB device combines two or more drives.
For example the card reader Kingston MobileLite G3
supports two memory cards at the same time.
Discussion on the fixed issue is available here:
https://github.com/AltraMayor/f3/issues/10
User @derekchal was the first to report this problem.
When the memory card in a card reader is removed,
the device is kept, not removed like in the case
the reader itself is unplugged.
This patch handles the `change' events that are generated in
the card-removal case.
The new parameter allows users to test drives with
forced block sizes.
This parameter is only meant to help testing drives whose
*real* sizes are not multiples of their block sizes;
this should be rather rare!
This patch makes f3probe test that the block device passed is
a disk, not a partition or something else.
If the block device is a partition,
the correct disk device is reported.
Example of this new protection in action:
$ sudo f3probe /dev/sdb1
[sudo] password for michel:
F3 probe 4.0
Copyright (C) 2010 Digirati Internet LTDA.
This is free software; see the source for copying conditions.
Device `/dev/sdb1' is a partition of disk device `/dev/sdb'.
You can run this program as follows:
f3probe /dev/sdb
Application cannot continue, finishing...
The code of the old manual reset couldn't handle the case of
the drive changing its filename, i.e. "/dev/sdb" becomes
"/dev/sdc" after the drive is unplugged and plugged back.
Not only this is a bug, in the rare case the user is
testing multiple drives at the same time, this would lead
to bad behavior.
Function map_block_to_usb_dev() was enumerating all USB devices and
comparing their properties to find the one we need.
The new code directly resolves the device from major and minor
number of the block device.
f3brew, f3 block read write, tests block devices
writing and reading blocks directly to devices.
This is a not-functional version of f3brew.
The main contribution of this patch is to reorganize libprobe.{h,c},
so f3brew, and any future application, can reuse the library.