* Each offset in the file has the offset / sizeof(int) stored for every * sizeof(int) address. */
| 52 | * sizeof(int) address. |
| 53 | */ |
| 54 | static int verify_buf(void *buf, size_t size, off_t off, bool registered) |
| 55 | { |
| 56 | int i, u_in_buf = size / sizeof(unsigned int); |
| 57 | unsigned int *ptr; |
| 58 | |
| 59 | verify_buf_sync(buf, size, registered); |
| 60 | |
| 61 | off /= sizeof(unsigned int); |
| 62 | ptr = buf; |
| 63 | for (i = 0; i < u_in_buf; i++) { |
| 64 | if (off != *ptr) { |
| 65 | fprintf(stderr, "Found %u, wanted %llu\n", *ptr, |
| 66 | (unsigned long long) off); |
| 67 | return 1; |
| 68 | } |
| 69 | ptr++; |
| 70 | off++; |
| 71 | } |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | static int test_truncate(struct io_uring *ring, const char *fname, int buffered, |
| 77 | int vectored, int provide_buf) |