How to create proc under /proc/driver?

Posted by Mustika_wiguna on Stack Overflow See other posts from Stack Overflow or by Mustika_wiguna
Published on 2009-02-26T02:21:08Z Indexed on 2010/03/12 11:57 UTC
Read the original article Hit count: 246

Filed under:
|

I want to create a proc file under /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry :

...

struct proc_dir_entry *simpleproc_fops_entry;

simpleproc_fops_entry = create_proc_entry(MODULE_NAME, 0400, NULL /* proc_root_dir */);

...

After googling, I found suggestion to use proc_root_driver, but when I use it, error "proc_root_driver undeclared in this function". And also, proc_root_driver is not available in linux/proc_fs.h.

I have tried to declare structure like this:

struct proc_dir_entry proc_root; struct proc_dir_entry *proc_root_driver = &proc_root; Errors gone, but proc file didn't exist under /proc/driver or /proc

Anyone here can help me? Thanks in advances.

© Stack Overflow or respective owner

Related posts about linux-kernel

Related posts about kernel-module