Re: Accessing the mode of a directory with its vnode and other questions
Re: Accessing the mode of a directory with its vnode and other questions
- Subject: Re: Accessing the mode of a directory with its vnode and other questions
- From: Rick Macklem <email@hidden>
- Date: Fri, 21 Mar 2008 19:27:18 -0400 (EDT)
On Fri, 21 Mar 2008, John D. wrote:
I would like to know how to access the mode of a file system object (in this
case, a directory) with only its vnode.
I don't have access out of the box to any vfs context nor extra data besides
the vnode alone.
I believe I can retrieve an usable vfs context using vfs_context_current(),
and then use vfs_getattr() but I can't figure out how exactly they should be
used. I tried looking for FreeBSD specific documentation and reading the
source a couple times, but looks like I might be missing some macro to
initialize the ctx or attr variables.
goes something like this... (untested, of course:-)
struct vnode_attr vattr;
VATTR_INIT(&vattr);
VATTR_WANTED(&vattr, va_mode);
err = vnode_getattr(vp, &vattr, vfs_context_current());
You'll find Darwin quite different than FreeBSD w.r.t. this. The doc is
use is the kernel sources (xnu-1228.tar.gz found under "Get the Source"
on http://developer.apple.com). Look in xnu-1228/bsd/nfs/nfs_serv.c for
an example.
Don't know the answer to the others, although you can probably figure
out what crypto functions are in the kernel by looking ay the above
sources. (If you use anything that isn't a kpi in your kext, you'll be
walking on thin ice like I do. I figure that's ok for an open source
project, but probably unwize for something that might be shipped to
customers. Others might elaborate on this.)
Good luck with it, rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden