public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Getting inode no from current process file descriptor table
@ 2005-01-03  5:37 selvakumar nagendran
  2005-01-03 16:10 ` Martin Waitz
  0 siblings, 1 reply; 2+ messages in thread
From: selvakumar nagendran @ 2005-01-03  5:37 UTC (permalink / raw)
  To: linux-kernel

Hello,
   How can we get the inode number for a file provided
we have the corresponding file descriptor. Can we use
files_struct -> fd[fd] to get struct file ?. From that
how can we get the corresponding inode number?

Regards,
selva


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - now with 250MB free storage. Learn more.
http://info.mail.yahoo.com/mail_250

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting inode no from current process file descriptor table
  2005-01-03  5:37 Getting inode no from current process file descriptor table selvakumar nagendran
@ 2005-01-03 16:10 ` Martin Waitz
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Waitz @ 2005-01-03 16:10 UTC (permalink / raw)
  To: selvakumar nagendran; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

hoi :)

On Sun, Jan 02, 2005 at 09:37:24PM -0800, selvakumar nagendran wrote:
>    How can we get the inode number for a file provided
> we have the corresponding file descriptor. Can we use
> files_struct -> fd[fd] to get struct file ?. From that
> how can we get the corresponding inode number?

#include <linux/dcache.h>
#include <linux/file.h>
#include <linux/fs.h>

struct file * file = fget(fd);
inode_number = file->f_dentry->d_inode->i_ino;
fput(file);

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-03 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-03  5:37 Getting inode no from current process file descriptor table selvakumar nagendran
2005-01-03 16:10 ` Martin Waitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox