diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-08-04 08:53:53 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-08-04 08:53:53 +0100 |
commit | e3872864be25f7421015bef2732fa57c0c9fb726 (patch) | |
tree | 9cb29a544215119b5c5538e37211b994ce1c87ae /sys-block/f3 | |
parent | 480486b52ea64765faf696c88b2c6a26a5a454d4 (diff) |
gentoo resync : 04.08.2018
Diffstat (limited to 'sys-block/f3')
-rw-r--r-- | sys-block/f3/Manifest | 12 | ||||
-rw-r--r-- | sys-block/f3/f3-7.0.ebuild | 2 | ||||
-rw-r--r-- | sys-block/f3/f3-7.1.ebuild (renamed from sys-block/f3/f3-6.0.ebuild) | 16 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-extra-target.patch | 108 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3probe.patch | 50 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3read.patch | 88 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-respect-ldflags.patch | 40 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-upstream-issue-44.patch | 25 | ||||
-rw-r--r-- | sys-block/f3/files/f3-6.0-use-argp_parse.patch | 417 |
9 files changed, 8 insertions, 750 deletions
diff --git a/sys-block/f3/Manifest b/sys-block/f3/Manifest index 7c13ec048a1b..3ece4c70641f 100644 --- a/sys-block/f3/Manifest +++ b/sys-block/f3/Manifest @@ -1,11 +1,5 @@ -AUX f3-6.0-extra-target.patch 3608 BLAKE2B 84c51d13a4fa9a0cd17f70ccd2124366a317eea2a3347696f7bb2dff5faf460e6adb0026e91ce31b6ba03c4b2734194ae495e52d22d3600687165d3344ec232b SHA512 54f8277db54de041312941e5e55a057ec1e0b11eb567a57864b7f5dd65aea09d046f14740621a8fc2dcb4bfdf19a0c7c70fe31bb0f2de25b27bd3d6c4be27a29 -AUX f3-6.0-fix-compiler-warnings_f3probe.patch 1642 BLAKE2B 8f34d3cdb51d5a0bae50f35a83939f385d19bba63e2f47aeea981c539a3006e7431f30dbaf821e955e3f66cd0f51a19821024fd4ede798545e2dd2f182e6d709 SHA512 f3c7bd82ce66fa1052d4fdcb9af0a1f1a7dff6f119695c73bc95d9b92b426ef586fcae7d134b61d81ae4a196ffe45480b10822e2853031ea215d0602f45f5026 -AUX f3-6.0-fix-compiler-warnings_f3read.patch 2680 BLAKE2B 16ae34e4c0302a591defeb732afba1212c54af88903693ec48aa0f2b40dab0371b357a76f7a6c5f8aeae7f759ed03c659a76170c784c60f9e7ca9f4edc25be87 SHA512 29aaa29f147ac1ab6fa98f9e1f8fbc3e2e8681490afc841c6722ada2997a1b1f31de0978b98742002f0cc9d0ec319d0ad2f45e879a059559f4ed12fa44fe8c21 -AUX f3-6.0-respect-ldflags.patch 1092 BLAKE2B db0069bac1bd7558edaebe058d72189aa082ab366406891b81216a1b5f3d2354e3a5cbf8e3e228a6a13c442ce1de6fd99a92f0328bedb09b63828bb513bf4a9f SHA512 3ddd60ebf9fb85f2c662cab707a4aa5af127b8faac8010126011b4ab0c74cd9c7ef851aa121e6cc973249aabd85b605fd84908fdde060d345a4f4f1558314aec -AUX f3-6.0-upstream-issue-44.patch 655 BLAKE2B f276f377674fccab2e1ae2d13dd5e7c3454868c83f7289249390d066a894d6a7595e132a55cc519b0b37802b709f6f703829babd66bf323029715e16c9c37c19 SHA512 3228507ae8ce77a683689f3b1efc67c68ee718f2903d7bc5bcea2fbd8e8943deec586154f99bbf9f7ed992b7c351958e6862b8f45a1936763f92a6d30a2f0a35 -AUX f3-6.0-use-argp_parse.patch 10555 BLAKE2B f598b473e727741094153570e0975895bf6e5994817172a0a6da03ae0d3cc92521a603ea4e99a6db46245f557a818e107273b9bcd192ded41606cd793b3a8da0 SHA512 46afaf0b8954c06a80d6b5d8a06f8da73bbd843799c78ff45083d03e687d387ef27c87f69befb274438a58fffbc041e7adeba5b6496305dd998f54cda05f651d -DIST f3-6.0.tar.gz 45355 BLAKE2B c06f5ea3285f46197af05e7c4a75dc1e94b28acc14ec4f8da6b3fbeaec723cfaa420fa2542573a1cd5586ea50e27c3e8010ecd88ecfeb7b9ad28591f072c1377 SHA512 7960d01d7a2bd01a236006fcb4081cc7e2c0be674bc3e28137f00ea3f558a04eed47f10e7d3795c219943092ee43fb3189e19ff1925a7ed4ff5102130d65a470 DIST f3-7.0.tar.gz 67492 BLAKE2B 6b6882958ca831a26cd815635a563dd1bac9c93103fd6e9a2a4040b6ea3725395be96d0cbef9d7e01441402edf63a63110be41f5db559eb5fa85ac82a101751d SHA512 217348c3911995143e2d1f777ff6038ffd541f6868d58da9ca0a702610377f26eac7aafcd993d9b410b4d5a6d27d2c4fa8020b665beee7c2f760dc293a63c41f -EBUILD f3-6.0.ebuild 1394 BLAKE2B a1166cdfc7708f26478333b0b56833da23edd1ee4ba683270f55613231fb6ff30fc8f8958a006e3bd4fb655cdd4bea9b65fc17636db18673b3af10a29d00209a SHA512 98e19312908998172b264f0a167601d5bfa553e716f58f5fe2291463d85ba072652914bf6cb7d631aceca313ede8b6771acebedb79b578467894dc4f13653418 -EBUILD f3-7.0.ebuild 1108 BLAKE2B a35e0ddfc9843855faac6dbb62130293143cee550739814f30d01359f253d412d48499fa744b3b6fd29a94efabd5466228a551b852f48aee0818120b672aa279 SHA512 9c80a82c284d5a738f32be363c57752875419a98dc4d23012d2b155dc09216898f0f1b6f95c5d0edac08ad19defea29dbea3176aab2391dfc33369890dcf11be +DIST f3-7.1.tar.gz 67934 BLAKE2B 7d5e12d8af7abda6136dfa19127554b6e5c45fdec7f0cef10d792d77cd2cfae035a572cdf2f22faf54c61852b1660e70270a326bb4408ed64725114f1f9aff4f SHA512 d696bb96ebaefab13c50a4479be01c206365d8dcf7d3c3b1d906b68705b654fffabdbeee49ea208047383c117bcac2a85c2c5fb129cace82f8addc16f22d7514 +EBUILD f3-7.0.ebuild 1106 BLAKE2B 32343b52d3e2f9d35d71267ff377c10a673f8d1f32f2065ab5ef86298acfaf3a6694983a7261e361401450e5f09e566a31c850d67a90c8552ebc9b82fbb55f25 SHA512 551a553a86204bcf03de5904b621abeeebd430d989e7c7aba98cb7d34233f8c890f1c022906fe7605d0167ce5956de3dd09af3401228f545960feeddcac64d95 +EBUILD f3-7.1.ebuild 1028 BLAKE2B 6cff438b3b08a87dabf3baf5d54847e9528e323b9ccd4215745ca4a7a1b09e12d4a0300066a0f5651a82d6860a5a43b196f1c24dbdbfb3d10710b8be6afa2e1c SHA512 65fccee48c9473285667cb374a73d21f38e899aed4b44a85193c7cbca475681d1535d66161b2c49664156778f5971b77b82df2a5f5e1037b528553b6999bead5 MISC metadata.xml 959 BLAKE2B 216b03b57f363f727f19317c6ac7a9dcd5c383f23939803e0e04a5061628c0669083084e0bfd2a3bd8234810e37cf851babc8b63355bd9e4082a35126844c4df SHA512 a3c52956ad1241ea8d834cfe4d45f36fb80e4c3d717f18e0f15e126b950a2cf6fdd036e8612b9feee8812d9c77a49ce9e209a2e54fd8d0f3655696814b4c9b40 diff --git a/sys-block/f3/f3-7.0.ebuild b/sys-block/f3/f3-7.0.ebuild index b7bbbc4ae4fe..987ef57f6f6d 100644 --- a/sys-block/f3/f3-7.0.ebuild +++ b/sys-block/f3/f3-7.0.ebuild @@ -19,7 +19,7 @@ if [[ ${PV} == "9999" ]]; then inherit git-r3 else SRC_URI="https://github.com/AltraMayor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - KEYWORDS="~amd64 ~arm64 ~x86" + KEYWORDS="amd64 ~arm64 x86" fi LICENSE="GPL-3+" diff --git a/sys-block/f3/f3-6.0.ebuild b/sys-block/f3/f3-7.1.ebuild index ac8d4869cb4d..726e10fa800d 100644 --- a/sys-block/f3/f3-6.0.ebuild +++ b/sys-block/f3/f3-7.1.ebuild @@ -1,7 +1,7 @@ # Copyright 1999-2018 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -EAPI=6 +EAPI="7" inherit flag-o-matic toolchain-funcs @@ -9,12 +9,6 @@ DESCRIPTION="Utilities to detect broken or counterfeit flash storage" HOMEPAGE="http://oss.digirati.com.br/f3/ https://github.com/AltraMayor/f3" PATCHES=( - "${FILESDIR}"/f3-6.0-fix-compiler-warnings_f3read.patch - "${FILESDIR}"/f3-6.0-fix-compiler-warnings_f3probe.patch - "${FILESDIR}"/f3-6.0-respect-ldflags.patch - "${FILESDIR}"/f3-6.0-use-argp_parse.patch - "${FILESDIR}"/f3-6.0-extra-target.patch - "${FILESDIR}"/f3-6.0-upstream-issue-44.patch ) if [[ ${PV} == "9999" ]]; then @@ -25,7 +19,7 @@ if [[ ${PV} == "9999" ]]; then inherit git-r3 else SRC_URI="https://github.com/AltraMayor/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" - KEYWORDS="amd64 ~arm64 x86" + KEYWORDS="~amd64 ~arm64 ~x86" fi LICENSE="GPL-3+" @@ -40,7 +34,7 @@ DEPEND="extra? ( RDEPEND="" -DOCS=( changelog README.md ) +DOCS=( changelog README.rst ) src_prepare() { default @@ -51,8 +45,6 @@ src_prepare() { Makefile || die tc-export CC - - append-cflags -fgnu89-inline # https://github.com/AltraMayor/f3/issues/34 } src_compile() { @@ -70,5 +62,5 @@ src_install() { emake PREFIX="${ED%/}/usr" install-extra fi - dodoc "${DOCS[@]}" + einstalldocs } diff --git a/sys-block/f3/files/f3-6.0-extra-target.patch b/sys-block/f3/files/f3-6.0-extra-target.patch deleted file mode 100644 index 8523ca3f2b53..000000000000 --- a/sys-block/f3/files/f3-6.0-extra-target.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 64d169e2486121eaece555c56040d6aff71e0b51 Mon Sep 17 00:00:00 2001 -From: Michel Machado <michel@digirati.com.br> -Date: Tue, 29 Mar 2016 12:56:43 -0400 -Subject: [PATCH] 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``` ---- - Makefile | 10 +++++----- - README.md | 29 ++++++++++++----------------- - 2 files changed, 17 insertions(+), 22 deletions(-) - -diff --git a/Makefile b/Makefile -index 46853f5..ce54842 100644 ---- a/Makefile -+++ b/Makefile -@@ -2,14 +2,14 @@ CC ?= gcc - CFLAGS += -std=c99 -Wall -Wextra -pedantic -MMD -ggdb - - TARGETS = f3write f3read --EXPERIMENTAL_TARGETS = f3probe f3brew f3fix -+EXTRA_TARGETS = f3probe f3brew f3fix - - PREFIX = /usr/local - INSTALL = install - LN = ln - - all: $(TARGETS) --experimental: $(EXPERIMENTAL_TARGETS) -+extra: $(EXTRA_TARGETS) - - install: all - $(INSTALL) -d $(PREFIX)/bin -@@ -18,9 +18,9 @@ install: all - $(INSTALL) -oroot -groot -m644 f3read.1 $(PREFIX)/share/man/man1 - $(LN) -sf f3read.1 $(PREFIX)/share/man/man1/f3write.1 - --install-experimental: experimental -+install-extra: extra - $(INSTALL) -d $(PREFIX)/bin -- $(INSTALL) -oroot -groot -m755 $(EXPERIMENTAL_TARGETS) $(PREFIX)/bin -+ $(INSTALL) -oroot -groot -m755 $(EXTRA_TARGETS) $(PREFIX)/bin - - f3write: utils.o f3write.o - $(CC) -o $@ $^ $(LDFLAGS) -lm -@@ -45,4 +45,4 @@ cscope: - cscope -b *.c *.h - - clean: -- rm -f *.o *.d cscope.out $(TARGETS) $(EXPERIMENTAL_TARGETS) -+ rm -f *.o *.d cscope.out $(TARGETS) $(EXTRA_TARGETS) -diff --git a/README.md b/README.md -index f0399b4..e2f7f79 100644 ---- a/README.md -+++ b/README.md -@@ -5,36 +5,31 @@ make - ``` - - --## Compile experimental applications on Linux -+## Compile the extra applications on Linux - - ### Install dependencies - -- - f3probe and f3brew require version 1 of the library libudev to compile. -- On Ubuntu, you can install this library with the following command: -+f3probe and f3brew require version 1 of the library libudev, and -+f3fix requires version 0 of the library libparted to compile. -+On Ubuntu, you can install these libraries with the following command: - ``` --sudo apt-get install libudev1 libudev-dev --``` -- - f3fix requires version 0 of the library libparted to compile. -- On Ubuntu, you can install this library with the following command: --``` --sudo apt-get install libparted0-dev -+sudo apt-get install libudev1 libudev-dev libparted0-dev - ``` - --### Compile experimental applications -+### Compile the extra applications - - ``` --make experimental -+make extra - ``` - - NOTES: -- - Experimental software might compile on non-Linux platforms, but -- there is no guarantee given that they are only tested on Linux. -- - Please do not e-mail me saying that you want an experimental software -+ - The extra applications are only compiled and tested on Linux platform. -+ - Please do not e-mail me saying that you want the extra applications - to run on your platform; I already know that. -- - If you want experimental software to run on your platform, -+ - If you want the extra applications to run on your platform, - help to port them, or find someone that can port them for you. -- If you do port the software, please send me a patch to help others. -- - Currently, f3probe, f3brew, and f3fix are experimental. -+ If you do port any of them, please send me a patch to help others. -+ - The extra applications are f3probe, f3brew, and f3fix. - - - ## Use example of f3write/f3read diff --git a/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3probe.patch b/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3probe.patch deleted file mode 100644 index 739488b53f97..000000000000 --- a/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3probe.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 77d2ceb374ff70b64e95a41f0e05486575147b53 Mon Sep 17 00:00:00 2001 -From: Michel Machado <michel@digirati.com.br> -Date: Mon, 4 Jan 2016 13:49:05 -0500 -Subject: [PATCH] f3probe: avoid compiler warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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 ---- - f3probe.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/f3probe.c b/f3probe.c -index e647d7c..9f214ab 100644 ---- a/f3probe.c -+++ b/f3probe.c -@@ -393,6 +393,7 @@ static int test_device(struct args *args) - pdev = NULL; - } - -+ sdev = NULL; - if (args->save) { - sdev = create_safe_device(dev, - probe_device_max_blocks(dev), args->min_mem); -@@ -434,7 +435,7 @@ static int test_device(struct args *args) - &read_count, &read_time_us, - &write_count, &write_time_us, - &reset_count, &reset_time_us); -- if (args->save) { -+ if (sdev) { - uint64_t very_last_pos = real_size_byte >> block_order; - printf("Probe finished, recovering blocks..."); - fflush(stdout); diff --git a/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3read.patch b/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3read.patch deleted file mode 100644 index 0e4f61fca816..000000000000 --- a/sys-block/f3/files/f3-6.0-fix-compiler-warnings_f3read.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 52e252f5d6dc6d10fd85a45b0774bb0b29d5f989 Mon Sep 17 00:00:00 2001 -From: Michel Machado <michel@digirati.com.br> -Date: Mon, 4 Jan 2016 13:22:18 -0500 -Subject: [PATCH] f3read: avoid compiler warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -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); - ^ ---- - f3read.c | 28 ++++++++++++---------------- - 1 file changed, 12 insertions(+), 16 deletions(-) - -diff --git a/f3read.c b/f3read.c -index 1514365..2dc6942 100644 ---- a/f3read.c -+++ b/f3read.c -@@ -42,12 +42,12 @@ static void validate_file(const char *path, int number, - { - char *full_fn; - const char *filename; -- uint8_t sector[SECTOR_SIZE], *p, *ptr_end; -+ const int num_int64 = SECTOR_SIZE >> 3; -+ uint64_t sector[num_int64]; - FILE *f; - int fd; -- int offset_match, error_count; - size_t sectors_read; -- uint64_t offset, expected_offset; -+ uint64_t expected_offset; - int final_errno; - struct timeval t1, t2; - /* Progress time. */ -@@ -84,32 +84,24 @@ static void validate_file(const char *path, int number, - /* Help the kernel to help us. */ - assert(!posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL)); - -- ptr_end = sector + SECTOR_SIZE; - sectors_read = fread(sector, SECTOR_SIZE, 1, f); - final_errno = errno; - expected_offset = (uint64_t)number * GIGABYTES; - while (sectors_read > 0) { - uint64_t rn; -+ int error_count, i; - - assert(sectors_read == 1); -- offset = *((uint64_t *) sector); -- offset_match = offset == expected_offset; - -- rn = offset; -- p = sector + sizeof(offset); -+ rn = sector[0]; - error_count = 0; -- for (; error_count <= TOLERANCE && p < ptr_end; -- p += sizeof(rn)) { -+ for (i = 1; error_count <= TOLERANCE && i < num_int64; i++) { - rn = random_number(rn); -- if (rn != *((__typeof__(rn) *) p)) -+ if (rn != sector[i]) - error_count++; - } - -- sectors_read = fread(sector, SECTOR_SIZE, 1, f); -- final_errno = errno; -- expected_offset += SECTOR_SIZE; -- -- if (offset_match) { -+ if (expected_offset == sector[0]) { - if (error_count == 0) - (*ptr_ok)++; - else if (error_count <= TOLERANCE) -@@ -121,6 +113,10 @@ static void validate_file(const char *path, int number, - else - (*ptr_corrupted)++; - -+ sectors_read = fread(sector, SECTOR_SIZE, 1, f); -+ final_errno = errno; -+ expected_offset += SECTOR_SIZE; -+ - if (progress) { - struct timeval pt2; - assert(!gettimeofday(&pt2, NULL)); diff --git a/sys-block/f3/files/f3-6.0-respect-ldflags.patch b/sys-block/f3/files/f3-6.0-respect-ldflags.patch deleted file mode 100644 index 4d42ea8318d4..000000000000 --- a/sys-block/f3/files/f3-6.0-respect-ldflags.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 70962dcfaa41ca390f6f077cc64312fb879b7eb4 Mon Sep 17 00:00:00 2001 -From: Grazvydas Ignotas <notasas@gmail.com> -Date: Sat, 12 Mar 2016 17:39:05 +0200 -Subject: [PATCH] allow users to specify linker flags - -Traditionally LDFLAGS is used for this, it's what I've tried first -but it wasn't accepted. ---- - Makefile | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/Makefile b/Makefile -index 404bc17..46853f5 100644 ---- a/Makefile -+++ b/Makefile -@@ -23,19 +23,19 @@ install-experimental: experimental - $(INSTALL) -oroot -groot -m755 $(EXPERIMENTAL_TARGETS) $(PREFIX)/bin - - f3write: utils.o f3write.o -- $(CC) -o $@ $^ -lm -+ $(CC) -o $@ $^ $(LDFLAGS) -lm - - f3read: utils.o f3read.o -- $(CC) -o $@ $^ -+ $(CC) -o $@ $^ $(LDFLAGS) - - f3probe: libutils.o libdevs.o libprobe.o f3probe.o -- $(CC) -o $@ $^ -lm -ludev -+ $(CC) -o $@ $^ $(LDFLAGS) -lm -ludev - - f3brew: libutils.o libdevs.o f3brew.o -- $(CC) -o $@ $^ -lm -ludev -+ $(CC) -o $@ $^ $(LDFLAGS) -lm -ludev - - f3fix: libutils.o f3fix.o -- $(CC) -o $@ $^ -lparted -+ $(CC) -o $@ $^ $(LDFLAGS) -lparted - - -include *.d - diff --git a/sys-block/f3/files/f3-6.0-upstream-issue-44.patch b/sys-block/f3/files/f3-6.0-upstream-issue-44.patch deleted file mode 100644 index 605b6b3ea663..000000000000 --- a/sys-block/f3/files/f3-6.0-upstream-issue-44.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a754e9cf29415d110c4fe6fb1fe0d060d765a73e Mon Sep 17 00:00:00 2001 -From: Michel Machado <michel@digirati.com.br> -Date: Thu, 19 May 2016 08:39:36 -0400 -Subject: [PATCH] f3read: add "#include <limits.h>" to f3read.c - -This addresses a compiling issue on Macs. - -@jksinton found and solved this problem: -https://github.com/AltraMayor/f3/issues/44 ---- - f3read.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/f3read.c b/f3read.c -index 0842071..c5c20d2 100644 ---- a/f3read.c -+++ b/f3read.c -@@ -5,6 +5,7 @@ - #include <stdint.h> - #include <inttypes.h> - #include <stdio.h> -+#include <limits.h> - #include <string.h> - #include <stdlib.h> - #include <errno.h> diff --git a/sys-block/f3/files/f3-6.0-use-argp_parse.patch b/sys-block/f3/files/f3-6.0-use-argp_parse.patch deleted file mode 100644 index b73fbff8c7a2..000000000000 --- a/sys-block/f3/files/f3-6.0-use-argp_parse.patch +++ /dev/null @@ -1,417 +0,0 @@ -From fb187b4c710714a56d74af8a50adccd6118445e7 Mon Sep 17 00:00:00 2001 -From: zwpwjwtz <zwpwjwtz@126.com> -Date: Tue, 29 Mar 2016 15:36:04 +0800 -Subject: [PATCH] Replace parse_args() with argp_parse() from argp.h - ---- - f3read.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - f3write.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- - utils.c | 92 ---------------------------------------------------- - utils.h | 5 --- - 4 files changed, 200 insertions(+), 113 deletions(-) - -diff --git a/f3read.c b/f3read.c -index 2dc6942..683232d 100644 ---- a/f3read.c -+++ b/f3read.c -@@ -12,8 +12,100 @@ - #include <unistd.h> - #include <err.h> - #include <sys/time.h> -+#include <limits.h> -+#include <argp.h> - - #include "utils.h" -+#include "version.h" -+ -+/* Argp's global variables. */ -+const char *argp_program_version = "F3 Read " F3_STR_VERSION; -+ -+/* Arguments. */ -+static char adoc[] = "<PATH>"; -+ -+static char doc[] = "F3 Read -- test real flash memory capacity\n" -+ "Copyright (C) 2010 Digirati Internet LTDA.\n" -+ "This is free software; see the source for copying conditions.\n"; -+ -+static struct argp_option options[] = { -+ {"start-at", 's', "NUM", 0, -+ "Disk type of the partition table", 0}, -+ {"end-at", 'e', "NUM", 0, -+ "Type of the file system of the partition", 0}, -+ {"progress", 'p', NULL, 0, -+ "Show progress of the operation (default)", 0}, -+ { 0 } -+}; -+ -+struct args { -+ long start_at; -+ long end_at; -+ int show_progress; -+ const char *dev_path; -+}; -+ -+static error_t parse_opt(int key, char *arg, struct argp_state *state) -+{ -+ struct args *args = state->input; -+ char *endptr; -+ -+ switch (key) { -+ case 's': -+ args->start_at = strtol(arg, &endptr, 10); -+ if (*endptr != '\0') -+ argp_error(state, "Option --start-at must be a number"); -+ break; -+ -+ case 'e': -+ args->end_at = strtol(arg, &endptr, 10); -+ if (*endptr != '\0') -+ argp_error(state, "Option --end-at must be a number"); -+ break; -+ -+ case 'p': -+ args->show_progress = 1; -+ break; -+ -+ case ARGP_KEY_INIT: -+ args->dev_path = NULL; -+ args->start_at = 0; -+ args->end_at = LONG_MAX; -+ args->show_progress = 0; -+ break; -+ -+ case ARGP_KEY_ARG: -+ if (args->dev_path) -+ argp_error(state, -+ "Wrong number of arguments; only one is allowed"); -+ args->dev_path = arg; -+ break; -+ -+ case ARGP_KEY_END: -+ if (!args->dev_path) -+ argp_error(state, -+ "The disk path was not specified"); -+ -+ if (args->start_at < 0) -+ argp_error(state, -+ "Option --start-at must be greater than 0"); -+ -+ if (args->end_at < 0) -+ argp_error(state, -+ "Option --end-at must be greater than 0"); -+ -+ if (args->start_at > args->end_at) -+ argp_error(state, -+ "Option --start-at must be less or equal to option --end-at"); -+ break; -+ -+ default: -+ return ARGP_ERR_UNKNOWN; -+ } -+ return 0; -+} -+ -+static struct argp argp = {options, parse_opt, adoc, doc, NULL, NULL, NULL}; - - static inline void update_dt(struct timeval *dt, const struct timeval *t1, - const struct timeval *t2) -@@ -228,20 +320,21 @@ static void iterate_files(const char *path, const long *files, - - int main(int argc, char **argv) - { -- long start_at, end_at; -- const char *path; - const long *files; -- int progress; -+ struct args args; - int rc; -- -- rc = parse_args("read", argc, argv, &start_at, &end_at, &path); -+ rc = argp_parse(&argp, argc, argv, 0, NULL, &args); - if (rc) - return rc; - -- files = ls_my_files(path, start_at, end_at); - /* If stdout isn't a terminal, supress progress. */ -- progress = isatty(STDOUT_FILENO); -- iterate_files(path, files, start_at, end_at, progress); -+ if (!args.show_progress) -+ args.show_progress = isatty(STDOUT_FILENO); -+ -+ files = ls_my_files(args.dev_path, args.start_at, args.end_at); -+ /* If stdout isn't a terminal, supress progress. */ -+ -+ iterate_files(args.dev_path, files, args.start_at, args.end_at, args.show_progress); - free((void *)files); - return 0; - } -diff --git a/f3write.c b/f3write.c -index b964059..bfef27e 100644 ---- a/f3write.c -+++ b/f3write.c -@@ -15,8 +15,99 @@ - #include <unistd.h> - #include <err.h> - #include <math.h> -+#include <argp.h> - - #include "utils.h" -+#include "version.h" -+ -+/* Argp's global variables. */ -+const char *argp_program_version = "F3 Write " F3_STR_VERSION; -+ -+/* Arguments. */ -+static char adoc[] = "<PATH>"; -+ -+static char doc[] = "F3 Write -- test real flash memory capacity\n" -+ "Copyright (C) 2010 Digirati Internet LTDA.\n" -+ "This is free software; see the source for copying conditions.\n"; -+ -+static struct argp_option options[] = { -+ {"start-at", 's', "NUM", 0, -+ "Disk type of the partition table", 0}, -+ {"end-at", 'e', "NUM", 0, -+ "Type of the file system of the partition", 0}, -+ {"progress", 'p', NULL, 0, -+ "Show progress of the operation (default)", 0}, -+ { 0 } -+}; -+ -+struct args { -+ long start_at; -+ long end_at; -+ int show_progress; -+ const char *dev_path; -+}; -+ -+static error_t parse_opt(int key, char *arg, struct argp_state *state) -+{ -+ struct args *args = state->input; -+ char *endptr; -+ -+ switch (key) { -+ case 's': -+ args->start_at = strtol(arg, &endptr, 10); -+ if (*endptr != '\0') -+ argp_error(state, "Option --start-at must be a number"); -+ break; -+ -+ case 'e': -+ args->end_at = strtol(arg, &endptr, 10); -+ if (*endptr != '\0') -+ argp_error(state, "Option --end-at must be a number"); -+ break; -+ -+ case 'p': -+ args->show_progress = 1; -+ break; -+ -+ case ARGP_KEY_INIT: -+ args->dev_path = NULL; -+ args->start_at = 0; -+ args->end_at = LONG_MAX; -+ args->show_progress = 0; -+ break; -+ -+ case ARGP_KEY_ARG: -+ if (args->dev_path) -+ argp_error(state, -+ "Wrong number of arguments; only one is allowed"); -+ args->dev_path = arg; -+ break; -+ -+ case ARGP_KEY_END: -+ if (!args->dev_path) -+ argp_error(state, -+ "The disk path was not specified"); -+ -+ if (args->start_at < 0) -+ argp_error(state, -+ "Option --start-at must be greater than 0"); -+ -+ if (args->end_at < 0) -+ argp_error(state, -+ "Option --end-at must be greater than 0"); -+ -+ if (args->start_at > args->end_at) -+ argp_error(state, -+ "Option --start-at must be less or equal to option --end-at"); -+ break; -+ -+ default: -+ return ARGP_ERR_UNKNOWN; -+ } -+ return 0; -+} -+ -+static struct argp argp = {options, parse_opt, adoc, doc, NULL, NULL, NULL}; - - static uint64_t fill_buffer(void *buf, size_t size, uint64_t offset) - { -@@ -464,17 +555,17 @@ static void unlink_old_files(const char *path, long start_at, long end_at) - - int main(int argc, char **argv) - { -- long start_at, end_at; -- const char *path; -- int progress; -+ struct args args; - int rc; -- -- rc = parse_args("write", argc, argv, &start_at, &end_at, &path); -+ rc = argp_parse(&argp, argc, argv, 0, NULL, &args); - if (rc) - return rc; - -- unlink_old_files(path, start_at, end_at); -+ unlink_old_files(args.dev_path, args.start_at, args.end_at); -+ - /* If stdout isn't a terminal, supress progress. */ -- progress = isatty(STDOUT_FILENO); -- return fill_fs(path, start_at, end_at, progress); -+ if (!args.show_progress) -+ args.show_progress = isatty(STDOUT_FILENO); -+ -+ return fill_fs(args.dev_path, args.start_at, args.end_at, args.show_progress); - } -diff --git a/utils.c b/utils.c -index a30ea3b..6aaceff 100644 ---- a/utils.c -+++ b/utils.c -@@ -13,13 +13,11 @@ - #include <string.h> - #include <ctype.h> - #include <assert.h> --#include <limits.h> - #include <sys/types.h> - #include <dirent.h> - #include <errno.h> - #include <err.h> - --#include "version.h" - #include "utils.h" - - const char *adjust_unit(double *ptr_bytes) -@@ -60,87 +58,6 @@ char *full_fn_from_number(const char **filename, const char *path, long num) - return str; - } - --/* Parse @param and return the start-at parameter. -- * The string must be of the format "--start-at=NUM"; otherwise it returns -1. -- */ --#define START_AT_TEXT "--start-at=" --#define END_AT_TEXT "--end-at=" -- --static inline int is_param(const char *text, const char *param) --{ -- return !strncmp(param, text, strlen(text)); --} -- --static long parse_long_param(const char *param) --{ -- char *endptr; -- long value; -- -- /* Skip text. */ -- while (*param != '=') { -- if (*param == '\0') -- return -1; -- param++; -- } -- param++; /* Skip '='. */ -- -- value = strtol(param, &endptr, 10); -- if (*endptr != '\0') -- return -1; -- -- return (value <= 0 || value == LONG_MAX) ? -1 : value - 1; --} -- --static int parse_param(const char *param, long *pstart_at, long *pend_at) --{ -- if (is_param(START_AT_TEXT, param)) -- *pstart_at = parse_long_param(param); -- else if (is_param(END_AT_TEXT, param)) -- *pend_at = parse_long_param(param); -- else -- return 1; -- return 0; --} -- --int parse_args(const char *name, int argc, char **argv, -- long *pstart_at, long *pend_at, const char **ppath) --{ -- *pstart_at = 0; -- *pend_at = LONG_MAX - 1; -- -- switch (argc) { -- case 2: -- *ppath = argv[1]; -- break; -- -- case 3: -- if (parse_param(argv[1], pstart_at, pend_at)) -- goto error; -- *ppath = argv[2]; -- break; -- -- case 4: -- if (parse_param(argv[1], pstart_at, pend_at)) -- goto error; -- if (parse_param(argv[2], pstart_at, pend_at)) -- goto error; -- *ppath = argv[3]; -- break; -- -- default: -- goto error; -- } -- -- if (*pstart_at >= 0 && *pend_at >= 0 && *pstart_at <= *pend_at) -- return 0; -- --error: -- print_header(stderr, name); -- fprintf(stderr, "Usage: f3%s [%sNUM] [%sNUM] <PATH>\n", -- name, START_AT_TEXT, END_AT_TEXT); -- return 1; --} -- - static long number_from_filename(const char *filename) - { - const char *p; -@@ -218,15 +135,6 @@ const long *ls_my_files(const char *path, long start_at, long end_at) - return ret; - } - --void print_header(FILE *f, const char *name) --{ -- fprintf(f, -- "F3 %s " F3_STR_VERSION "\n" -- "Copyright (C) 2010 Digirati Internet LTDA.\n" -- "This is free software; see the source for copying conditions.\n" -- "\n", name); --} -- - #if __APPLE__ && __MACH__ - - /* This function is a _rough_ approximation of fdatasync(2). */ -diff --git a/utils.h b/utils.h -index 6b7c92f..4fdbce2 100644 ---- a/utils.h -+++ b/utils.h -@@ -22,13 +22,8 @@ static inline long delay_ms(const struct timeval *t1, const struct timeval *t2) - (t2->tv_usec - t1->tv_usec) / 1000; - } - --int parse_args(const char *name, int argc, char **argv, -- long *pstart_at, long *pend_at, const char **ppath); -- - const long *ls_my_files(const char *path, long start_at, long end_at); - --void print_header(FILE *f, const char *name); -- - static inline uint64_t random_number(uint64_t prv_number) - { - return prv_number * 4294967311ULL + 17; |