[LWN Logo]
[Timeline]
#
# $Id: //depot/progeny/linux-now/nullfs/README#6 $
#

This is the start of a layered file system for Linux 2.4.  To build
it, change the "linux" variable at the top of the Makefile to point
to the Linux source tree, then type "make" to build a kernel module.
You may also build it to work with the user-mode Linux kernel.  See
the Makefile for instructions.

For now, you have to pass nullfs the name of the directory to mount
over using "-o", and give it the none device to mount.

   # mount -t nullfs -o /tmp none /mnt

(Eventually, all you'll have to do is "mount -t nullfs DIR" to layer
a file system over DIR, but I haven't figured out how to do that yet.)

This will mount the null file system over /tmp, making the layered file
system available at /mnt.  All operations on /mnt will be reflected in
/tmp, and debugging messages will be printed.

Here's a sample session:

   usermode:~# mount -t nullfs -o /tmp none /mnt
   usermode:~# cd /mnt
   usermode:/mnt# ls -la
   OPEN /
   READDIR / (pos=0)
   READDIR / (pos=1024)
   CLOSE /
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:50 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   usermode:/mnt# cat foo
   LOOKUP foo in /
   cat: foo: No such file or directory
   usermode:/mnt# touch foo
   CREATE foo in / (mode=100644)
   OPEN foo
   CLOSE foo
   usermode:/mnt# ls -la
   OPEN /
   READDIR / (pos=0)
   READDIR / (pos=1024)
   CLOSE /
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:53 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   -rw-r--r--    1 root     root            0 Sep  1 18:53 foo
   usermode:/mnt# ls -la /tmp
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:53 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   -rw-r--r--    1 root     root            0 Sep  1 18:53 foo
   usermode:/mnt# ln foo bar
   LOOKUP bar in /
   LINK bar in / to foo in /
   usermode:/mnt# ls -la
   OPEN /
   READDIR / (pos=0)
   READDIR / (pos=1024)
   CLOSE /
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:53 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   -rw-r--r--    2 root     root            0 Sep  1 18:53 bar
   -rw-r--r--    2 root     root            0 Sep  1 18:53 foo
   usermode:/mnt# ls -la /tmp
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:53 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   -rw-r--r--    2 root     root            0 Sep  1 18:53 bar
   -rw-r--r--    2 root     root            0 Sep  1 18:53 foo
   usermode:/mnt# cd /
   usermode:/# umount /mnt
   usermode:/# ls -la /mnt
   total 2
   drwxr-xr-x    2 root     root         1024 Mar  8 18:20 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   usermode:/# ls -la /tmp
   total 2
   drwxrwxrwt    2 root     root         1024 Sep  1 18:53 .
   drwxr-xr-x   19 root     root         1024 Mar  8 18:21 ..
   -rw-r--r--    2 root     root            0 Sep  1 18:53 bar
   -rw-r--r--    2 root     root            0 Sep  1 18:53 foo