Results 1 to 2 of 2
Hello,
I've got a problem with getting the inode struct which is in file->dentry struct. One way to get the file struct is :
Code:
struct file *filep;
filep=filp_open(filename, 0, ...
- 08-18-2004 #1Just Joined!
- Join Date
- Aug 2004
- Posts
- 5
Kernel hacking - problem with getting the inode of file.
Hello,
I've got a problem with getting the inode struct which is in file->dentry struct. One way to get the file struct is :
and when i try to play with file with permission like /bin/su (includeing it)Code:struct file *filep; filep=filp_open(filename, 0, 0); if (IS_ERR(filep)) return -EIO;
-rws--x--x 1 root bin 35780 Jun 21 21:20 /bin/su*
the i got I/O error.
How to solve it? Maybe there is other way to get the inode struct in kernel when we know only the name of a file?
- 08-19-2004 #2Just Joined!
- Join Date
- Aug 2004
- Posts
- 5
Ok, i solved like (hope it ll be helpful for others)
Code:struct nameidata nd; int err=0; if (path_init([b]filename[/b], LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd)) err = path_walk(name, &nd); if (!err) printk(KERN_ALERT "Feel free to use nd.dentry->d_inode :)\n"); path_release(&nd);


Reply With Quote
