aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-04-21 16:27:15 +0200
committerBrian Behlendorf <[email protected]>2022-04-25 10:00:09 -0700
commit642426095ae165ce64896c11ec52cab3ec3073ac (patch)
treec56d3ed35e880fb706d26b62c297ec1f8c8231f1 /config
parent972637dc06a04432dc58e240b8ef3e9f538b98bb (diff)
Linux 5.18 compat: kobj_type.default_attrs replaced with default_groups
Upstream-commit: cdb4f26a63c391317e335e6e683a614358e70aeb ("kobject: kobj_type: remove default_attrs") Upstream-commit: 0cdda2edb3f312d56518934811960ad57564c1bb Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13357
Diffstat (limited to 'config')
-rw-r--r--config/kernel-sysfs.m437
-rw-r--r--config/kernel.m42
2 files changed, 39 insertions, 0 deletions
diff --git a/config/kernel-sysfs.m4 b/config/kernel-sysfs.m4
new file mode 100644
index 000000000..668def5fe
--- /dev/null
+++ b/config/kernel-sysfs.m4
@@ -0,0 +1,37 @@
+dnl #
+dnl # Linux 5.2/5.18 API
+dnl #
+dnl # In cdb4f26a63c391317e335e6e683a614358e70aeb ("kobject: kobj_type: remove default_attrs")
+dnl # struct kobj_type.default_attrs
+dnl # was finally removed in favour of
+dnl # struct kobj_type.default_groups
+dnl #
+dnl # This was added in aa30f47cf666111f6bbfd15f290a27e8a7b9d854 ("kobject: Add support for default attribute groups to kobj_type"),
+dnl # if both are present (5.2-5.17), we prefer default_groups; they're otherwise equivalent
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_SRC_SYSFS_DEFAULT_GROUPS], [
+ ZFS_LINUX_TEST_SRC([sysfs_default_groups], [
+ #include <linux/kobject.h>
+ ],[
+ struct kobj_type __attribute__ ((unused)) kt = {
+ .default_groups = (const struct attribute_group **)NULL };
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_SYSFS_DEFAULT_GROUPS], [
+ AC_MSG_CHECKING([for struct kobj_type.default_groups])
+ ZFS_LINUX_TEST_RESULT([sysfs_default_groups],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_SYSFS_DEFAULT_GROUPS], 1, [struct kobj_type has default_groups])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_SRC_SYSFS], [
+ ZFS_AC_KERNEL_SRC_SYSFS_DEFAULT_GROUPS
+])
+
+AC_DEFUN([ZFS_AC_KERNEL_SYSFS], [
+ ZFS_AC_KERNEL_SYSFS_DEFAULT_GROUPS
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index 0ef7c7d0c..bb3fe2ebd 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -132,6 +132,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS
ZFS_AC_KERNEL_SRC_SIGNAL_STOP
ZFS_AC_KERNEL_SRC_SIGINFO
+ ZFS_AC_KERNEL_SRC_SYSFS
ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE
ZFS_AC_KERNEL_SRC_VFS_READPAGES
ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS
@@ -244,6 +245,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_BIO_MAX_SEGS
ZFS_AC_KERNEL_SIGNAL_STOP
ZFS_AC_KERNEL_SIGINFO
+ ZFS_AC_KERNEL_SYSFS
ZFS_AC_KERNEL_SET_SPECIAL_STATE
ZFS_AC_KERNEL_VFS_READPAGES
ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS