Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuse build fixes for FreeBSD #244

Merged
merged 4 commits into from
Feb 1, 2024
Merged

Fuse build fixes for FreeBSD #244

merged 4 commits into from
Feb 1, 2024

Commits on Jan 30, 2024

  1. block/export/fuse.c: fix musl build

    Fix the following build failure on musl raised since version 6.0.0 and
    https://gitlab.com/qemu-project/qemu/-/commit/4ca37a96a75aafe7a37ba51ab1912b09b7190a6b
    because musl does not define FALLOC_FL_ZERO_RANGE:
    
    ../block/export/fuse.c: In function 'fuse_fallocate':
    ../block/export/fuse.c:563:23: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function)
      563 |     } else if (mode & FALLOC_FL_ZERO_RANGE) {
          |                       ^~~~~~~~~~~~~~~~~~~~
    
    Fixes:
     - http://autobuild.buildroot.org/results/b96e3d364fd1f8bbfb18904a742e73327d308f64
    
    Signed-off-by: Fabrice Fontaine <[email protected]>
    Message-Id: <[email protected]>
    Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
    Reviewed-by: Denis V. Lunev <[email protected]>
    Signed-off-by: Hanna Reitz <[email protected]>
    (cherry picked from commit 50482fda98bd62e072c30b7ea73c985c4e9d9bbb)
    ffontaine authored and bsdjhb committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    c0119df View commit details
    Browse the repository at this point in the history
  2. block/export/fuse.c: fix musl build

    Include linux/falloc.h if CONFIG_FALLOCATE_ZERO_RANGE is defined to fix
    https://gitlab.com/qemu-project/qemu/-/commit/50482fda98bd62e072c30b7ea73c985c4e9d9bbb
    and avoid the following build failure on musl:
    
    ../block/export/fuse.c: In function 'fuse_fallocate':
    ../block/export/fuse.c:643:21: error: 'FALLOC_FL_ZERO_RANGE' undeclared (first use in this function)
      643 |     else if (mode & FALLOC_FL_ZERO_RANGE) {
          |                     ^~~~~~~~~~~~~~~~~~~~
    
    Fixes:
     - http://autobuild.buildroot.org/results/be24433a429fda681fb66698160132c1c99bc53b
    
    Fixes: 50482fda98b ("block/export/fuse.c: fix musl build")
    Signed-off-by: Fabrice Fontaine <[email protected]>
    Message-Id: <[email protected]>
    Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
    Signed-off-by: Kevin Wolf <[email protected]>
    (cherry picked from commit 304332039014679b809f606e2f227ee0fc43a451)
    ffontaine authored and bsdjhb committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    82cd148 View commit details
    Browse the repository at this point in the history
  3. block/export/fuse: Rearrange if-else-if ladder in fuse_fallocate()

    In order to safely maintain a mixture of #ifdef'ry with if-else-if
    ladder, rearrange the last statement (!mode) first. Since it is
    mutually exclusive with the other conditions, checking it first
    doesn't make any logical difference, but allows to add #ifdef'ry
    around in a more cleanly way.
    
    Suggested-by: Kevin Wolf <[email protected]>
    Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Kevin Wolf <[email protected]>
    (cherry picked from commit ac50419460cc45a66214e6d1c3e9d0d670522f8a)
    philmd authored and bsdjhb committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    8dd73d0 View commit details
    Browse the repository at this point in the history
  4. block/export/fuse: Fix build failure on FreeBSD

    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:651:16: error: use of undeclared identifier 'FALLOC_FL_PUNCH_HOLE'
          if (mode & FALLOC_FL_PUNCH_HOLE) {
                     ^
      ../block/export/fuse.c:652: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é <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Kevin Wolf <[email protected]>
    (cherry picked from commit 3c9c70347b8e636c08035f39288f8cdd2e68bbda)
    philmd authored and bsdjhb committed Jan 30, 2024
    Configuration menu
    Copy the full SHA
    d648437 View commit details
    Browse the repository at this point in the history