Re: error: dereferencing pointer to incomplete type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> //CODE
> int my_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat
> *stat)
> {
>
>  struct vfsmount *temp_mnt;
> /*448*/ for(temp_mnt = (current->fs->pwdmnt); temp_mnt->mnt_list.next !=
> current->fs->pwdmnt; temp_mnt = temp_mnt->mnt_list.next)
>           {
>               printk("<0>************current  :
> %s\n",temp_mnt->mnt_sb->s_type->name);
>               if( (temp_mnt->mnt_sb) == global_sb)
>               vfs_getattr(temp_mnt, (global_sb->s_root), stat);
>           }
>  return 0;
> }
>
> //OUTPUT
>
> /ass/ram/ram.c:448: error: dereferencing pointer to incomplete type
> /ass/ram/ram.c:448: error: dereferencing pointer to incomplete type
> /ass/ram/ram.c:450: error: dereferencing pointer to incomplete type
> /ass/ram/ram.c:451: error: dereferencing pointer to incomplete type


I answered this question yesterday as well.

You are trying to access a list_head pointer instead of a vfsmount
pointer. list_heads are not like normal doubly linked lists, and point
to list_heads of another nodes. They have to be converted to the
contained pointer using list_entry() or container_of().

Next time you post your code with reference to line numbers, try and
use numbering.
eg ":set number" in vi

Regards,

--
Goldwyn

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux