storage size of `nd' isn't known problem

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

 



hi everyone,

I wrote a small program to access the inode data for a
given filename with it's path. I am not sure whether
what i wrote was correct , but i could'nt get it to
compile at all and am clueless abt the error that it
is giving me.

The program is :

----------

#include <linux/fs.h>
#include <asm/namei.h>
#include <linux/dcache.h>
#include <linux/fs.h>
#include <linux/mount.h>
#include <linux/vfs.h>
#include <linux/stat.h>
#include <linux/string.h>
#include <stdio.h>

#define LOOKUP_FOLLOW		(1)
#define LOOKUP_POSITIVE		(8)

int resolve(const char * filename)
{
  struct nameidata nd;
  struct dentry *dentry;
  struct inode *inode;
  int error;

 
if(path_init(filename,LOOKUP_FOLLOW|LOOKUP_POSITIVE,&nd))
    error = path_walk(filename,&nd);
  if(error || !(nd.dentry->d_inode))
    printk("Problem with %s filename\n",filename);
  else{
    dentry = nd.dentry;
  }
  
  inode = dentry->d_inode;

  fprintf(stderr,"ino no is : %u",inode->i_ino);

  return 1;
}

int main(int argc, char *argv[])
{

  const char *filename = "/sbin/init";

  int result = resolve(filename);

  return 1;

}

----------

The error that it generates is :

----------

# gcc inode_data.c 
inode_data.c: In function `resolve':
inode_data.c:16: storage size of `nd' isn't known
inode_data.c:29: dereferencing pointer to incomplete
type
inode_data.c:31: dereferencing pointer to incomplete
type
# 
----------

Please suggest me how to get rid of these errors ??

Thanks

karthik

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
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