From 20b8342ccfed41245a997acee498bee2945c69f8 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 11 Mar 2019 10:12:49 +0100 Subject: [PATCH] hvt: Don't use fallocate outside Linux --- tenders/hvt/hvt_module_blk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tenders/hvt/hvt_module_blk.c b/tenders/hvt/hvt_module_blk.c index 354e1bba..3f14968b 100644 --- a/tenders/hvt/hvt_module_blk.c +++ b/tenders/hvt/hvt_module_blk.c @@ -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) @@ -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)