mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Linux 6.5 compat: register_sysctl_table removed
Additionally, the .child element of ctl_table has been removed in 6.5. This change adds a new test for the pre-6.5 register_sysctl_table() function, and uses the old code in that case. If it isn't found, then the parentage entries in the tables are removed, and the register_sysctl call is provided the paths of "kernel/spl", "kernel/spl/kmem", and "kernel/spl/kstat" directly, to populate each subdirectory over three calls, as is the new API. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Coleman Kane <ckane@colemankane.org> Closes #15138
This commit is contained in:
		
							parent
							
								
									0ee7a08627
								
							
						
					
					
						commit
						cb115edfc6
					
				
							
								
								
									
										27
									
								
								config/kernel-register_sysctl_table.m4
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								config/kernel-register_sysctl_table.m4
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,27 @@ | |||||||
|  | dnl # | ||||||
|  | dnl # Linux 6.5 removes register_sysctl_table | ||||||
|  | dnl # | ||||||
|  | AC_DEFUN([ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE], [ | ||||||
|  | 	ZFS_LINUX_TEST_SRC([has_register_sysctl_table], [ | ||||||
|  | 		#include <linux/sysctl.h> | ||||||
|  | 
 | ||||||
|  | 		static struct ctl_table dummy_table[] = { | ||||||
|  | 			{} | ||||||
|  | 		}; | ||||||
|  | 
 | ||||||
|  |     ],[ | ||||||
|  | 		struct ctl_table_header *h | ||||||
|  | 			__attribute((unused)) = register_sysctl_table(dummy_table); | ||||||
|  |     ]) | ||||||
|  | ]) | ||||||
|  | 
 | ||||||
|  | AC_DEFUN([ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE], [ | ||||||
|  | 	AC_MSG_CHECKING([whether register_sysctl_table exists]) | ||||||
|  | 	ZFS_LINUX_TEST_RESULT([has_register_sysctl_table], [ | ||||||
|  | 		AC_MSG_RESULT([yes]) | ||||||
|  | 		AC_DEFINE(HAVE_REGISTER_SYSCTL_TABLE, 1, | ||||||
|  | 			[register_sysctl_table exists]) | ||||||
|  | 	],[ | ||||||
|  | 		AC_MSG_RESULT([no]) | ||||||
|  | 	]) | ||||||
|  | ]) | ||||||
| @ -148,6 +148,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ | |||||||
| 	ZFS_AC_KERNEL_SRC_FILEMAP | 	ZFS_AC_KERNEL_SRC_FILEMAP | ||||||
| 	ZFS_AC_KERNEL_SRC_WRITEPAGE_T | 	ZFS_AC_KERNEL_SRC_WRITEPAGE_T | ||||||
| 	ZFS_AC_KERNEL_SRC_RECLAIMED | 	ZFS_AC_KERNEL_SRC_RECLAIMED | ||||||
|  | 	ZFS_AC_KERNEL_SRC_REGISTER_SYSCTL_TABLE | ||||||
| 	case "$host_cpu" in | 	case "$host_cpu" in | ||||||
| 		powerpc*) | 		powerpc*) | ||||||
| 			ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE | 			ZFS_AC_KERNEL_SRC_CPU_HAS_FEATURE | ||||||
| @ -275,6 +276,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ | |||||||
| 	ZFS_AC_KERNEL_FILEMAP | 	ZFS_AC_KERNEL_FILEMAP | ||||||
| 	ZFS_AC_KERNEL_WRITEPAGE_T | 	ZFS_AC_KERNEL_WRITEPAGE_T | ||||||
| 	ZFS_AC_KERNEL_RECLAIMED | 	ZFS_AC_KERNEL_RECLAIMED | ||||||
|  | 	ZFS_AC_KERNEL_REGISTER_SYSCTL_TABLE | ||||||
| 	case "$host_cpu" in | 	case "$host_cpu" in | ||||||
| 		powerpc*) | 		powerpc*) | ||||||
| 			ZFS_AC_KERNEL_CPU_HAS_FEATURE | 			ZFS_AC_KERNEL_CPU_HAS_FEATURE | ||||||
|  | |||||||
| @ -624,6 +624,7 @@ static struct ctl_table spl_table[] = { | |||||||
| 		.mode		= 0644, | 		.mode		= 0644, | ||||||
| 		.proc_handler	= &proc_dohostid, | 		.proc_handler	= &proc_dohostid, | ||||||
| 	}, | 	}, | ||||||
|  | #ifdef HAVE_REGISTER_SYSCTL_TABLE | ||||||
| 	{ | 	{ | ||||||
| 		.procname	= "kmem", | 		.procname	= "kmem", | ||||||
| 		.mode		= 0555, | 		.mode		= 0555, | ||||||
| @ -634,9 +635,11 @@ static struct ctl_table spl_table[] = { | |||||||
| 		.mode		= 0555, | 		.mode		= 0555, | ||||||
| 		.child		= spl_kstat_table, | 		.child		= spl_kstat_table, | ||||||
| 	}, | 	}, | ||||||
|  | #endif | ||||||
| 	{}, | 	{}, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | #ifdef HAVE_REGISTER_SYSCTL_TABLE | ||||||
| static struct ctl_table spl_dir[] = { | static struct ctl_table spl_dir[] = { | ||||||
| 	{ | 	{ | ||||||
| 		.procname	= "spl", | 		.procname	= "spl", | ||||||
| @ -654,15 +657,32 @@ static struct ctl_table spl_root[] = { | |||||||
| 	}, | 	}, | ||||||
| 	{} | 	{} | ||||||
| }; | }; | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| int | int | ||||||
| spl_proc_init(void) | spl_proc_init(void) | ||||||
| { | { | ||||||
| 	int rc = 0; | 	int rc = 0; | ||||||
| 
 | 
 | ||||||
|  | #ifdef HAVE_REGISTER_SYSCTL_TABLE | ||||||
| 	spl_header = register_sysctl_table(spl_root); | 	spl_header = register_sysctl_table(spl_root); | ||||||
| 	if (spl_header == NULL) | 	if (spl_header == NULL) | ||||||
| 		return (-EUNATCH); | 		return (-EUNATCH); | ||||||
|  | #else | ||||||
|  | 	spl_header = register_sysctl("kernel/spl", spl_table); | ||||||
|  | 	if (spl_header == NULL) | ||||||
|  | 		return (-EUNATCH); | ||||||
|  | 
 | ||||||
|  | 	if (register_sysctl("kernel/spl/kmem", spl_kmem_table) == NULL) { | ||||||
|  | 		rc = -EUNATCH; | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (register_sysctl("kernel/spl/kstat", spl_kstat_table) == NULL) { | ||||||
|  | 		rc = -EUNATCH; | ||||||
|  | 		goto out; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| 	proc_spl = proc_mkdir("spl", NULL); | 	proc_spl = proc_mkdir("spl", NULL); | ||||||
| 	if (proc_spl == NULL) { | 	if (proc_spl == NULL) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Coleman Kane
						Coleman Kane