[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH] block/export/fuse: Fix build failure on FreeBSD
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [RFC PATCH] block/export/fuse: Fix build failure on FreeBSD |
Date: |
Tue, 1 Feb 2022 12:14:13 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 |
On 1/27/22 17:15, Kevin Wolf wrote:
> Am 22.01.2022 um 14:49 hat Philippe Mathieu-Daudé geschrieben:
>> When building on FreeBSD we get:
>>
>> [816/6851] Compiling C object libblockdev.fa.p/block_export_fuse.c.o
>> ../block/export/fuse.c:628:16: error: use of undeclared identifier
>> 'FALLOC_FL_KEEP_SIZE'
>> if (mode & FALLOC_FL_KEEP_SIZE) {
>> ^
>> ../block/export/fuse.c:632:16: error: use of undeclared identifier
>> 'FALLOC_FL_PUNCH_HOLE'
>> if (mode & FALLOC_FL_PUNCH_HOLE) {
>> ^
>> ../block/export/fuse.c:633:22: error: use of undeclared identifier
>> 'FALLOC_FL_KEEP_SIZE'
>> if (!(mode & FALLOC_FL_KEEP_SIZE)) {
>> ^
>> 3 errors generated.
>> FAILED: libblockdev.fa.p/block_export_fuse.c.o
>>
>> Meson indeed reported FALLOC_FL_PUNCH_HOLE is not available:
>>
>> C compiler for the host machine: cc (clang 10.0.1 "FreeBSD clang version
>> 10.0.1")
>> Checking for function "fallocate" : NO
>> Checking for function "posix_fallocate" : YES
>> Header <linux/falloc.h> has symbol "FALLOC_FL_PUNCH_HOLE" : NO
>> Header <linux/falloc.h> has symbol "FALLOC_FL_ZERO_RANGE" : NO
>> ...
>>
>> Similarly to commit 304332039 ("block/export/fuse.c: fix musl build"),
>> guard the code requiring FALLOC_FL_KEEP_SIZE / FALLOC_FL_PUNCH_HOLE
>> definitions under CONFIG_FALLOCATE_PUNCH_HOLE #ifdef'ry.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>> ---
>> Fragile #ifdef'ry... Any clever idea?
>
> I guess we could reorder things. The last case (!mode) is mutually
> exclusive with the other conditions, so checking it first doesn't make a
> difference, and then you can #ifdef things out more cleanly.
This is indeed clever, thanks! v3 soon.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [RFC PATCH] block/export/fuse: Fix build failure on FreeBSD,
Philippe Mathieu-Daudé <=