悲剧了,加了句MODULE_LICENSE("GPL");就出错~~~

汗晕倒 汗晕倒 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#ifndef __kernel__
#define __kernel__
#endif

#ifndef MODULE
#define MODULE
#endif

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/debugfs.h>
#include <linux/init.h>
#include <linux/types.h>



MOUDULE_LICENSE( "GPL" );
static struct dentry *root_entry, *total_pages_entry;
static u64 total_pages;

extern long vm_total_pages;
static int __init debugfs_test_init(void)
{
total_pages = (u64)vm_total_pages;
root_entry = debugfs_create_dir("debugfs-root", NULL);
if (!root_entry) {
printk("Fail to create proc dir: debugfs-root\n");
return 1;
}

total_pages_entry = debugfs_create_u64("total_pages", 0644, root_entry, &total_pages);

return 0;
}

static void __exit debugfs_test_exit(void)
{
debugfs_remove(total_pages_entry);
debugfs_remove(root_entry);
}

module_init(debugfs_test_init);
module_exit(debugfs_test_exit);



这个是代码,一加那句就出错,我都迷茫了~~debugfs.c:17: 错误: expected declaration specifiers or ‘...’ before string constant.
还有个警告: 在‘MOUDULE_LICENSE’的声明中,类型默认为‘int’

都是这么写的,为什么它还搞成 int 的?

...全文
评论 8
收藏 已收藏
分享
返回顶部
汗晕倒
Linux_Kernel 4,469 成员 17,458 内容