your own filesystem

Matthew Dillon dillon at
Fri Sep 7 09:35:31 PDT 2012

:hi, all
:(thanx for the links to the books)
:i have added few handlers to 
:my_vnops.c file (that originally was null_vnops.c of "nullfs")
:and (with intention to involve my handlers into execution flow)
:i have extended struct vop_ops (last 4 lines):
:struct vop_ops my_vnode_vops = {
:	.vop_nresolve =		null_nresolve,
:	.vop_ncreate =		null_ncreate,
:	.vop_nmkdir =		null_nmkdir,
:	.vop_nmknod =		null_nmknod,
:	.vop_nlink =		null_nlink,
:	.vop_nsymlink =		null_nsymlink,
:	.vop_nwhiteout =	null_nwhiteout,
:	.vop_nremove =		null_nremove,
:	.vop_nrmdir =		null_nrmdir,
:	.vop_nrename =		null_nrename,
:	.vop_mountctl =		null_mountctl,
:        .vop_open =             my_open,
:        .vop_read =             my_read,
:        .vop_write =            my_write,
:        .vop_access =           my_access
:then i have noticed that my_*() handlers were never called no matter what operations i perform on my test subject.
:the question is:
:(1) What am i doing wrong?
:(2) Is there any official description what is a purpose of each handler in struct vop_ops and WHEN it shall be called?

    This won't work for a nullfs mount because the underyling vnodes are
    the vnodes for the underyling filesystem, NOT nullfs-specific vnodes.
    Thus those vnodes point to the underlying filesystem's ops and not
    nullfs's ops.

    If you want to try your hand at creating your own filesystem then I
    recommend starting with a self-contained memory filesystem like tmpfs.

					Matthew Dillon 
					<dillon at>

More information about the Users mailing list