title: In Linux, how can I get the filename from the "struct file" structure, while stepping thru the kernel with kgdb?
body: <p>I'm trying to view the filename via kgdb, so I cannot call functions and macros to get it programatically.  I need to find it by manually inspecting data structures.</p>
  
  <p>Like if I had a breakpoint here in gdb, how could I look around with gdb and find the filename?</p>
  
  <p>I've tried looking around in <code>filp.f_path</code>, <code>filp.f_inode</code>, etc.  I cannot see the filename anywhere.</p>
  
  <pre class="lang-c prettyprint-override"><code>ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos)
  {
       struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = len };
       struct kiocb kiocb;
       ssize_t ret;
  
       init_sync_kiocb(&amp;kiocb, filp);
       kiocb.ki_pos = *ppos;
       kiocb.ki_left = len;
       kiocb.ki_nbytes = len;
  
       ret = filp-&gt;f_op-&gt;aio_write(&amp;kiocb, &amp;iov, 1, kiocb.ki_pos);
       if (-EIOCBQUEUED == ret)
               ret = wait_on_sync_kiocb(&amp;kiocb);
       *ppos = kiocb.ki_pos;
       return ret;
  }
  </code></pre>