]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: copy_file_range length is a size_t
authorDave Chinner <dchinner@redhat.com>
Wed, 12 Dec 2018 17:42:40 +0000 (11:42 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 12 Dec 2018 17:42:40 +0000 (11:42 -0600)
copy_file_range() takes a size_t as it's length, not a "long long".
Therefore we need to be able to pass sizes larger than 8EB to it
to be able to test the interface fully and that requires copy_range
to accept all values except an explicit error value of "-1LL".

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Jan Tulak <jtulak@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/copy_file_range.c

index f118a3bfd506bd8255473b5344dbe25501a98d47..4e2969c9ca475e7c08914f9c2c8071e2f5e22ac5 100644 (file)
@@ -34,7 +34,7 @@ copy_range_help(void)
  * glibc buffered copy fallback.
  */
 static loff_t
-copy_file_range_cmd(int fd, long long *src, long long *dst, long long len)
+copy_file_range_cmd(int fd, long long *src, long long *dst, size_t len)
 {
        loff_t ret;
 
@@ -78,7 +78,7 @@ copy_range_f(int argc, char **argv)
 {
        long long src = 0;
        long long dst = 0;
-       long long len = 0;
+       size_t len = 0;
        int opt;
        int ret;
        int fd;
@@ -104,7 +104,7 @@ copy_range_f(int argc, char **argv)
                        break;
                case 'l':
                        len = cvtnum(fsblocksize, fssectsize, optarg);
-                       if (len < 0) {
+                       if (len == -1LL) {
                                printf(_("invalid length -- %s\n"), optarg);
                                return 0;
                        }