Skip to content

Commit

Permalink
hvt: Don't use fallocate outside Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
g2p committed Mar 11, 2019
1 parent 44ca733 commit 20b8342
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tenders/hvt/hvt_module_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static void hypercall_blkdiscard(struct hvt *hvt, hvt_gpa_t gpa)
return;
}

#if defined(__linux__)
ret = fallocate(
diskfd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, pos, len);
if (ret != 0)
Expand All @@ -104,6 +105,9 @@ static void hypercall_blkdiscard(struct hvt *hvt, hvt_gpa_t gpa)
} else {
di->ret = 0;
}
#else
di->ret = -2;
#endif
}

static void hypercall_blkread(struct hvt *hvt, hvt_gpa_t gpa)
Expand Down

0 comments on commit 20b8342

Please sign in to comment.