Subject: Re: mandatory vnops and vfsops
To: Emmanuel Dreyfus <>
From: Bill Studenmund <>
List: tech-kern
Date: 05/13/2002 10:37:53
On Sun, 12 May 2002, Emmanuel Dreyfus wrote:

> When implementing a VFS, some vnode and VFS operations are mandatory
> (the system will panic if they are missing), other are optionnal. I
> don't find anywhere information about what is optionnal or not. Is this
> documented?

No, because you're supposed to implement them all. :-)

> For instance, if I ommit the vfs_init operation, this will cause a panic
> on startup. The machine can boot with all other VFS operation defined as
> NULL, but I need vfs_init.
> For vnode, things are more complicated. lease and reclaim seems to be
> must-have, I wonder about others.
> I explain a bit what I'm doing: To emulate an IRIX device, I need to
> provide special ioctl and poll vnode operations for the device. On
> device opening, I replace the default ffs vnode operation vector by my
> operation vector, which defines the operations I really need.

Why not make your own device? Why do you need to play with the vnode? Only
the file system is really supposed to play with its operation vector..

> The question is: what vnode operations do I really need?

Depends on what userland is doing with the device. :-)

> Other problem: in order to define a vnode vector, it seems I need to
> define a dummy VFS and register it at boot time with vfs_attach. This
> dummy fs will never be mounted, therefore I wonder if I need to
> implement more than just a vfs_init method (which is just void for now)?
> Or is it a way to make a usable vnode operation vector without going
> through vfs_attach?

Go though vfs_attach(). Every fs has an enumerated type, and yours should
be no different. Attach it, so the standard tools can make sense of what's
going on.

Take care,