title: Get file name/path from a file descriptor from a Linux kernel module?
body: <p>In a linux kernel module is there a way to get a file name/path from an <code>unsigned int fd</code>?</p>
  
  <p>I'm aware of this answer: <a href="https://stackoverflow.com/questions/8250078/how-can-i-get-a-filename-from-a-file-descriptor-inside-a-kernel-module">How can I get a filename from a file descriptor inside a kernel module?</a> but if I understand the code right, I need a <code>struct files_struct</code> too.</p>
  
  <p>EDIT:</p>
  
  <p>Please stop voting as duplicated as it isn't. I'm asking for a way to get file's name/path in plain C from a kernel module, not using system tools. 
  Said in another way: running readlink on /procself/fd/ is <em>not</em> a good answer.</p>
  
  <p>EDIT 2:</p>
  
  <p>Kernel's syscall read <code>ssize_t read(int fd, void *buf, size_t count);</code> takes 3 arguments, one of them being a fd. It's obvious that somehow <code>read</code> is able to read from a single file (instead of all files inside an inode). The question is how.</p>