oaf: fix build for linux-6.4

Signed-off-by: sbwml <admin@cooluc.com>
This commit is contained in:
sbwml 2023-12-11 00:46:08 +08:00
parent 0652b382dd
commit 19fb0c53a1
2 changed files with 11 additions and 0 deletions

View File

@ -67,7 +67,9 @@ static struct ctl_table oaf_root_table[] = {
{
.procname = "oaf",
.mode = 0555,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = oaf_table,
#endif
},
{}
};
@ -76,7 +78,11 @@ static struct ctl_table_header *oaf_table_header;
static int af_init_log_sysctl(void)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
oaf_table_header = register_sysctl_table(oaf_root_table);
#else
oaf_table_header = register_sysctl(oaf_root_table->procname, oaf_table);
#endif
if (oaf_table_header == NULL){
printk("init log sysctl...failed\n");
return -ENOMEM;

View File

@ -12,6 +12,7 @@
#include <linux/cdev.h>
#include <linux/vmalloc.h>
#include <linux/device.h>
#include <linux/version.h>
#include "cJSON.h"
#include "app_filter.h"
#include "af_utils.h"
@ -419,7 +420,11 @@ int af_register_dev(void)
goto REGION_OUT;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)
g_af_dev.c = class_create(THIS_MODULE, AF_DEV_NAME);
#else
g_af_dev.c = class_create(AF_DEV_NAME);
#endif
if (IS_ERR_OR_NULL(g_af_dev.c))
{
goto CDEV_OUT;