#include
#include
#include
#include
static struct proc_dir_entry *mod_entry;
static int __init tarp_init(void)
{
mod_entry = create_proc_entry(MODULE_PATH, 0644, NULL);
mod_entry->owner = THIS_MODULE;
mod_entry->read_proc = proc_read;
mod_entry->write_proc = proc_write;
printk(KERN_INFO "%s module loaded\n", MODULE_NAME);
return 0;
}
网上有人说这样的错误提示,是因为头文件包含的不全,可是我已经把能包含的头文件都放上去了,然并卵。。。跪求大神指点啊,这个问题已经卡了好几天了。。。倾家荡产重谢!!!!
是没有后续实现,应该是内核配置时应该选择错误了。找一下改改就行了
能说的具体点么?是编译时候要加个什么库么?
proc_dir_entry 指针,说明在 create 时发生了错误。然后就可以使用这个返回的指针来配置这个虚拟文件的其他参数,struct proc_dir_entry *create_proc_entry( const char *name, mode_t mode, struct proc_dir_entry *parent ); struct proc_dir_entry { const char *name; // virtual file name mode_t mode; // mode permissions uid_t uid; // File's user id gid_t gid; // File's group id struct inode_operations *proc_iops; // Inode operations functions struct file_operations *proc_fops; // File operations functions struct proc_dir_entry *parent; // Parent directory ... read_proc_t *read_proc; // /proc read function write_proc_t *write_proc; // /proc write function void *data;// Pointer to private data atomic_t count; // use count ... }; void remove_proc_entry( const char *name, struct proc_dir_entry *parent );
奇怪的是,在3.13内核代码中用grep命令搜索都找不到struct proc_dir_entry的定义。搜到好多文件都是直接用,没有找到定义