0

i am using proc_dir_entry in linux 3.13 but i got this error "dereferencing pointer to incomplete type" in this lines of code :

  struct proc_dir_entry *proc = proc_create("hello_proc", 0, NULL, &hello_proc_fops);
    printk(KERN_DEBUG "name : %s\n",proc->name);

it seem like the compile doesnt recognize the data structure

ArK
  • 20,698
  • 67
  • 109
  • 136
Waheni
  • 1
  • 2

2 Answers2

2

The internals of struct proc_dir_entry were made opaque in Linux kernel 3.10 by commit 59d8053f1e16904d54ed7469d4b36801ea6b8f2c, so all you get now is a pointer to an incomplete type.

The "dereferencing pointer to incomplete type" error is due to the expression proc->name due to struct proc_dir_entry being incomplete.

Ian Abbott
  • 15,083
  • 19
  • 33
  • Thanks for reply , what is the solution , that mean i musn't use this data structure ? – Waheni Aug 16 '16 at 11:23
  • Is there any way to work with variable like "name" , "next", "parent" or "subdir" ? all of those are useful – Waheni Aug 16 '16 at 11:31
  • 1
    @Waheni All you get to work with is what is defined by `#include `, which doesn't provide access to any of the things you mention above. – Ian Abbott Aug 16 '16 at 11:38
1

you can try this answer may be you forgot to put include statements

#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
Community
  • 1
  • 1
canbax
  • 3,432
  • 1
  • 27
  • 44