Re: mapping inode *-> filename

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 14, 2003 at 02:19:27AM -0500, Puja Gupta wrote:
> Hi,
>   I am writing a linux security module, using the LSM framework.  The LSM
> framework provides hooks into linux kernel.  I have to log access to certain
> set of files specified by the user.
>   The module I am writing receives some information like struct inode *,
> struct file *, struct dentry
> *dentry.  Not all these are availabe in all the functions that I am using.
> I have to map these pointers with a filename that exists in the filesystem.
>   I am not able to figure out how to map inode * / dentry * to a filename?
> Is there any function available in kernel that provides this?

Generaly, maping inode to filename is not unique, since inode (except
directory inodes) can have zero to many names. Each inode has a list of
dentries. These can be converted.

A dentry can be converted to a name by reverse-walking the tree. You
have a dentry, read it's name and follow the pointer to it's parent. You
should look how the symlinks /proc/<pid>/fs/* are generated (somewhere
in fs/proc/).

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux