Re: Finding one parent for a vnode born under X
Re: Finding one parent for a vnode born under X
- Subject: Re: Finding one parent for a vnode born under X
- From: Stéphane Sudre <email@hidden>
- Date: Mon, 17 Feb 2003 15:22:01 +0100
On Friday, February 14, 2003, at 08:35 PM, Umesh Vaishampayan wrote:
On Friday, February 14, 2003, at 10:41 AM, Quinn wrote:
At 12:15 +0100 14/2/03, Stiphane Sudre wrote:
Would there be a way to find 1 vnode parent of a vnode (on any FS)?
Not reliably. [In presence of hard links on files, *which* parent
would you like to know about?
One. I didn't really care about which one.
All of the following is based on my somewhat limited understanding of
VFS. Caveat emptor.
If the vnode references a directory, you can just VOP_LOOKUP "..".
This is, however, subject to vnode locking constraints.
Conceptually, yes. In practice, it's not that simple. Just doing a
VOP_LOOKUP() in a KEXT will give you a directory vnode, however you
will fail to detect escaping out of a chroot(2) [*security hole*]. And
you may fail to cross the mount points [which may or may not be what
you want].
For files, I don't think there's a file system independent way. For
Macintosh file systems (HFS, HFS Plus, AFP), you can probably doing
this by:
1. using VOP_GETATTRLIST with ATTR_CMN_PAROBJID to get the parent's
CNID and then
It has the same problem described above...
Well, I think I will give up the vnode parent solution and work
directly with the vnode and the VOP_GETATTRLIST command to get the info
I need then.
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.