# # We try to detect the specific api incompatibilities with simple tests # because distros regularly backport features without changing the # version. # ccflags-y += -include $(src)/kernelcompat.h # # v5.19-rc4-96-g342a72a33407 # # Adds `typedef __u32 __bitwise blk_opf_t` to aid flag checking ifneq (,$(shell grep 'typedef __u32 __bitwise blk_opf_t' include/linux/blk_types.h)) ccflags-y += -DKC_HAVE_BLK_OPF_T=1 endif # # v5.12-rc6-9-g4f0f586bf0c8 # # list_sort cmp function takes const list_head args ifneq (,$(shell grep 'const struct list_head ., const struct list_head .' include/linux/list_sort.h)) ccflags-y += -DKC_LIST_CMP_CONST_ARG_LIST_HEAD endif # v5.7-523-g88dca4ca5a93 # # The pgprot argument to vmalloc is always PAGE_KERNEL, so it is removed. ifneq (,$(shell grep 'extern void .__vmalloc.unsigned long size, gfp_t gfp_mask, pgprot_t prot' include/linux/vmalloc.h)) ccflags-y += -DKC_VMALLOC_PGPROT_T endif # v6.2-rc1-18-g01beba7957a2 # # fs: port inode_owner_or_capable() to mnt_idmap ifneq (,$(shell grep 'bool inode_owner_or_capable.struct user_namespace .mnt_userns' include/linux/fs.h)) ccflags-y += -DKC_INODE_OWNER_OR_CAPABLE_USERNS endif # # v5.11-rc4-5-g47291baa8ddf # # namei: make permission helpers idmapped mount aware ifneq (,$(shell grep 'int inode_permission.struct user_namespace' include/linux/fs.h)) ccflags-y += -DKC_INODE_PERMISSION_USERNS endif # # v5.11-rc4-24-g549c7297717c # # fs: make helpers idmap mount aware # Enlarges the VFS API methods to include user namespace argument. ifneq (,$(shell grep 'int ..mknod. .struct user_namespace' include/linux/fs.h)) ccflags-y += -DKC_VFS_METHOD_USER_NAMESPACE_ARG endif # # v6.2-rc1-2-gabf08576afe3 # # fs: vfs methods use struct mnt_idmap instead of struct user_namespace ifneq (,$(shell grep 'int vfs_mknod.struct mnt_idmap' include/linux/fs.h)) ccflags-y += -DKC_VFS_METHOD_MNT_IDMAP_ARG endif # # v5.17-rc2-21-g07888c665b40 # # Detect new style bio_alloc - pass bdev and opf. ifneq (,$(shell grep 'struct bio .bio_alloc.struct block_device .bdev' include/linux/bio.h)) ccflags-y += -DKC_BIO_ALLOC_DEV_OPF_ARGS endif # # v5.7-rc4-53-gcddf8a2c4a82 # # fiemap_prep() replaces fiemap_check_flags() ifneq (,$(shell grep -s 'int fiemap_prep.struct inode' include/linux/fiemap.h)) ccflags-y += -DKC_FIEMAP_PREP endif # # v5.17-13043-g800ba29547e1 # # generic_perform_write args use kiocb for passing filp and pos ifneq (,$(shell grep 'ssize_t generic_perform_write.struct kiocb ., struct iov_iter' include/linux/fs.h)) ccflags-y += -DKC_GENERIC_PERFORM_WRITE_KIOCB_IOV_ITER endif # # v5.7-rc6-2496-g76ee0785f42a # # net: add sock_set_sndtimeo ifneq (,$(shell grep 'void sock_set_sndtimeo.struct sock' include/net/sock.h)) ccflags-y += -DKC_SOCK_SET_SNDTIMEO endif # # v5.8-rc4-1931-gba423fdaa589 # # setsockopt functions are now passed a sockptr_t value instead of char* ifneq (,$(shell grep -s 'include .linux/sockptr.h.' include/linux/net.h)) ccflags-y += -DKC_SETSOCKOPT_SOCKPTR_T endif # # v5.7-rc6-2507-g71c48eb81c9e # # Adds a bunch of low level TCP sock parameter functions that we want to use. ifneq (,$(shell grep 'int tcp_sock_set_keepintvl' include/linux/tcp.h)) ccflags-y += -DKC_HAVE_TCP_SET_SOCKFN endif # # v5.19-rc4-52-ge33c267ab70d # # register_shrinker now requires a name, used for debug stats etc. ifneq (,$(shell grep 'int __printf.*register_shrinker.struct shrinker .shrinker,' include/linux/shrinker.h)) ccflags-y += -DKC_SHRINKER_NAME endif # # v5.18-rc5-246-gf132ab7d3ab0 # # mpage_readpage() is now replaced with mpage_read_folio. ifneq (,$(shell grep 'int mpage_read_folio.struct folio .folio' include/linux/mpage.h)) ccflags-y += -DKC_MPAGE_READ_FOLIO endif # # v5.18-rc5-219-gb3992d1e2ebc # # block_write_begin() no longer is being passed aop_flags ifneq (,$(shell grep -C1 'int block_write_begin' include/linux/buffer_head.h | tail -n 2 | grep 'unsigned flags')) ccflags-y += -DKC_BLOCK_WRITE_BEGIN_AOP_FLAGS endif # # v6.0-rc6-9-g863f144f12ad # # the .tmpfile() vfs method calling convention changed and now a struct # file* is passed to this metiond instead of a dentry. The function also # should open the created file and call finish_open_simple() before returning. ifneq (,$(shell grep 'extern void d_tmpfile.struct dentry' include/linux/dcache.h)) ccflags-y += -DKC_D_TMPFILE_DENTRY endif # # v6.4-rc2-201-g0733ad800291 # # New blk_mode_t replaces abuse of fmode_t ifneq (,$(shell grep 'typedef unsigned int __bitwise blk_mode_t' include/linux/blkdev.h)) ccflags-y += -DKC_HAVE_BLK_MODE_T endif # # v6.4-rc2-186-g2736e8eeb0cc # # Reworks FMODE_EXCL kludge and instead modifies the blkdev_put() call to pass in # the (exclusive) holder to implement FMODE_EXCL handling. ifneq (,$(shell grep 'blkdev_put.struct block_device .bdev, void .holder' include/linux/blkdev.h)) ccflags-y += -DKC_BLKDEV_PUT_HOLDER_ARG endif # # v6.4-rc4-163-g0d625446d0a4 # # Entirely removes current->backing_dev_info to ultimately remove buffer_head # completely at some point. ifneq (,$(shell grep 'struct backing_dev_info.*backing_dev_info;' include/linux/sched.h)) ccflags-y += -DKC_CURRENT_BACKING_DEV_INFO endif # # v6.8-rc1-4-gf3a608827d1f # # adds bdev_file_open_by_path() and later in v6.8-rc1-30-ge97d06a46526 removes bdev_open_by_path() # which requires us to use the file method from now on. ifneq (,$(shell grep 'struct file.*bdev_file_open_by_path.const char.*path' include/linux/blkdev.h)) ccflags-y += -DKC_BDEV_FILE_OPEN_BY_PATH endif # # v6.7-rc4-153-g0a97c01cd20b # # list_lru_{add,del} -> list_lru_{add,del}_obj # ifneq (,$(shell grep '^bool list_lru_add_obj' include/linux/list_lru.h)) ccflags-y += -DKC_LIST_LRU_ADD_OBJ endif # # v6.12-rc6-227-gda0c02516c50 # # lru_list_walk_cb lock arg removed # ifneq (,$(shell grep 'struct list_lru_one \*list, spinlock_t \*lock, void \*cb_arg' include/linux/list_lru.h)) ccflags-y += -DKC_LIST_LRU_WALK_CB_LIST_LOCK endif # # v6.1-rc1-2-g138060ba92b3 # # set_acl now passed a struct dentry instead of inode. # ifneq (,$(shell grep 'int ..set_acl.*struct dentry' include/linux/fs.h)) ccflags-y += -DKC_SET_ACL_DENTRY endif # # v6.1-rc1-3-gcac2f8b8d8b5 # # get_acl renamed to get_inode_acl. # ifneq (,$(shell grep 'struct posix_acl.*get_inode_acl' include/linux/fs.h)) ccflags-y += -DKC_GET_INODE_ACL endif # # v6.15-13744-g41cb08555c41 # # from_timer renamed to timer_container_of. # ifneq (,$(shell grep 'define timer_container_of' include/linux/timer.h)) ccflags-y += -DKC_TIMER_CONTAINER_OF endif # # v6.4-rc1-4f80818b4a58c # # iomap needs iterator nofault support in the read/write paths. We can still # use iomap for fiemap and llseek though. # ifneq (,$(shell grep 'copy_page_to_iter_nofault' include/linux/uio.h)) ccflags-y += -DKC_USE_IOMAP_FOR_IO endif