]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tst_getsize: use ext2fs_get_device_size2() to support testing large devices
authorTheodore Ts'o <tytso@mit.edu>
Tue, 28 Dec 2021 20:17:31 +0000 (15:17 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 28 Dec 2021 20:17:31 +0000 (15:17 -0500)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/getsize.c
lib/ext2fs/tst_getsize.c

index 72656821409e8f11e41e3ac08500b96392b6cd5d..bcf30208ea791c51c295a1d0a8b6f56c1bc3d59f 100644 (file)
@@ -303,7 +303,7 @@ errcode_t ext2fs_get_device_size(const char *file, int blocksize,
 #ifdef DEBUG
 int main(int argc, char **argv)
 {
-       blk_t   blocks;
+       blk64_t blocks;
        int     retval;
 
        if (argc < 2) {
@@ -311,13 +311,14 @@ int main(int argc, char **argv)
                exit(1);
        }
 
-       retval = ext2fs_get_device_size(argv[1], 1024, &blocks);
+       retval = ext2fs_get_device_size2(argv[1], 1024, &blocks);
        if (retval) {
                com_err(argv[0], retval,
                        "while calling ext2fs_get_device_size");
                exit(1);
        }
-       printf("Device %s has %u 1k blocks.\n", argv[1], blocks);
+       printf("Device %s has %llu 1k blocks.\n", argv[1],
+              (unsigned long long) locks);
        exit(0);
 }
 #endif
index 4ac2ea1f131a7c26fd7c133acfa93e69b7fdd134..ba869dcec77b8d94bc45d29213b1968709136508 100644 (file)
 int main(int argc, const char *argv[])
 {
        errcode_t       retval;
-       blk_t           blocks;
+       blk64_t         blocks;
 
        if (argc < 2) {
                fprintf(stderr, "%s device\n", argv[0]);
                exit(1);
        }
        add_error_table(&et_ext2_error_table);
-       retval = ext2fs_get_device_size(argv[1], 1024, &blocks);
+       retval = ext2fs_get_device_size2(argv[1], 1024, &blocks);
        if (retval) {
                com_err(argv[0], retval, "while getting device size");
                exit(1);
        }
-       printf("%s is device has %u blocks.\n", argv[1], blocks);
+       printf("%s is device has %llu blocks.\n", argv[1],
+              (unsigned long long) blocks);
        return 0;
 }