lkml.org 
[lkml]   [1997]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Pathname from inode?
Date
[much discussion of pathnames deleted]

Something I have wanted for a while is the basename of the inode in
the inode (perhaps conditionally compiled in for kernel debugging).
Then you can reconstruct a path to the inode. If there were hard links
involved then you aren't necessarily going to get the path you expect,
but you can get a path.

Looking at fs.h, it looks like what you want is a both a

#ifdef NAMEI
char i_basename[12]; /* basename of the last lookup */
u_long i_parent; /* inum of the parent */
#endif

The printing the path becomes a simple procedure of walking the list of
inodes and putting the path together.

It won't always work because the parent inode can be gone....

--lm

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.038 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site