• Nathan Chancellor's avatar
    bcachefs: Fix type of flags parameter for some ->trigger() implementations · 2d288745
    Nathan Chancellor authored
    When building with clang's -Wincompatible-function-pointer-types-strict
    (a warning designed to catch potential kCFI failures at build time),
    there are several warnings along the lines of:
    
      fs/bcachefs/bkey_methods.c:118:2: error: incompatible function pointer types initializing 'int (*)(struct btree_trans *, enum btree_id, unsigned int, struct bkey_s_c, struct bkey_s, enum btree_iter_update_trigger_flags)' with an expression of type 'int (struct btree_trans *, enum btree_id, unsigned int, struct bkey_s_c, struct bkey_s, unsigned int)' [-Werror,-Wincompatible-function-pointer-types-strict]
        118 |         BCH_BKEY_TYPES()
            |         ^~~~~~~~~~~~~~~~
      fs/bcachefs/bcachefs_format.h:394:2: note: expanded from macro 'BCH_BKEY_TYPES'
        394 |         x(inode,                8)                      \
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
      fs/bcachefs/bkey_methods.c:117:41: note: expanded from macro 'x'
        117 | #define x(name, nr) [KEY_TYPE_##name]   = bch2_bkey_ops_##name,
            |                                           ^~~~~~~~~~~~~~~~~~~~
      <scratch space>:277:1: note: expanded from here
        277 | bch2_bkey_ops_inode
            | ^~~~~~~~~~~~~~~~~~~
      fs/bcachefs/inode.h:26:13: note: expanded from macro 'bch2_bkey_ops_inode'
         26 |         .trigger        = bch2_trigger_inode,           \
          |                           ^~~~~~~~~~~~~~~~~~
    
    There are several functions that did not have their flags parameter
    converted to 'enum btree_iter_update_trigger_flags' in the recent
    unification, which will cause kCFI failures at runtime because the
    types, while ABI compatible (hence no warning from the non-strict
    version of this warning), do not match exactly.
    
    Fix up these functions (as well as a few other obvious functions that
    should have it, even if there are no warnings currently) to resolve the
    warnings and potential kCFI runtime failures.
    
    Fixes: 31e4ef3280c8 ("bcachefs: iter/update/trigger/str_hash flag cleanup")
    Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    2d288745
inode.h 6.52 KB