fee391e33a
- update to upstream 3.14.1 - mkfs: - fix TRIM detection - do not zero-out end of device unconditionally - no crash with --features option - fsck: - clear log tree in repair mode - check reloc roots - btrfs - reworked space reporting (bnc#873106) - btrfs fi usage - new command - btrfs dev usage - new command - btrfs fi df - enhanced output with GlobalReserve - Removed patches: * 0001-btrfs-progs-move-arg_strtou64-to-a-separate-file-for.patch - Added patches: * 0001-Btrfs-progs-fix-check-to-test-trim-support.patch * 0002-Btrfs-progs-fsck-fix-double-free-memory-crash.patch * 0003-Btrfs-progs-mkfs-Remove-zero_end-1-since-it-has-been.patch * 0004-btrfs-progs-fix-wrong-max-system-array-size-check-in.patch * 0005-btrfs-progs-move-arg_strtou64-to-a-separate-file-for.patch * 0006-Btrfs-progs-fsck-clear-out-log-tree-in-repair-mode.patch * 0007-Btrfs-progs-fsck-avoid-pinning-same-block-several-ti.patch * 0008-Btrfs-progs-fsck-add-ability-to-check-reloc-roots.patch * 0009-btrfs-progs-prevent-close_root-if-the-root-to-close-.patch * 0010-btrfs-progs-fix-mkfs.btrfs-segfault-with-features-op.patch * 0011-btrfs-progs-Enhance-the-command-btrfs-filesystem-df.patch * 0012-btrfs-progs-Add-helpers-functions-to-handle-the-prin.patch * 0013-btrfs-progs-Add-command-btrfs-filesystem-disk-usage.patch * 0014-btrfs-progs-Add-btrfs-device-disk-usage-command.patch * 0015-btrfs-progs-cleanup-dead-return-after-usage-for-fi-d.patch * 0016-btrfs-progs-Fix-memleak-in-get_raid56_used.patch * 0017-Btrfs-progs-fi-usage-free-memory-if-realloc-fails.patch * 0018-btrfs-progs-read-global-reserve-size-from-space-info.patch * 0019-btrfs-progs-add-original-df-and-rename-disk_usage-to.patch * 0020-btrfs-progs-move-device-usage-to-cmds-device-more-cl.patch * 0021-btrfs-progs-check-if-we-can-t-get-info-from-ioctls-d.patch * 0022-btrfs-progs-zero-out-structures-before-calling-ioctl.patch * 0023-btrfs-progs-print-B-for-bytes.patch * 0024-btrfs-progs-Print-more-info-about-device-sizes.patch * 0025-btrfs-progs-compare-unallocated-space-against-the-co.patch * 0026-btrfs-progs-add-section-of-overall-filesystem-usage.patch * 0027-btrfs-progs-cleanup-filesystem-device-usage-code.patch * 0028-btrfs-progs-extend-pretty-printers-with-unit-mode.patch * 0029-btrfs-progs-replace-df_pretty_sizes-with-pretty_size.patch * 0030-btrfs-progs-clean-up-return-codes-and-paths.patch * 0031-btrfs-progs-move-global-reserve-to-overall-summary.patch (forwarded request 232435 from dsterba) OBS-URL: https://build.opensuse.org/request/show/232437 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/btrfsprogs?expand=0&rev=40
138 lines
3.9 KiB
Diff
138 lines
3.9 KiB
Diff
From b5230eca8a9214c7290ed818ff9792eb5d3e142b Mon Sep 17 00:00:00 2001
|
|
From: David Sterba <dsterba@suse.cz>
|
|
Date: Fri, 11 Apr 2014 13:22:50 +0200
|
|
Subject: [PATCH 12/42] btrfs-progs: move arg_strtou64 to a separate file for
|
|
library
|
|
|
|
Linking with libbtrfs fails because arg_strtou64 is not defined and we
|
|
cannot just add utils.o to library objects because it's not
|
|
library-clean.
|
|
|
|
Reported-by: Arvin Schnell <aschnell@suse.com>
|
|
Reported-by: Anton Farygin <rider@altlinux.org>
|
|
Signed-off-by: David Sterba <dsterba@suse.cz>
|
|
---
|
|
Makefile | 5 +++--
|
|
utils-lib.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
utils.c | 33 ---------------------------------
|
|
3 files changed, 45 insertions(+), 35 deletions(-)
|
|
create mode 100644 utils-lib.c
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index 51d53fadf5af..76565e8b2307 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -9,14 +9,15 @@ CFLAGS = -g -O1 -fno-strict-aliasing
|
|
objects = ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o \
|
|
root-tree.o dir-item.o file-item.o inode-item.o inode-map.o \
|
|
extent-cache.o extent_io.o volumes.o utils.o repair.o \
|
|
- qgroup.o raid6.o free-space-cache.o list_sort.o props.o
|
|
+ qgroup.o raid6.o free-space-cache.o list_sort.o props.o \
|
|
+ utils-lib.o
|
|
cmds_objects = cmds-subvolume.o cmds-filesystem.o cmds-device.o cmds-scrub.o \
|
|
cmds-inspect.o cmds-balance.o cmds-send.o cmds-receive.o \
|
|
cmds-quota.o cmds-qgroup.o cmds-replace.o cmds-check.o \
|
|
cmds-restore.o cmds-rescue.o chunk-recover.o super-recover.o \
|
|
cmds-property.o
|
|
libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \
|
|
- uuid-tree.o
|
|
+ uuid-tree.o utils-lib.o
|
|
libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \
|
|
crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \
|
|
extent_io.h ioctl.h ctree.h btrfsck.h
|
|
diff --git a/utils-lib.c b/utils-lib.c
|
|
new file mode 100644
|
|
index 000000000000..9d53c6e5c710
|
|
--- /dev/null
|
|
+++ b/utils-lib.c
|
|
@@ -0,0 +1,42 @@
|
|
+#define _GNU_SOURCE
|
|
+
|
|
+#include "kerncompat.h"
|
|
+#include <unistd.h>
|
|
+#include <stdlib.h>
|
|
+#include <limits.h>
|
|
+
|
|
+#if BTRFS_FLAT_INCLUDES
|
|
+#else
|
|
+#endif /* BTRFS_FLAT_INCLUDES */
|
|
+
|
|
+/*
|
|
+ * This function should be only used when parsing command arg, it won't return
|
|
+ * error to its caller and rather exit directly just like usage().
|
|
+ */
|
|
+u64 arg_strtou64(const char *str)
|
|
+{
|
|
+ u64 value;
|
|
+ char *ptr_parse_end = NULL;
|
|
+
|
|
+ value = strtoull(str, &ptr_parse_end, 0);
|
|
+ if (ptr_parse_end && *ptr_parse_end != '\0') {
|
|
+ fprintf(stderr, "ERROR: %s is not a valid numeric value.\n",
|
|
+ str);
|
|
+ exit(1);
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ * if we pass a negative number to strtoull, it will return an
|
|
+ * unexpected number to us, so let's do the check ourselves.
|
|
+ */
|
|
+ if (str[0] == '-') {
|
|
+ fprintf(stderr, "ERROR: %s: negative value is invalid.\n",
|
|
+ str);
|
|
+ exit(1);
|
|
+ }
|
|
+ if (value == ULLONG_MAX) {
|
|
+ fprintf(stderr, "ERROR: %s is too large.\n", str);
|
|
+ exit(1);
|
|
+ }
|
|
+ return value;
|
|
+}
|
|
diff --git a/utils.c b/utils.c
|
|
index 29953d9dd2a9..e130849c7bb5 100644
|
|
--- a/utils.c
|
|
+++ b/utils.c
|
|
@@ -1538,39 +1538,6 @@ scan_again:
|
|
return 0;
|
|
}
|
|
|
|
-/*
|
|
- * This function should be only used when parsing
|
|
- * command arg, it won't return error to it's
|
|
- * caller and rather exit directly just like usage().
|
|
- */
|
|
-u64 arg_strtou64(const char *str)
|
|
-{
|
|
- u64 value;
|
|
- char *ptr_parse_end = NULL;
|
|
-
|
|
- value = strtoull(str, &ptr_parse_end, 0);
|
|
- if (ptr_parse_end && *ptr_parse_end != '\0') {
|
|
- fprintf(stderr, "ERROR: %s is not a valid numeric value.\n",
|
|
- str);
|
|
- exit(1);
|
|
- }
|
|
- /*
|
|
- * if we pass a negative number to strtoull,
|
|
- * it will return an unexpected number to us,
|
|
- * so let's do the check ourselves.
|
|
- */
|
|
- if (str[0] == '-') {
|
|
- fprintf(stderr, "ERROR: %s: negative value is invalid.\n",
|
|
- str);
|
|
- exit(1);
|
|
- }
|
|
- if (value == ULLONG_MAX) {
|
|
- fprintf(stderr, "ERROR: %s is too large.\n", str);
|
|
- exit(1);
|
|
- }
|
|
- return value;
|
|
-}
|
|
-
|
|
u64 parse_size(char *s)
|
|
{
|
|
int i;
|
|
--
|
|
1.9.0
|
|
|