In a linux kernel module, how can I get inode of a known path

inode, linux, linux-kernel

Solution

You don't have to open the file. There is a lookup function available in kernel which translates `char *name` to `struct nameidata`. Please refer to path_lookup.

You may also want to take a look at how path resolution algorithm works, here.

Problem

In a linux kernel module (i.e. working in kernel space), I have a path of a file. Which function(s) can be used to get the inode of that file. Specifically I need to get the "inode *" pointing to the file's inode.

Original source