Subject: Re: NetBSD+=TCFS, how to use generic FS layer system?
To: VaX#n8 <>
From: Bill Studenmund <>
List: tech-kern
Date: 05/25/2004 18:13:51
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 25, 2004 at 03:48:55PM -0400, VaX#n8 wrote:
> TCFS is the Transparent Crypting File System.  It is a file system layer
> that does encryption and sits above something like FFS.  It does not need
> any special support from the underlying layer except for some file system
> flags (see chflags).  For docs and more info, see:
> It is working pretty well but I'd like to make it even better by
> eliminating any redundant code (further suggestions appreciated).
> So to this end I'd like to know is how to use the layerfs code.
> I know how to put layer_bypass and other vnodeops into the table,
> but I'm a little confused when it comes to using a compatible
> mount and vnode structure.  I tried it without and it started generating
> all kinds of debugging information.  Can anyone help me understand
> what I need to do?

As nullfs/null.h and umap/umap.h indicate, you start your fs-specific node=
and mount structures with the layer structures. So struct tcfs_node needs=
to start with struct layer_args, and struct tcfs_mount starts with struct=
layer_mount. Then MOUNTTOLAYERMOUNT() and VTOLAYER() work right. Also,=20
your mount call arguements (struct tcfs_args) should start with=20

While the internal structure of struct tcfs_node matches layer_node,=20
neither tcfs_mount nor tcfs_args match. Among other things, you do not=20
allocate enough storage for the layer hash table pointer, so who knows=20
what happens as layer nodes get created and destroyed.

I'd suggest you just start the three structures with the layer ones. Even=
though tcfs_node is the same, by using lauer_node for those elements, you=
remove the potential for future issues. Like say if we ever change=20
layer_node, your code will pick up the change.

> I've basically integrated it into NetBSD-1.6.2, and you can see my work h=
> It can be compiled in statically or as a module.
> Currently you must get the userland from the TCFS package
> (however, its LKM should *not* be used as its DES implementation is broke=
> Since the package mount_tcfs gets installed in /usr/pkg/sbin and not /sbi=
> you can't "mount -t tcfs" yet, but you can call mount_tcfs directly.

Take care,


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.3 (NetBSD)