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

汗晕倒 2010-10-15 03:38:34
#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 的?

...全文
1200 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
coollu925 2010-11-22
  • 打赏
  • 举报
回复
O(∩_∩)O哈哈~
lgch123456 2010-11-21
  • 打赏
  • 举报
回复
shit !真是杯具啊。。。
yi1011 2010-11-21
  • 打赏
  • 举报
回复
真是杯具啊。。。
flarain 2010-11-20
  • 打赏
  • 举报
回复
我也遇到这个问题了,但我的还是出现那种错误啊,int。。
steptodream 2010-10-16
  • 打赏
  • 举报
回复
他好像自己已经发现错误了
Wenxy1 2010-10-16
  • 打赏
  • 举报
回复
MOUDULE_LICENSE( "GPL" );
改成:
MODULE_LICENSE("GPL");

打错字了,楼主也不参考下kernel里,别人是如何写的?
汗晕倒 2010-10-16
  • 打赏
  • 举报
回复
嗯 我自己看到了~
汗晕倒 2010-10-15
  • 打赏
  • 举报
回复
汗 写错了 写成MOUDULE_LICENSE了 悲剧~

4,436

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧