On 05/ 3/10 09:00 PM, Edward Ned Harvey wrote:
From: Jonathan Adams [mailto:jonathan.ad...@oracle.com]
As long as the object you're trying to reverse lookup happens to be a
directory (and you happen to have the ability to open an inode by its
inode
number) then you can recursively look at the '..' entry to reverse-
traverse
the tree, until you reach the root of the tree, and at that time,
you've
been able to perform a complete reverse lookup.

The same would be true for files, if the file inodes had any
reference to
their parent directory(ies).  But presently, file inodes have no
reference
to their parents.
The big problem is less the lack of reference (for example, ZFS
actually
keeps a (possibly stale) parent count in the znode), it's more that
since only one parent is tracked, if someone does:

        ln path/to/a new/path/b
        ln path/to/a new/path/c
        rm path/to/a new/path/c

There's no way to get new/path/b from the inode.
I am aware of "Links" counter, so you can know how many times the filesystem
(any entry in any directory) reference this file's inode number.  But I am
not aware of any reference, in file inodes, which is a pointer back to any
parent directory, similar to the '..' entry of directory inodes.

What you say above seems to indicate that file inodes do contain a reference
to their parent, but only one parent.

Do you know how to view that information?  I don't think it exists, and I
can't find any way to find it.


For directories, it isn't in the inode. Its in the actual directory structure itself, in the ".." reference. You have to open the directory (opendir()) to canonicalize a directory.

    - Garrett
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to