* Helper for creating file and write @size byte buf with 0xaa value in the file. */
| 75 | * Helper for creating file and write @size byte buf with 0xaa value in the file. |
| 76 | */ |
| 77 | static void __t_create_file(const char *file, size_t size, char pattern) |
| 78 | { |
| 79 | ssize_t ret; |
| 80 | char *buf; |
| 81 | int fd; |
| 82 | |
| 83 | buf = t_malloc(size); |
| 84 | memset(buf, pattern, size); |
| 85 | |
| 86 | fd = open(file, O_WRONLY | O_CREAT, 0644); |
| 87 | assert(fd >= 0); |
| 88 | |
| 89 | ret = write(fd, buf, size); |
| 90 | fsync(fd); |
| 91 | close(fd); |
| 92 | free(buf); |
| 93 | assert(ret == size); |
| 94 | } |
| 95 | |
| 96 | void t_create_file(const char *file, size_t size) |
| 97 | { |
no test coverage detected