Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:GA
xfsprogs
xfsprogs-xfs_io-Make-copy_range-arguments-under...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File xfsprogs-xfs_io-Make-copy_range-arguments-understand-iB-values.patch of Package xfsprogs
From 25b4549c8b54134106cff094aa098eab9e86eee7 Mon Sep 17 00:00:00 2001 From: Goldwyn Rodrigues <rgoldwyn@suse.com> Date: Thu, 31 May 2018 14:09:55 -0500 Subject: [PATCH] xfs_io: Make copy_range arguments understand *iB values Git-commit: 25b4549c8b54134106cff094aa098eab9e86eee7 Patch-mainline: v4.17.0-rc1 References: bsc#1158630 Arguments such as 2MiB or 2M are converted to 2 because copy_range uses strtoull(). Convert strtoull() to cvtnum(). Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Eric Sandeen <sandeen@sandeen.net> Acked-by: Anthony Iliopoulos <ailiopoulos@suse.com> --- io/copy_file_range.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/io/copy_file_range.c b/io/copy_file_range.c index 99fba20a..ebd1ec76 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -47,7 +47,7 @@ copy_range_help(void) * glibc buffered copy fallback. */ static loff_t -copy_file_range_cmd(int fd, loff_t *src, loff_t *dst, size_t len) +copy_file_range_cmd(int fd, long long *src, long long *dst, long long len) { loff_t ret; @@ -89,34 +89,36 @@ copy_dst_truncate(void) static int copy_range_f(int argc, char **argv) { - loff_t src = 0; - loff_t dst = 0; + long long src = 0; + long long dst = 0; size_t len = 0; - char *sp; int opt; int ret; int fd; + size_t fsblocksize, fssectsize; + + init_cvtnum(&fsblocksize, &fssectsize); while ((opt = getopt(argc, argv, "s:d:l:")) != -1) { switch (opt) { case 's': - src = strtoull(optarg, &sp, 10); - if (!sp || sp == optarg) { - printf(_("invalid source offset -- %s\n"), sp); + src = cvtnum(fsblocksize, fssectsize, optarg); + if (src < 0) { + printf(_("invalid source offset -- %s\n"), optarg); return 0; } break; case 'd': - dst = strtoull(optarg, &sp, 10); - if (!sp || sp == optarg) { - printf(_("invalid destination offset -- %s\n"), sp); + dst = cvtnum(fsblocksize, fssectsize, optarg); + if (dst < 0) { + printf(_("invalid destination offset -- %s\n"), optarg); return 0; } break; case 'l': - len = strtoull(optarg, &sp, 10); - if (!sp || sp == optarg) { - printf(_("invalid length -- %s\n"), sp); + len = cvtnum(fsblocksize, fssectsize, optarg); + if (len < 0) { + printf(_("invalid length -- %s\n"), optarg); return 0; } break; -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor