xref: /freebsd/sys/contrib/openzfs/config/kernel-genhd-flags.m4 (revision a8089ea5aee578e08acab2438e82fc9a9ae50ed8)
1dnl #
2dnl # 5.17 API change,
3dnl #
4dnl # GENHD_FL_EXT_DEVT flag removed
5dnl # GENHD_FL_NO_PART_SCAN renamed GENHD_FL_NO_PART
6dnl #
7AC_DEFUN([ZFS_AC_KERNEL_SRC_GENHD_FLAGS], [
8
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	])
14
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	])
20
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	])
26])
27
28AC_DEFUN([ZFS_AC_KERNEL_GENHD_FLAGS], [
29
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	])
40
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)
48
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	])
58])
59