181 Commits

Author SHA1 Message Date
Michel Machado
64d169e248 Mark experimental applications as stable
The code of the applications f3probe, f3brew, and f3fix is now
mature, and they have not received any significant bug report for
about six months.

From now on, one needs to compile these applications with
```make extra```
2016-03-29 12:56:43 -04:00
Michel Machado
abf811f04b General review of @zwpwjwtz's patch 2016-03-29 12:35:22 -04:00
Michel Machado
01a1be7933 Merge pull request #40 from zwpwjwtz/master
Replace parse_args() with argp_parse() from argp.h

it also adda option "--show-progress" to force program displaying the progress even when STDOUT is not a TTY (see #21).
2016-03-29 09:50:36 -04:00
zwpwjwtz
fb187b4c71 Replace parse_args() with argp_parse() from argp.h 2016-03-29 15:37:13 +08:00
Michel Machado
599a79a7e4 Merge pull request #38 from notaz/ldflags
allow users to specify linker flags
2016-03-14 08:59:01 -04:00
Grazvydas Ignotas
70962dcfaa allow users to specify linker flags
Traditionally LDFLAGS is used for this, it's what I've tried first
but it wasn't accepted.
2016-03-12 17:39:05 +02:00
Michel Machado
cbe8d6167a Merge pull request #36 from oreinert/master
man page: Add reference to F3 web page
2016-01-21 08:20:42 -05:00
Olav Reinert
8ab3d878b5 man page: Add reference to F3 web page 2016-01-20 21:21:20 +01:00
Michel Machado
b8e825a331 f3write: polish fill_buffer()
This commit was inspired by the following commit:
52e252f5d6dc6d10fd85a45b0774bb0b29d5f989
f3read: avoid compiler warning
2016-01-05 10:06:08 -05:00
Michel Machado
77d2ceb374 f3probe: avoid compiler warning
When using -O2, GCC was issuing the following warning:

cc -O2 -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o f3probe.o f3probe.c
f3probe.c: In function ‘main’:
f3probe.c:446:13: warning: ‘sdev’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   sdev_flush(sdev);
             ^
f3probe.c:369:30: note: ‘sdev’ was declared here
  struct device *dev, *pdev, *sdev;
                              ^

NOTE: The warning was wrong.
      GCC could not follow that @args->save being true implied
      @sdev to not be NULL.

This patch addresses one of the issues discussed here:
https://github.com/AltraMayor/f3/issues/34
2016-01-04 13:49:05 -05:00
Michel Machado
52e252f5d6 f3read: avoid compiler warning
When using -O2, GCC was issuing the following warning:

cc -O2 -std=c99 -Wall -Wextra -pedantic -MMD -ggdb -c -o f3read.o f3read.c
f3read.c: In function ‘validate_file’:
f3read.c:95:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
   offset = *((uint64_t *) sector);
   ^
2016-01-04 13:30:01 -05:00
Michel Machado
2811fb27f5 libutils: fix a typo in a comment 2016-01-04 09:57:38 -05:00
Michel Machado
0079634a08 libutils: make ceiling_log2() inline v6.0 2015-12-22 13:46:23 -05:00
Michel Machado
d8694268a6 f3probe: warn about how much time probing takes
This patch addresses issue discussed here:
https://github.com/AltraMayor/f3/issues/33
2015-12-21 09:37:43 -05:00
Michel Machado
69d696090c f3probe: deal with drives that do not report their size
This patch addresses issue discussed here:
https://github.com/AltraMayor/f3/issues/30
2015-12-09 10:55:56 -05:00
Michel Machado
bac59102da f3probe: present time in a friendly format 2015-11-29 14:48:15 -05:00
Michel Machado
0e6729d97b Highlight the dependencies in README.md 2015-11-25 15:29:48 -05:00
Michel Machado
1a576cb6dc f3probe: speed up non-destructive mode
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.
2015-11-17 16:51:29 -05:00
Michel Machado
08dd0e9061 f3probe: avoid division by zero
Since some fake drives do not require resets,
the option --time-ops was triggering a division by zero for
those drives.
2015-11-16 13:09:44 -05:00
Michel Machado
e7769bb77d f3probe: relax cache size comparision in unit test 2015-11-16 12:49:18 -05:00
Michel Machado
3d04fc7b55 f3probe: change default reset to --reset-type=1 2015-11-14 09:33:19 -05:00
Michel Machado
70e07816af f3probe: support any reset type (even no reset!)
This patch allows f3probe to report an accurate usable size
with any type of reset.
It works even with --reset-type=2 that is no reset at all.
2015-11-14 09:26:01 -05:00
Michel Machado
8348bcd909 f3probe: fix unit test
The name of a variable as mistyped.
The bug was innocuous, though.
2015-11-14 08:53:11 -05:00
Michel Machado
83a9c1c87d f3probe/f3brew: add --reset-type=2
Reset type 2 does not reset, that is, it does nothing.
This parameter is only helpful to study the effects of cache on
the F3 algorithms.
2015-11-14 08:38:33 -05:00
Michel Machado
49c7d5fc63 f3probe: avoid resets for drives without any cache 2015-11-13 21:07:12 -05:00
Michel Machado
cedb3f17d2 f3probe: fix a (supposed) race condition
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.
2015-11-13 20:18:12 -05:00
Michel Machado
bf550a0ce9 f3probe: better ballance writes and resets while bisecting
f3probe was using just 3 writes to make a decision on how to
balance resets and writes.
When the first 3 writes were faster than normal,
the next pass would go for an unrealistic number of writes.

This patch requires at least 10 writes;
in practice, it will uses 15 writes.
The larger number of writes allows for a better balance.
2015-11-13 20:07:06 -05:00
Michel Machado
73e831b35e Bump version to 6.0 2015-11-13 15:19:37 -05:00
Michel Machado
e3fe7a006d f3probe: fix allocation error of safe device
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.
2015-11-13 14:40:43 -05:00
Michel Machado
591ad8a7bf f3probe: add a blank line when --destructive is used
When option --destructive was being used,
f3probe was not spacing the final diagnosis message.
2015-11-13 14:37:42 -05:00
Michel Machado
59ab4e9a8e f3brew: correct messages that refer to f3probe
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...
==================================================================
2015-11-13 14:05:51 -05:00
Michel Machado
fe4e9dd2e7 f3probe: speed up writing and reading
This patch takes advantage of the new interface of struct device
to write and read sequential blocks with a single call.
2015-11-13 11:14:36 -05:00
Michel Machado
067802ca5a f3brew: speed up writing and reading
This patch changes the interface of struct device to allow
writes and reads of sequential blocks with a single call.
2015-11-13 09:09:33 -05:00
Michel Machado
5d76cd84b6 f3probe: deal with permanent cache
This patch addresses issue discussed here:
https://github.com/AltraMayor/f3/issues/15

Given the structure of the solution implemented in this patch,
it's also expected to address the following issue:
https://github.com/AltraMayor/f3/issues/16
2015-11-12 09:55:39 -05:00
Michel Machado
3f0efeb12f f3probe/f3brew: add cache to the model
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.
2015-11-12 09:55:39 -05:00
Michel Machado
57fded9501 f3write/f3read: scripts must be in the same folder 2015-11-11 16:04:00 -05:00
Michel Machado
88c03dea90 f3fix: add missing parameter in argp_error() calls
@pbludov reported and fixed this bug in the following issue:
https://github.com/AltraMayor/f3/issues/26
2015-11-10 14:00:47 -05:00
Michel Machado
246011f053 f3brew: work at block level
f3brew were working at sector level because
it was borrowing code from f3write/f3read which work at that level.
This patch writes new functions to fill out, and validate blocks.

This change is important because
f3probe needs to validate blocks as well for its coming features.

A side effect of this patch is that all experimental applications
(i.e. f3probe, f3brew, and f3fix) no longer depend on
code from f3write and f3read.
2015-11-04 16:41:04 -05:00
Michel Machado
cc24fdf5b2 f3probe: fix a memory leak
This memory leak is innocuous since it happens a little before
f3probe exits.
2015-11-04 11:03:13 -05:00
Michel Machado
add20ef7ae f3brew: test if device moved after reset
Devices might change their names after a reset.
This patch simply adds the same warning that
f3probe already has to f3brew.
2015-11-03 12:55:30 -05:00
Michel Machado
c47a7642fb f3brew: handle lack of access right
When a non-root user called f3brew on a device,
f3brew would issue the following error message:

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.
f3brew: f3brew.c:484: main: Assertion `dev' failed.
Aborted (core dumped)

This patch avoids the assert().
2015-11-03 12:43:03 -05:00
Michel Machado
8305e5ad5f f3brew: add block size information
Not only does f3brew list block size, but f3brew also uses
this information to better report results.
2015-11-03 09:06:23 -05:00
Michel Machado
277f61a403 f3probe: rename real size to usable size
f3probe does not try to find the real amount of memory that
a fake card has, but the usable about of memory, that is,
the memory from the first block (i.e. block zero) to
the block before the first failed block.

A fake card may have more memory, but it would be spread among
failed blocks, so it is not usable.
2015-10-27 09:00:12 -04:00
Michel Machado
795424c873 f3brew: make output easier to read
The results are grouped, so the output is not too verbose.
2015-10-09 16:43:09 -04:00
Michel Machado
c77db3d9e0 f3brew: fixed bugs
f3brew were inverting the semantic of parameter --debug, and
it was calculating a wrong last block for drives.
2015-10-09 14:41:23 -04:00
Michel Machado
015facf8fe Merge pull request #23 from bor/fix/README
Adapt syntax of README.md for markdown
2015-09-14 15:29:49 -04:00
Michel Machado
fc4af9d255 Merge pull request #22 from bor/fix/Makefile
Add 'install -d' to create dirs in case they don't exists.

This fix helps creating packages under chroot/etc.
for example see
2015-09-14 15:24:23 -04:00
Sergiy Borodych
310eac5bae adapt syntax for markdown
to show it as more nicer at github
2015-09-14 12:54:50 +03:00
Sergiy Borodych
77c00662ab add 'install -d' for prepare dirs (ensure that dirs exists) 2015-09-14 12:25:11 +03:00
Michel Machado
bcf71585a8 f3brew: add --do-not-write and --do-not-read
These new options help with writing scripts and repeating tests.
2015-09-02 10:43:36 -04:00