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: Quinn <email@hidden>
- Date: Fri, 14 Feb 2003 18:41:18 +0000
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)?
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.
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
2. using volfs to get the vnode from the CNID.
<
http://developer.apple.com/qa/qa2001/qa1113.html>
This second alternative is a significant binary compatibility
liability. It's *definitely* not appropriate to put it in a product
that you're going to ship to lots of users. OTOH, it's more
compatible than going poking around in v_data.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
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.