get file attr from kernel space

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

 



 Hi *,
I'm writing a module whose aim is to fetch some file
attribute (like stat(2) in userspace does).

I'm trying with the inode->i_op->getattr startegy, but
this looks like the getattr function is not availabe
(...)
Any help is welcome.
Here's the code:

-------------
struct nameidata *my_nd;
struct iattr *my_ia;
struct inode *inode;
struct dentry *d_entry;
int error;

if(path_init(d, LOOKUP_FOLLOW|LOOKUP_POSITIVE, my_nd))
        error = path_walk(d, my_nd);
if(error || !(my_nd->dentry->d_inode))
        printk("Problem with %s\n",d);
else{
        d_entry = my_nd->dentry;
        inode = d_entry->d_inode;
        printk("got d_entry\n");
    }

/* below here I always get to the "else" branch :(* */

if (inode->i_op && inode->i_op->getattr)
 {
  inode->i_op->getattr(d_entry, my_ia);
  printk("got inside\n");
 }
else printk("didn't get i_op OR getattr\n");
--------------

ciao,
- Zac


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.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