2013-10-26 34 views
2

我正在編譯我的驅動程序模塊時得到「隱式聲明函數'proc_create'」錯誤。我想在/ proc中創建一個條目,並打印出使用該模塊。你能讓我知道這裏有什麼不對嗎?這是我的代碼。獲取錯誤:函數的隱式聲明'proc_create'

#include<linux/module.h> 
#include<linux/fs.h> 

#define HELLO_MAJOR 234 
static int debug_enable = 0; 
static int no_of_access; 
module_param(debug_enable, int, 0); 
MODULE_PARM_DESC(debug_enable, "Enable module debug mode."); 
struct file_operations hello_fops; 
struct proc_dir_entry *proc_file_entry; 

<File operation functions...> 
<Incremented global_counter in the file open operation.> 

static int hello1_read_proc(char *buf, char **start, off_t offset, 
          int count, int *eof, void *data) 
{ 
    int len=0; 
    len += sprintf(buf+len, no_of_access); 
    *eof=1; 
    return len; 

} 

static int __init hello_init(void) 
{ 
    int ret; 
    proc_file_entry = proc_create("examples/hello1", 0,NULL, hello1_read_proc); 
    if(proc_file_entry == NULL) 
      return -ENOMEM; 
    printk("\nProc file entry for hello1 has been created !!!\n"); 

} 

static void __exit hello_exit(void) 
{ 
    printk("Hello Example Exit\n"); 
    remove_proc_entry("exmaples/hello1", NULL); 
    unregister_chrdev(HELLO_MAJOR,"hello1"); 
} 

在此先感謝。

回答

3

您還需要包含<linux/proc_fs.h>

相關問題