Userland version of struct vnode ?

Maxime Henrion mux at FreeBSD.org
Tue Feb 14 18:54:00 PST 2006


Pranav Peshwe wrote:
> Hello,
>           Why is the 'Userland version' struct vnode created i.e struct
> xvnode (in vnode.h) ? The comment says that it is 'for sysctl'.There are
> also userland versions of struct file and struct tty.Can anybody please
> explain about their use ?

Those structures exist so that changing the size of the kernel struct
vnode has no impact for the userland tools.  If the sysctls were giving
a struct vnode instead of a struct xvnode, every change in the layout or
size of struct vnode would break the ABI and require a rebuild of all
the userland tools gathering vnodes from the sysctl.

It also allows the sysctl code to only give the meaningful fields back
to userland, reducing the amount of memory that needs to be copied.

Cheers,
Maxime


More information about the freebsd-hackers mailing list