diff options
author | Andrea Adami <andrea.adami@gmail.com> | 2018-05-23 22:15:46 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2018-05-26 21:10:55 -0700 |
commit | 9f38fa5ae1df01673ad652f6bc92fffe78148ee4 (patch) | |
tree | 28e46e054b4e4c024606ec4c55f3ed900c8a52bf /meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch | |
parent | ef537dcfef67dd397a82de1c881b76097b5a5554 (diff) | |
download | meta-openembedded-9f38fa5ae1df01673ad652f6bc92fffe78148ee4.tar.gz |
ubi-utils-klibc: update from v. 1.5.2 to 2.0.2
Update to new version and drop accepted patches.
Use autotools and packageconfig (for xattrs).
Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch')
-rw-r--r-- | meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch deleted file mode 100644 index 36b012f901..0000000000 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | From 41e7c76b0853bf5241b38b8167dfd57c27fef1eb Mon Sep 17 00:00:00 2001 | ||
2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
3 | Date: Sun, 28 Jan 2018 21:47:59 +0100 | ||
4 | Subject: [PATCH 7/9] mtd-utils: common.c: convert to integer arithmetic | ||
5 | |||
6 | We use floating point just to print out KiB, MiB, GiB. | ||
7 | Avoid that to be klibc friendly. | ||
8 | |||
9 | Fixes compilation for aarch64 against klibc: | ||
10 | |||
11 | error: '-mgeneral-regs-only' is incompatible with floating-point argument | ||
12 | | printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); | ||
13 | etc. | ||
14 | |||
15 | Note: | ||
16 | * In the KiB case, we could apparently multiply by 100 before dividing | ||
17 | without risking overflow. This code simply avoids multiplications. | ||
18 | |||
19 | Upstream-Status: Submitted | ||
20 | |||
21 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
22 | --- | ||
23 | ubi-utils/ubiutils-common.c | 18 ++++++++++++------ | ||
24 | 1 file changed, 12 insertions(+), 6 deletions(-) | ||
25 | |||
26 | diff --git a/ubi-utils/ubiutils-common.c b/ubi-utils/ubiutils-common.c | ||
27 | index 6609a6b..0ded2a4 100644 | ||
28 | --- a/ubi-utils/ubiutils-common.c | ||
29 | +++ b/ubi-utils/ubiutils-common.c | ||
30 | @@ -107,6 +107,9 @@ long long ubiutils_get_bytes(const char *str) | ||
31 | void ubiutils_print_bytes(long long bytes, int bracket) | ||
32 | { | ||
33 | const char *p; | ||
34 | + int GiB = 1024 * 1024 * 1024; | ||
35 | + int MiB = 1024 * 1024; | ||
36 | + int KiB = 1024; | ||
37 | |||
38 | if (bracket) | ||
39 | p = " ("; | ||
40 | @@ -115,12 +118,15 @@ void ubiutils_print_bytes(long long bytes, int bracket) | ||
41 | |||
42 | printf("%lld bytes", bytes); | ||
43 | |||
44 | - if (bytes > 1024 * 1024 * 1024) | ||
45 | - printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); | ||
46 | - else if (bytes > 1024 * 1024) | ||
47 | - printf("%s%.1f MiB", p, (double)bytes / (1024 * 1024)); | ||
48 | - else if (bytes > 1024 && bytes != 0) | ||
49 | - printf("%s%.1f KiB", p, (double)bytes / 1024); | ||
50 | + if (bytes > GiB) | ||
51 | + printf("%s%lld.%lld GiB", p, | ||
52 | + bytes / GiB, bytes % GiB / (GiB / 10)); | ||
53 | + else if (bytes > MiB) | ||
54 | + printf("%s%lld.%lld MiB", p, | ||
55 | + bytes / MiB, bytes % MiB / (MiB / 10)); | ||
56 | + else if (bytes > KiB && bytes != 0) | ||
57 | + printf("%s%lld.%lld KiB", p, | ||
58 | + bytes / KiB, bytes % KiB / (KiB / 10)); | ||
59 | else | ||
60 | return; | ||
61 | |||
62 | -- | ||
63 | 2.7.4 | ||
64 | |||