diff -Nru f3-7.0/changelog f3-7.1/changelog --- f3-7.0/changelog 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/changelog 2018-07-27 08:10:35.000000000 +0000 @@ -1,3 +1,9 @@ +Version 7.1 - Jul 27, 2018 + + * fix compilation issues on non-Linux OSs + * f3write: make parameter --max-write-rate work precisely + * f3probe: change default reset type to RT_NONE + Version 7.0 - Dec 21, 2017 * stable version of f3probe, f3fix, and f3brew (Linux only) diff -Nru f3-7.0/debian/changelog f3-7.1/debian/changelog --- f3-7.0/debian/changelog 2018-01-06 15:08:16.000000000 +0000 +++ f3-7.1/debian/changelog 2018-08-21 20:52:59.000000000 +0000 @@ -1,3 +1,18 @@ +f3 (7.1-1) unstable; urgency=medium + + [ Helmut Grohne ] + * Fix FTCBFS: Let dh_auto_build pass cross tools to make. (Closes: + #894141) + + [ Antoine Beaupré ] + * New upstream release. + * Switch Vcs-* URLs to salsa + * update standards to 4.2, no change + * switch to tracking upstream master branch and tags to have + reproducible tarballs + + -- Antoine Beaupré Tue, 21 Aug 2018 16:52:59 -0400 + f3 (7.0-1) unstable; urgency=medium * New upstream release diff -Nru f3-7.0/debian/control f3-7.1/debian/control --- f3-7.0/debian/control 2018-01-06 15:08:16.000000000 +0000 +++ f3-7.1/debian/control 2018-08-21 20:52:59.000000000 +0000 @@ -3,10 +3,10 @@ Priority: optional Maintainer: Antoine Beaupré Build-Depends: debhelper (>= 10), libparted-dev, libudev-dev -Standards-Version: 3.9.8 +Standards-Version: 4.2.0 Homepage: http://oss.digirati.com.br/f3 -Vcs-Browser: https://anonscm.debian.org/git/collab-maint/f3.git -Vcs-Git: https://anonscm.debian.org/git/collab-maint/f3.git +Vcs-Browser: https://salsa.debian.org/debian/f3 +Vcs-Git: https://salsa.debian.org/debian/f3.git Package: f3 Architecture: linux-any diff -Nru f3-7.0/debian/gbp.conf f3-7.1/debian/gbp.conf --- f3-7.0/debian/gbp.conf 2018-01-06 15:08:16.000000000 +0000 +++ f3-7.1/debian/gbp.conf 2018-08-21 20:52:59.000000000 +0000 @@ -1,2 +1,3 @@ [DEFAULT] debian-branch=debian +upstream-tag=v%(version)s diff -Nru f3-7.0/debian/README.source f3-7.1/debian/README.source --- f3-7.0/debian/README.source 1970-01-01 00:00:00.000000000 +0000 +++ f3-7.1/debian/README.source 2018-08-21 20:52:59.000000000 +0000 @@ -0,0 +1,17 @@ +f3 for Debian +------------- + +This package is maintained with git-buildpackage. While it has a watch +file and can work with upstream tarballs, those can also be generated +with git-buildpackage provided the proper `upstream` branch is added to the git repository, like this: + + git remote add github https://github.com/AltraMayor/f3/ + git fetch github + git branch upstream github/master + +The package can then be built with a simple: + + gbp buildpackage + + -- Antoine Beaupré , Tue, 21 Aug 2018 17:10:37 -0400 + diff -Nru f3-7.0/debian/rules f3-7.1/debian/rules --- f3-7.0/debian/rules 2018-01-06 15:08:16.000000000 +0000 +++ f3-7.1/debian/rules 2018-08-21 20:52:59.000000000 +0000 @@ -8,7 +8,7 @@ override_dh_auto_build: dh_auto_build - $(MAKE) extra + dh_auto_build -- extra override_dh_auto_install: dh_auto_install -- PREFIX=/usr diff -Nru f3-7.0/doc/conf.py f3-7.1/doc/conf.py --- f3-7.0/doc/conf.py 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/doc/conf.py 2018-07-27 08:10:35.000000000 +0000 @@ -58,9 +58,9 @@ # built documents. # # The short X.Y version. -version = '7.0' +version = '7.1' # The full version, including alpha/beta/rc tags. -release = '7.0' +release = '7.1' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff -Nru f3-7.0/doc/introduction.rst f3-7.1/doc/introduction.rst --- f3-7.0/doc/introduction.rst 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/doc/introduction.rst 2018-07-27 08:10:35.000000000 +0000 @@ -63,7 +63,7 @@ `here `__. The following command uncompresses the files:: - $ unzip f3-7.0.zip + $ unzip f3-7.1.zip Compile stable software on Linux or FreeBSD @@ -80,7 +80,13 @@ Compile stable software on Windows/Cygwin ----------------------------------------- -On Cygwin, you need special flags:: +If you haven't already, install the following Cygwin packages and their dependencies: + +- `gcc-core` +- `make` +- `libargp-devel` + +To build, you need special flags:: export LDFLAGS="$LDFLAGS -Wl,--stack,4000000 -largp" make @@ -107,8 +113,8 @@ port install f3 -Compiling the lastest development version from the source code -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Compiling the latest development version from the source code +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most of the f3 source code builds fine using XCode, the only dependency missing is the GNU C library "argp". You can build argp from scratch, or @@ -148,22 +154,16 @@ See https://trac.macports.org/browser/trunk/dports/sysutils/f3/Portfile for more information. -4) Set compilation flags. These following environment variables are used - in the Makefile to locate the argp library: - - HomeBrew:: +4) Build F3:: - export CFLAGS="$CFLAGS -I/usr/local/include/" - export LDFLAGS="$LDFLAGS -L/usr/local/lib/ -largp" + When using Homebrew, you can just run:: - MacPorts:: - - export CFLAGS="$CFLAGS -I/opt/local/include/" - export LDFLAGS="$LDFLAGS -L/opt/local/lib/ -largp" + make -5) Build F3:: + When using MacPorts, you will need to pass the location where MacPorts + installed argp-standalone:: - make + make ARGP=/opt/local The extra applications for Linux -------------------------------- diff -Nru f3-7.0/doc/usage.rst f3-7.1/doc/usage.rst --- f3-7.0/doc/usage.rst 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/doc/usage.rst 2018-07-27 08:10:35.000000000 +0000 @@ -598,7 +598,7 @@ $ sudo ./f3probe --destructive --time-ops /dev/sdb [sudo] password for michel: - F3 probe 7.0 + F3 probe 7.1 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. @@ -673,7 +673,7 @@ $ sudo ./f3probe --time-ops /dev/sdc [sudo] password for michel: - F3 probe 7.0 + F3 probe 7.1 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. @@ -733,7 +733,7 @@ :: $ sudo ./f3fix --last-sec=16477878 /dev/sdb - F3 fix 7.0 + F3 fix 7.1 Copyright (C) 2010 Digirati Internet LTDA. This is free software; see the source for copying conditions. diff -Nru f3-7.0/f3probe.c f3-7.1/f3probe.c --- f3-7.0/f3probe.c 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/f3probe.c 2018-07-27 08:10:35.000000000 +0000 @@ -520,7 +520,24 @@ .keep_file = false, .save = true, .min_mem = false, - .reset_type = RT_USB, + + /* RT_NONE is the only reliable reset type against fake flash. + * See issue #81 for details: + * https://github.com/AltraMayor/f3/issues/81 + * + * A side benefit of this reset type is that it works on + * non-USB-backed drives, such as card readers that are + * commonly built in laptops. + * See issue #79 for details: + * https://github.com/AltraMayor/f3/issues/79 + * + * A negative side effect is that f3probe runs slower + * for cases in which RT_USB would work. But users can + * still request the reset type RT_USB by + * passing --reset-type=1 + */ + .reset_type = RT_NONE, + .time_ops = false, .real_size_byte = 1ULL << 31, .fake_size_byte = 1ULL << 34, diff -Nru f3-7.0/f3read.1 f3-7.1/f3read.1 --- f3-7.0/f3read.1 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/f3read.1 2018-07-27 08:10:35.000000000 +0000 @@ -1,5 +1,5 @@ .\"Text automatically generated by txt2man -.TH F3 "1" "December 2017" "F3 7.0" "test real flash memory capacity" +.TH F3 "1" "July 2018" "F3 7.1" "test real flash memory capacity" .SH NAME \fBf3write, f3read \fP- test real flash memory capacity .SH SYNOPSIS diff -Nru f3-7.0/f3write.c f3-7.1/f3write.c --- f3-7.0/f3write.c 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/f3write.c 2018-07-27 08:10:35.000000000 +0000 @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -148,12 +149,10 @@ int step; /* Blocks to write before measurement. */ int blocks_per_delay; - /* Maximum number of blocks to write before measurement. - * This parameter is used to bound the write rate. - */ - int max_blocks_per_delay; /* Delay in miliseconds. */ int delay_ms; + /* Maximum write rate in bytes per second. */ + double max_write_rate; /* Number of measurements after reaching FW_STEADY state. */ uint64_t measurements; /* Number of measured blocks. */ @@ -190,26 +189,17 @@ fw->total_size = total_size; fw->total_written = 0; fw->progress = progress; - fw->block_size = 1024; /* 1KB */ - fw->blocks_per_delay = 1; /* 1KB/s */ + fw->block_size = 512; /* Bytes */ + fw->blocks_per_delay = 1; /* 512B/s */ fw->delay_ms = 1000; /* 1s */ + fw->max_write_rate = max_write_rate <= 0 + ? DBL_MAX : max_write_rate * 1024.; fw->measurements = 0; fw->measured_blocks = 0; fw->erase = 0; assert(fw->block_size > 0); assert(fw->block_size % SECTOR_SIZE == 0); - /* Derive @fw->max_blocks_per_delay from @max_write_rate. */ - if (max_write_rate <= 0) { - /* This is the most common case. */ - fw->max_blocks_per_delay = INT_MAX; - } else { - fw->max_blocks_per_delay = - /* Units: KB/s * ms / B/block = block */ - round((double)max_write_rate * fw->delay_ms - / fw->block_size); - } - move_to_inc_at_start(fw); } @@ -320,8 +310,6 @@ static inline void inc_step(struct flow *fw) { fw->blocks_per_delay += fw->step; - if (fw->blocks_per_delay > fw->max_blocks_per_delay) - fw->blocks_per_delay = fw->max_blocks_per_delay; fw->step *= 2; } @@ -338,10 +326,25 @@ dec_step(fw); } +static inline int is_rate_above(const struct flow *fw, + long delay, double inst_speed) +{ + /* We use logical or here to enforce the lowest limit. */ + return delay > fw->delay_ms || inst_speed > fw->max_write_rate; +} + +static inline int is_rate_below(const struct flow *fw, + long delay, double inst_speed) +{ + /* We use logical and here to enforce both limist. */ + return delay < fw->delay_ms && inst_speed < fw->max_write_rate; +} + static int measure(int fd, struct flow *fw, ssize_t written) { long delay; div_t result = div(written, fw->block_size); + double inst_speed; bool slow_down = false; assert(result.rem == 0); @@ -359,23 +362,26 @@ assert(!posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED)); delay = delay_ms(&fw->t1, &fw->t2); + /* Instantaneous speed in bytes per second. */ + inst_speed = (double)fw->blocks_per_delay * fw->block_size * 1000 / + fw->delay_ms; + switch (fw->state) { case FW_INC: - if (delay > fw->delay_ms) { + if (is_rate_above(fw, delay, inst_speed)) { move_to_search(fw, fw->blocks_per_delay - fw->step / 2, fw->blocks_per_delay); - } else if (delay < fw->delay_ms - && fw->blocks_per_delay < fw->max_blocks_per_delay) { + } else if (is_rate_below(fw, delay, inst_speed)) { inc_step(fw); } else move_to_steady(fw); break; case FW_DEC: - if (delay > fw->delay_ms) { + if (is_rate_above(fw, delay, inst_speed)) { dec_step(fw); - } else if (delay < fw->delay_ms) { + } else if (is_rate_below(fw, delay, inst_speed)) { move_to_search(fw, fw->blocks_per_delay, fw->blocks_per_delay + fw->step / 2); } else @@ -388,10 +394,10 @@ break; } - if (delay > fw->delay_ms) { + if (is_rate_above(fw, delay, inst_speed)) { fw->bpd2 = fw->blocks_per_delay; fw->blocks_per_delay = (fw->bpd1 + fw->bpd2) / 2; - } else if (delay < fw->delay_ms) { + } else if (is_rate_below(fw, delay, inst_speed)) { fw->bpd1 = fw->blocks_per_delay; fw->blocks_per_delay = (fw->bpd1 + fw->bpd2) / 2; } else @@ -402,8 +408,10 @@ update_mean(fw); if (delay <= fw->delay_ms) { - if (fw->blocks_per_delay < fw->max_blocks_per_delay) { + if (inst_speed < fw->max_write_rate) { move_to_inc(fw); + } if (inst_speed > fw->max_write_rate) { + move_to_dec(fw); } else { /* Since we are already writing at * maximum allowed rate, wait until next cycle. @@ -420,10 +428,6 @@ } if (fw->progress) { - /* Instantaneous speed. */ - double inst_speed = - (double)fw->blocks_per_delay * fw->block_size * 1000 / - fw->delay_ms; const char *unit = adjust_unit(&inst_speed); double percent; /* The following shouldn't be necessary, but sometimes diff -Nru f3-7.0/Makefile f3-7.1/Makefile --- f3-7.0/Makefile 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/Makefile 2018-07-27 08:10:35.000000000 +0000 @@ -8,19 +8,28 @@ INSTALL = install LN = ln +ifndef OS + OS = $(shell uname -s) +endif +ifneq ($(OS), Linux) + ARGP = /usr/local + CFLAGS += -I$(ARGP)/include + LDFLAGS += -L$(ARGP)/lib -largp +endif + all: $(TARGETS) extra: $(EXTRA_TARGETS) install: all $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin - $(INSTALL) -oroot -groot -m755 $(TARGETS) $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m755 $(TARGETS) $(DESTDIR)$(PREFIX)/bin $(INSTALL) -d $(DESTDIR)$(PREFIX)/share/man/man1 - $(INSTALL) -oroot -groot -m644 f3read.1 $(DESTDIR)$(PREFIX)/share/man/man1 + $(INSTALL) -m644 f3read.1 $(DESTDIR)$(PREFIX)/share/man/man1 $(LN) -sf f3read.1 $(DESTDIR)$(PREFIX)/share/man/man1/f3write.1 install-extra: extra $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin - $(INSTALL) -oroot -groot -m755 $(EXTRA_TARGETS) $(DESTDIR)$(PREFIX)/bin + $(INSTALL) -m755 $(EXTRA_TARGETS) $(DESTDIR)$(PREFIX)/bin f3write: utils.o f3write.o $(CC) -o $@ $^ $(LDFLAGS) -lm diff -Nru f3-7.0/README.rst f3-7.1/README.rst --- f3-7.0/README.rst 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/README.rst 2018-07-27 08:10:35.000000000 +0000 @@ -63,7 +63,7 @@ `here `__. The following command uncompresses the files:: - $ unzip f3-7.0.zip + $ unzip f3-7.1.zip Compile stable software on Linux or FreeBSD @@ -80,7 +80,13 @@ Compile stable software on Windows/Cygwin ----------------------------------------- -On Cygwin, you need special flags:: +If you haven't already, install the following Cygwin packages and their dependencies: + +- `gcc-core` +- `make` +- `libargp-devel` + +To build, you need special flags:: export LDFLAGS="$LDFLAGS -Wl,--stack,4000000 -largp" make @@ -107,8 +113,8 @@ port install f3 -Compiling the lastest development version from the source code -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Compiling the latest development version from the source code +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Most of the f3 source code builds fine using XCode, the only dependency missing is the GNU C library "argp". You can build argp from scratch, or @@ -148,22 +154,16 @@ See https://trac.macports.org/browser/trunk/dports/sysutils/f3/Portfile for more information. -4) Set compilation flags. These following environment variables are used - in the Makefile to locate the argp library: - - HomeBrew:: +4) Build F3:: - export CFLAGS="$CFLAGS -I/usr/local/include/" - export LDFLAGS="$LDFLAGS -L/usr/local/lib/ -largp" + When using Homebrew, you can just run:: - MacPorts:: - - export CFLAGS="$CFLAGS -I/opt/local/include/" - export LDFLAGS="$LDFLAGS -L/opt/local/lib/ -largp" + make -5) Build F3:: + When using MacPorts, you will need to pass the location where MacPorts + installed argp-standalone:: - make + make ARGP=/opt/local The extra applications for Linux -------------------------------- diff -Nru f3-7.0/version.h f3-7.1/version.h --- f3-7.0/version.h 2018-01-06 15:07:08.000000000 +0000 +++ f3-7.1/version.h 2018-07-27 08:10:35.000000000 +0000 @@ -1,6 +1,6 @@ #ifndef HEADER_VERSION_H #define HEADER_VERSION_H -#define F3_STR_VERSION "7.0" +#define F3_STR_VERSION "7.1" #endif /* HEADER_VERSION_H */