Messages in this thread | | | From | (Larry McVoy) | Subject | Re: Pathname from inode? | Date | Tue, 06 May 1997 15:49:01 -0700 |
| |
[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
| |