mohan.t
mohan.t

Reputation: 277

Getting error: implicit declaration of function 'proc_create'

I am getting the "implicit declaration of function 'proc_create'" error while compiling my driver module.I want to create a entry in /proc and print the number of programs which are using the module. Can you please let me know what is wrong in here?? Here is my code.

#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");
 }

Thanks in advance.

Upvotes: 2

Views: 2420

Answers (1)

NG.
NG.

Reputation: 22914

You also need to include <linux/proc_fs.h>

Upvotes: 3

Related Questions