]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-bio_set_dev.m4
Linux 5.0 compat: Fix bio_set_dev()
[mirror_zfs.git] / config / kernel-bio_set_dev.m4
CommitLineData
787acae0
GDN
1dnl #
2dnl # Linux 4.14 API,
3dnl #
26a85659 4dnl # The bio_set_dev() helper macro was introduced as part of the transition
787acae0
GDN
5dnl # to have struct gendisk in struct bio.
6dnl #
26a85659 7AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_MACRO], [
787acae0
GDN
8 AC_MSG_CHECKING([whether bio_set_dev() exists])
9 ZFS_LINUX_TRY_COMPILE([
10 #include <linux/bio.h>
11 #include <linux/fs.h>
12 ],[
13 struct block_device *bdev = NULL;
14 struct bio *bio = NULL;
15 bio_set_dev(bio, bdev);
16 ],[
17 AC_MSG_RESULT(yes)
18 AC_DEFINE(HAVE_BIO_SET_DEV, 1, [bio_set_dev() exists])
19 ],[
20 AC_MSG_RESULT(no)
21 ])
22])
26a85659
BB
23
24dnl #
25dnl # Linux 5.0 API,
26dnl #
27dnl # The bio_set_dev() helper macro was updated to internally depend on
28dnl # bio_associate_blkg() symbol which is exported GPL-only.
29dnl #
30AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY], [
31 AC_MSG_CHECKING([whether bio_set_dev() is GPL-only])
32 ZFS_LINUX_TRY_COMPILE([
33 #include <linux/module.h>
34 #include <linux/bio.h>
35 #include <linux/fs.h>
36 MODULE_LICENSE("$ZFS_META_LICENSE");
37 ],[
38 struct block_device *bdev = NULL;
39 struct bio *bio = NULL;
40 bio_set_dev(bio, bdev);
41 ],[
42 AC_MSG_RESULT(no)
43 ],[
44 AC_MSG_RESULT(yes)
45 AC_DEFINE(HAVE_BIO_SET_DEV_GPL_ONLY, 1,
46 [bio_set_dev() GPL-only])
47 ])
48])
49
50AC_DEFUN([ZFS_AC_KERNEL_BIO_SET_DEV], [
51 ZFS_AC_KERNEL_BIO_SET_DEV_MACRO
52 ZFS_AC_KERNEL_BIO_SET_DEV_GPL_ONLY
53])