2 * Punch out every other block in a file.
3 * Copyright (C) 2016 Oracle.
14 int main(int argc, char *argv[])
25 printf("Usage: %s file\n", argv[0]);
26 printf("Punches every other block in the file.\n");
30 fd = open(argv[1], O_WRONLY);
34 error = fstat(fd, &s);
41 mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
42 for (offset = 0; offset < sz; offset += blksz * 2) {
43 error = fallocate(fd, mode, offset, blksz);