Thanks Terry and Michael.
- Kernel programs should not perform file operations using vop_* functions/structures (which is not possible on 10.4 anyway).
- Kernel programs should perform file operations using the vnode_* functions (KPI) defined in sys/vnode.h
- vnop_* functions are to be implemented by Filesystems, and the vnode_* functions (KPI) in turn call these.
----- Original Message ----
From: Terry Lambert <email@hidden>
To: Ratheesh Ramachandran <email@hidden>
Cc: email@hidden
Sent:
Thursday, June 7, 2007 12:15:43 PM
Subject: Re: Newbie question - missing vop* structures/functions in sys/vnode.h on 10.4
Those are for you to write an FS that gets called, not for you to make
calls into an FS from kernel mode.
The vfs_context_t is a contet on which the call may block, without
fear of the credential reference inside it going away. It's
effectively a credential reference and unreference, only automatically
on your behalf, plus something that sits in the scheduler queue for
any sleep or mutex acquisitions to happen on (you MUST treat a
vfs_context_t as opaque!!!! This means you can't declare your own,
and it means that if you do, some operation on the stace or in the
name cache may take it as a promise that the data won't go out of
scope, so if it does, you've instantly introduced
a stack-smashing bug).
If you are trying to do file I/O in the kernel using direct vop calls
- don't! You're not going to get the VFS layer locking right.
If you are being called by someone in user space, and you are
legitimately consuming the VFS layer (e.g. you are a CODAFS
implementaiton or something similar), then you will have a context
because you will be the reference instance from a user space call into
you (and you should look at the NFS server source code in the kernel
for examples).
-- Terry
On Jun 6, 2007, at 9:34 PM, Ratheesh Ramachandran wrote:
> So, are the vop*s now to be replaced by vnop*s ? The vnop* functions
> seem to require an additional argument -- vfs_context_t.
>
> Is there a sample for the new usage available somewhere ?
>
> Thanks !
>
> ----- Original Message
----
> From: Terry Lambert <email@hidden>
> To: Ratheesh Ramachandran <email@hidden>
> Cc: email@hidden
> Sent: Thursday, June 7, 2007 9:22:39 AM
> Subject: Re: Newbie question - missing vop* structures/functions in
> sys/vnode.h on 10.4
>
> On Jun 6, 2007, at 11:59 AM, Ratheesh Ramachandran wrote:
> > Hi,
> >
> > I need to port some programs from an older version of Mac OS X to
> > 10.4.
> >
> > These programs use the "vop*" structures/functions from sys/vnode.h.
> > These are apparently no longer available in sys/vnode.h.
> >
> > Could anybody provide pointers/information on what has changed in
> > this area in 10.4 ?
>
> You need to include the kernel framework in your KEXT, and #include
> <sys/vnode_if.h>.
>
> See
/System/Library/Frameworks/Kernel.framework/Headers/sys/
> vnode_if.h.
>
> -- Terry
>
>
> Boardwalk for $500? In 2007? Ha!
> Play Monopoly Here and Now (it's updated for today's economy) at
> Yahoo! Games.