1.1 --- a/tests/dstest_block_client.cc Fri Oct 28 01:32:32 2022 +0200
1.2 +++ b/tests/dstest_block_client.cc Sat Oct 29 01:19:48 2022 +0200
1.3 @@ -23,6 +23,9 @@
1.4 #include <l4/sys/err.h>
1.5
1.6 #include <systypes/fcntl.h>
1.7 +#include <systypes/format.h>
1.8 +
1.9 +#define FMToffsetd "%" pFMToffset "d"
1.10
1.11 #include <stdio.h>
1.12 #include <string.h>
1.13 @@ -44,7 +47,7 @@
1.14 offset_t remaining = file_populated_span(file) - offset;
1.15 offset_t sample_remaining = remaining < sample ? remaining : sample;
1.16
1.17 - printf("%lld bytes from %p...\n", sample_remaining, (file->memory + offset));
1.18 + printf(FMToffsetd " bytes from %p...\n", sample_remaining, (file->memory + offset));
1.19 memcpy(buf, (file->memory + offset), sample_remaining);
1.20 buf[sample_remaining] = '\0';
1.21
1.22 @@ -70,10 +73,10 @@
1.23
1.24 printf("----\n%s\n----\n", outbuf);
1.25
1.26 - printf("[%lld zero bytes at start]\n", leading);
1.27 + printf("[" FMToffsetd " zero bytes at start]\n", leading);
1.28 printf("[%zd bytes shown]\n", strlen(outbuf));
1.29 - printf("[%lld bytes after string]\n", sample_remaining - leading - strlen(outbuf));
1.30 - printf("[%lld zero bytes at end]\n", trailing);
1.31 + printf("[" FMToffsetd " bytes after string]\n", sample_remaining - leading - strlen(outbuf));
1.32 + printf("[" FMToffsetd " zero bytes at end]\n", trailing);
1.33 }
1.34 }
1.35
1.36 @@ -120,7 +123,9 @@
1.37 return 1;
1.38 }
1.39
1.40 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.41 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.42 + " size " FMToffsetd ".\n",
1.43 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.44 printf("File contents:\n");
1.45
1.46 show(&file, step, sample);
1.47 @@ -128,7 +133,7 @@
1.48 printf("File shown.\n");
1.49 printf("Expected...\n"
1.50 "[0 zero bytes at start]\n"
1.51 - "[%lld bytes shown]\n"
1.52 + "[" FMToffsetd " bytes shown]\n"
1.53 "[0 bytes after string]\n"
1.54 "[0 zero bytes at end]\n\n",
1.55 original_size);
1.56 @@ -144,7 +149,9 @@
1.57 return 1;
1.58 }
1.59
1.60 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.61 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.62 + " size " FMToffsetd ".\n",
1.63 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.64 printf("File contents:\n");
1.65
1.66 show(&file, step, sample);
1.67 @@ -152,9 +159,9 @@
1.68 printf("File shown.\n");
1.69 printf("Expected...\n"
1.70 "[10 zero bytes at start]\n"
1.71 - "[%lld bytes shown]\n"
1.72 - "[%lld bytes after string]\n"
1.73 - "[%lld zero bytes at end]\n\n",
1.74 + "[" FMToffsetd " bytes shown]\n"
1.75 + "[" FMToffsetd " bytes after string]\n"
1.76 + "[" FMToffsetd " zero bytes at end]\n\n",
1.77 original_size - 20, 10ULL, 10ULL);
1.78
1.79 /* Resizing must occur before writing beyond the end of file. Otherwise, the
1.80 @@ -166,7 +173,7 @@
1.81 offset_t new_size = old_populated_size_rounded + old_populated_size;
1.82 offset_t new_region = round(new_size, page(1));
1.83
1.84 - printf("Resize to %lld...\n", new_size);
1.85 + printf("Resize to " FMToffsetd "...\n", new_size);
1.86
1.87 err = file_resize(&file, new_size);
1.88
1.89 @@ -177,8 +184,12 @@
1.90 }
1.91
1.92 printf("Resized file...\n");
1.93 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.94 - printf("Expected %lld...%lld populated size %lld size %lld.\n\n", 0ULL, old_populated_size_rounded, old_populated_size_rounded, new_size);
1.95 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.96 + " size " FMToffsetd ".\n",
1.97 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.98 + printf("Expected " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.99 + " size " FMToffsetd ".\n\n",
1.100 + 0ULL, old_populated_size_rounded, old_populated_size_rounded, new_size);
1.101
1.102 /* Re-map to avoid masking the region. */
1.103
1.104 @@ -191,10 +202,14 @@
1.105 }
1.106
1.107 printf("Remapped file without masking...\n");
1.108 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.109 - printf("Expected %lld...%lld populated size %lld size %lld.\n\n", 0ULL, new_region, old_populated_size, old_size);
1.110 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.111 + " size " FMToffsetd ".\n",
1.112 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.113 + printf("Expected " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.114 + " size " FMToffsetd ".\n\n",
1.115 + 0ULL, new_region, old_populated_size, old_size);
1.116
1.117 - printf("Resize to %lld...\n", new_size);
1.118 + printf("Resize to " FMToffsetd "...\n", new_size);
1.119
1.120 err = file_resize(&file, new_size);
1.121
1.122 @@ -205,16 +220,22 @@
1.123 }
1.124
1.125 printf("Resized file...\n");
1.126 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.127 - printf("Expected %lld...%lld populated size %lld size %lld.\n\n", 0ULL, round(new_size, page(1)), new_size, new_size);
1.128 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.129 + " size " FMToffsetd ".\n",
1.130 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.131 + printf("Expected " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.132 + " size " FMToffsetd ".\n\n",
1.133 + 0ULL, round(new_size, page(1)), new_size, new_size);
1.134
1.135 /* Copy the file data to another file region. */
1.136
1.137 - printf("Copy data to %lld...\n", old_populated_size_rounded);
1.138 + printf("Copy data to " FMToffsetd "...\n", old_populated_size_rounded);
1.139
1.140 memcpy(file.memory + old_populated_size_rounded, file.memory, old_size);
1.141
1.142 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.143 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.144 + " size " FMToffsetd ".\n",
1.145 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.146 printf("File contents:\n");
1.147
1.148 show(&file, step, sample);
1.149 @@ -222,12 +243,12 @@
1.150 printf("File shown.\n");
1.151 printf("Expected...\n"
1.152 "[0 zero bytes at start]\n"
1.153 - "[%lld bytes shown]\n"
1.154 - "[%lld bytes after string]\n"
1.155 - "[%lld zero bytes at end]\n"
1.156 + "[" FMToffsetd " bytes shown]\n"
1.157 + "[" FMToffsetd " bytes after string]\n"
1.158 + "[" FMToffsetd " zero bytes at end]\n"
1.159 "...\n"
1.160 "[0 zero bytes at start]\n"
1.161 - "[%lld bytes shown]\n"
1.162 + "[" FMToffsetd " bytes shown]\n"
1.163 "[0 bytes after string]\n"
1.164 "[0 zero bytes at end]\n\n",
1.165 original_size, sample - original_size, sample - original_size,
1.166 @@ -243,7 +264,9 @@
1.167 return 1;
1.168 }
1.169
1.170 - printf("Region %lld...%lld populated size %lld size %lld.\n", file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.171 + printf("Region " FMToffsetd "..." FMToffsetd " populated size " FMToffsetd
1.172 + " size " FMToffsetd ".\n",
1.173 + file.start_pos, file.end_pos, file_populated_span(&file), file.size);
1.174 printf("File contents:\n");
1.175
1.176 show(&file, step, sample);
1.177 @@ -251,12 +274,12 @@
1.178 printf("File shown.\n");
1.179 printf("Expected...\n"
1.180 "[10 zero bytes at start]\n"
1.181 - "[%lld bytes shown]\n"
1.182 - "[%lld bytes after string]\n"
1.183 - "[%lld zero bytes at end]\n"
1.184 + "[" FMToffsetd " bytes shown]\n"
1.185 + "[" FMToffsetd " bytes after string]\n"
1.186 + "[" FMToffsetd " zero bytes at end]\n"
1.187 "...\n"
1.188 "[0 zero bytes at start]\n"
1.189 - "[%lld bytes shown]\n"
1.190 + "[" FMToffsetd " bytes shown]\n"
1.191 "[10 bytes after string]\n"
1.192 "[10 zero bytes at end]\n",
1.193 original_size - 10, sample - original_size, sample - original_size,