1 Star 0 Fork 27

Mr_hupeng/itrustee_tzdriver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ko_adapt.h 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
/*
* ko_adapt.h
*
* function for find symbols not exported
*
* Copyright (c) 2012-2022 Huawei Technologies Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef KO_ADAPT_H
#define KO_ADAPT_H
#include <linux/types.h>
#include <linux/cred.h>
#include <linux/version.h>
#if (KERNEL_VERSION(4, 14, 0) <= LINUX_VERSION_CODE)
#include <linux/sched/task.h>
#endif
#include <linux/kthread.h>
#include <linux/cpumask.h>
#include <linux/syscalls.h>
#include <linux/version.h>
#include <linux/gfp.h>
#ifdef CONFIG_TZDRIVER_MODULE
const struct cred *koadpt_get_task_cred(struct task_struct *task);
void koadpt_kthread_bind_mask(struct task_struct *task,
const struct cpumask *mask);
struct page *koadpt_alloc_pages(gfp_t gfp_mask, unsigned int order);
struct workqueue_attrs *koadpt_alloc_workqueue_attrs(gfp_t gfp_mask);
void koadpt_free_workqueue_attrs(struct workqueue_attrs *attrs);
#else
static inline const struct cred *koadpt_get_task_cred(struct task_struct *task)
{
return get_task_cred(task);
}
static inline void koadpt_kthread_bind_mask(struct task_struct *task,
const struct cpumask *mask)
{
kthread_bind_mask(task, mask);
}
static inline struct page *koadpt_alloc_pages(gfp_t gfp_mask, unsigned int order)
{
return alloc_pages(gfp_mask, order);
}
static inline struct workqueue_attrs *koadpt_alloc_workqueue_attrs(
gfp_t gfp_mask)
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 19, 0))
return alloc_workqueue_attrs(gfp_mask);
#else
(void)gfp_mask;
return alloc_workqueue_attrs();
#endif
}
static inline void koadpt_free_workqueue_attrs(struct workqueue_attrs *attrs)
{
return free_workqueue_attrs(attrs);
}
#endif
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mrhupeng/itrustee_tzdriver.git
git@gitee.com:mrhupeng/itrustee_tzdriver.git
mrhupeng
itrustee_tzdriver
itrustee_tzdriver
master

搜索帮助