Fix O_APPEND for Linux 3.15 and older kernels
[zfs.git] / config / kernel-genhd-flags.m4
blobaf6a8a086bc95cd4039d98e1e5e8697d133a0623
1 dnl #
2 dnl # 5.17 API change,
3 dnl #
4 dnl # GENHD_FL_EXT_DEVT flag removed
5 dnl # GENHD_FL_NO_PART_SCAN renamed GENHD_FL_NO_PART
6 dnl #
7 AC_DEFUN([ZFS_AC_KERNEL_SRC_GENHD_FLAGS], [
9         ZFS_LINUX_TEST_SRC([genhd_fl_ext_devt], [
10                 #include <linux/blkdev.h>
11         ], [
12                 int flags __attribute__ ((unused)) = GENHD_FL_EXT_DEVT;
13         ])
15         ZFS_LINUX_TEST_SRC([genhd_fl_no_part], [
16                 #include <linux/blkdev.h>
17         ], [
18                 int flags __attribute__ ((unused)) = GENHD_FL_NO_PART;
19         ])
21         ZFS_LINUX_TEST_SRC([genhd_fl_no_part_scan], [
22                 #include <linux/blkdev.h>
23         ], [
24                 int flags __attribute__ ((unused)) = GENHD_FL_NO_PART_SCAN;
25         ])
28 AC_DEFUN([ZFS_AC_KERNEL_GENHD_FLAGS], [
30         AC_MSG_CHECKING([whether GENHD_FL_EXT_DEVT flag is available])
31         ZFS_LINUX_TEST_RESULT([genhd_fl_ext_devt], [
32                 AC_MSG_RESULT(yes)
33                 AC_DEFINE(ZFS_GENHD_FL_EXT_DEVT, GENHD_FL_EXT_DEVT,
34                     [GENHD_FL_EXT_DEVT flag is available])
35         ], [
36                 AC_MSG_RESULT(no)
37                 AC_DEFINE(ZFS_GENHD_FL_EXT_DEVT, 0,
38                     [GENHD_FL_EXT_DEVT flag is not available])
39         ])
41         AC_MSG_CHECKING([whether GENHD_FL_NO_PART flag is available])
42         ZFS_LINUX_TEST_RESULT([genhd_fl_no_part], [
43                 AC_MSG_RESULT(yes)
44                 AC_DEFINE(ZFS_GENHD_FL_NO_PART, GENHD_FL_NO_PART,
45                     [GENHD_FL_NO_PART flag is available])
46         ], [
47                 AC_MSG_RESULT(no)
49                 AC_MSG_CHECKING([whether GENHD_FL_NO_PART_SCAN flag is available])
50                 ZFS_LINUX_TEST_RESULT([genhd_fl_no_part_scan], [
51                         AC_MSG_RESULT(yes)
52                         AC_DEFINE(ZFS_GENHD_FL_NO_PART, GENHD_FL_NO_PART_SCAN,
53                             [GENHD_FL_NO_PART_SCAN flag is available])
54                 ], [
55                         ZFS_LINUX_TEST_ERROR([GENHD_FL_NO_PART|GENHD_FL_NO_PART_SCAN])
56                 ])
57         ])