Re: Classify VNODE SCOPE actions for file operations
Re: Classify VNODE SCOPE actions for file operations
- Subject: Re: Classify VNODE SCOPE actions for file operations
- From: Paul Nelson <email@hidden>
- Date: Thu, 07 Apr 2011 14:07:28 -0500
I think this discussion is probably moot anyway because even if you get a name, you can't depend on using it to find a vnode again (consider renaming, deleting, etc).
You could use it for logging purposes I suppose.
On Apr 7, 2011, at 1:01 PM, Ken Hornstein wrote:
> I don't think that's going to work in this case. As I understand it, the
> original poster asked about getting the filename at authorization (via
> kauth) time. Unfortunately, you're not given a target vnode to the kauth
> function because the vnode hasn't been created yet. What would be
> ideal would be for the desired filename to be passed down to the kauth
> routine, but that isn't done.
True for KAUTH_VNODE_ADD_FILE - you have different combos of vnodes depending on the real operation. The vfs may not be trying to create a file at all - see access1, rename.
For KAUTH_VNODE_READ_DATA you do have a vnode for the item.
>> It is not that hard to use getattrlist inside a kernel. This is the
>> best way to get the name of a vnode.
>> Just fill out the vnop_getattr_args and call VNOP_GETATTRLIST. For
>> example:
>> [...]
>
> You mean VNOP_GETATTR(), right? I will note that from what I can see,
Yep.
> only hfs actually returns va_name on MacOS X (okay, it's pretty likely
> you're going to be using hfs at least for local filesystems, but I guess
> my point is that it's not a guarantee that it will work).
>
> --Ken
I don't know about all filesystems, but HFS, Apple's SMB , Thursby's CIFS vfs return it.
NFS doesn't, but I would bet that AFP does. I know va_name is used by coreservicesd, and is how FSGetCatalogInfo calls get the name.
Paul Nelson
Thursby Software Systems, Inc.
_______________________________________________
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