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

Question on dentry structure



All:

I'm doing a bit of self-directed learning on various aspects of the kernel (2.2.16) and am currently attempting to understand the data structures associated with files open by a process.  So far I've been able to write a simple kernel module that will printk the names of all files a particular process has open.  These file names can be found by following a rather lengthy path from the process's task_struct and ending up in the dentry object for each of the file descriptors open by the process (i.e., if a process has 3 files open there will be 3 dentry objects - one for each file).  A field called d_name (qstr struct) in the dentry structure contains the name of the file itself.  However, it contains ONLY the file name and not the path to the file (e.g., it contains myfile.dat not /home/accounts/myfile.dat).  There are a couple of other dentry structs that MAY point to the directory files that make up the path to the file (there should be a separate dentry object for each of the directory files).  These structures are d_parent, d_child, or d_subdirs.  Does anyone out there know which of the above 3 dentry structures provides the path to the directory files that make up the path to the file pointed to by d_name?  Also - is there perhaps a kernel macro that will grab the path to the file when given perhaps a pointer to the file's dentry object?

Any info would be greatly appreciated!

Thanks in advance!!!!!!!!

Bob Dilworth
Toledo, Ohio
bdilworth@mco.edu

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.surriel.com/kernelnewbies.shtml