xref: /freebsd/sys/contrib/openzfs/config/kernel-sysfs.m4 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1dnl #
2dnl # Linux 5.2/5.18 API
3dnl #
4dnl # In cdb4f26a63c391317e335e6e683a614358e70aeb ("kobject: kobj_type: remove default_attrs")
5dnl # 	struct kobj_type.default_attrs
6dnl # was finally removed in favour of
7dnl # 	struct kobj_type.default_groups
8dnl #
9dnl # This was added in aa30f47cf666111f6bbfd15f290a27e8a7b9d854 ("kobject: Add support for default attribute groups to kobj_type"),
10dnl # if both are present (5.2-5.17), we prefer default_groups; they're otherwise equivalent
11dnl #
12AC_DEFUN([ZFS_AC_KERNEL_SRC_SYSFS_DEFAULT_GROUPS], [
13	ZFS_LINUX_TEST_SRC([sysfs_default_groups], [
14		#include <linux/kobject.h>
15	],[
16		struct kobj_type __attribute__ ((unused)) kt = {
17			.default_groups = (const struct attribute_group **)NULL };
18	])
19])
20
21AC_DEFUN([ZFS_AC_KERNEL_SYSFS_DEFAULT_GROUPS], [
22	AC_MSG_CHECKING([whether struct kobj_type.default_groups exists])
23	ZFS_LINUX_TEST_RESULT([sysfs_default_groups],[
24		AC_MSG_RESULT(yes)
25		AC_DEFINE([HAVE_SYSFS_DEFAULT_GROUPS], 1, [struct kobj_type has default_groups])
26	],[
27		AC_MSG_RESULT(no)
28	])
29])
30
31AC_DEFUN([ZFS_AC_KERNEL_SRC_SYSFS], [
32	ZFS_AC_KERNEL_SRC_SYSFS_DEFAULT_GROUPS
33])
34
35AC_DEFUN([ZFS_AC_KERNEL_SYSFS], [
36	ZFS_AC_KERNEL_SYSFS_DEFAULT_GROUPS
37])
38