Subject: Re: swapfs filesystem design (and mount/umount question)
To: Simon Burge <simonb@netbsd.org>
From: Assar Westerlund <assar@sics.se>
List: tech-kern
Date: 03/20/2000 06:48:15
Simon Burge <simonb@netbsd.org> writes:
> I've just now got a basic empty filesystem framework working (ie, no vops
> supported except for mount, umount and statfs, and mount doesn't do
> anything like creating a filesystem).  At the moment I can't unmount the
> filesystem:
> 
> 	wincen:vfs/miscfs/swapfs 1# modload obj.i386/swapfs.o 
> 	Module loaded as ID 0
> 	wincen:vfs/miscfs/swapfs 2# mount_swapfs -s 131072 swapfs /mnt
> 	wincen:vfs/miscfs/swapfs 3# df -i
> 	Filesystem  1K-blocks  Used  Avail Capacity iused   ifree  %iused  Mounted on
> 	...
> 	swapfs          65404     0  65404     0%       0  523232     0%   /mnt
> 	wincen:vfs/miscfs/swapfs 4# mount | grep swap
> 	swapfs on /mnt type swapfs (local)
> 	wincen:vfs/miscfs/swapfs 5# umount /mnt
> 	umount: /mnt: not currently mounted

I assume you have implemented vfs_root?

> Any suggestions on where to start looking for this one?

You might need to implement lookup().  In the dummy file-system I just
inspected, the following vnode operations are filled in.  I do think
that vop_lock is not actually needed on NetBSD.

static struct vnodeopv_entry_desc xfs_dead_vnodeop_entries[] = {
    {&vop_default_desc, (vop_t *) xfs_eopnotsupp},
    {&vop_lookup_desc,	(vop_t *) xfs_dead_lookup},
    {&vop_reclaim_desc, (vop_t *) xfs_returnzero},
    {&vop_lock_desc,	(vop_t *) xfs_dead_lock},
    {NULL, NULL}};

/assar