			     INSTALLING FISTGEN

* Building fistgen

(1) unpack the package

(2) run "./configure"

You can force strict compilation of fistgen using, for example:
	CFLAGS="-Wall -Werror -O2 -g" ./configure

See "./configure --help" for more options.

Note we didn't test it with --srcdir=FOO different than the same build dir.

(3) run "make"

Ensure that you are using bison and flex.  Normally Yacc and Lex cannot
handle multiple parsers/tokenizers in the same source.  You should also use
gcc, because other vendor compilers do no support many of the GCC features I
use.

* Patching your kernel (Linux only)

If you're using Linux, at least for now, you have to patch your kernel.  See
the README file and the patches in the patches/ subdirectory for
information.

If you are using Solaris or FreeBSD, you do not need to patch your kernel.

* Generating file system sources from fistgen

Run "fistgen ARG", where ARG is the name of the .fist file that describes a
file system.  Fistgen will read in the templates from out/templates/OS-VER,
where OS-VER is the name of the operating system and the its version; for
example "Linux-2.3".  Then fistgen will generate output files in
out/OS-VER/FS, where FS is the name of the file system that you're trying to
generate.  Example:

$ ./fistgen tests/rot13fs.fist
NEW: out/Linux-2.3/rot13fs/fist_rot13fs.h
NEW: out/Linux-2.3/rot13fs/fist_rot13fs.c
NEW: out/Linux-2.3/rot13fs/dentry.c
NEW: out/Linux-2.3/rot13fs/fist_aux.c
NEW: out/Linux-2.3/rot13fs/fist_ioctl.c
NEW: out/Linux-2.3/rot13fs/ROT13FS-TODO
NEW: out/Linux-2.3/rot13fs/inode.c
NEW: out/Linux-2.3/rot13fs/doit.sh
NEW: out/Linux-2.3/rot13fs/main.c
NEW: out/Linux-2.3/rot13fs/subr.c
NEW: out/Linux-2.3/rot13fs/super.c
NEW: out/Linux-2.3/rot13fs/rot13fs.h
NEW: out/Linux-2.3/rot13fs/print.c
NEW: out/Linux-2.3/rot13fs/fist.h
NEW: out/Linux-2.3/rot13fs/vm_area.c
NEW: out/Linux-2.3/rot13fs/testit.sh
NEW: out/Linux-2.3/rot13fs/ChangeLog
NEW: out/Linux-2.3/rot13fs/mmap.c
NEW: out/Linux-2.3/rot13fs/undoit.sh
NEW: out/Linux-2.3/rot13fs/Makefile
NEW: out/Linux-2.3/rot13fs/file.c

$ cd out/Linux-2.3/rot13fs
$ make
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o fist_rot13fs.o fist_rot13fs.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o dentry.o dentry.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o file.o file.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o inode.o inode.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o main.o main.c
main.c:200: warning: `init_rot13fs_fs' defined but not used
main.c:205: warning: `exit_rot13fs_fs' defined but not used
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o mmap.o mmap.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o super.o super.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o vm_area.o vm_area.c
gcc -D__KERNEL__ -DMODULE -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall   -c -o print.o print.c
ld -o rot13fs.o -r fist_rot13fs.o dentry.o file.o inode.o main.o mmap.o super.o vm_area.o print.o
gcc -o fist_ioctl fist_ioctl.c -DFISTGEN -I. -I/home/ezk/proj/linux/BUILD-2.3/linux-beetle/include -g -O2 -Wall

Also, you can generate all file systems for all distributed FiST files using
"make genall".

* Loading kernel modules

I distribute two scripts:

(1) doit.sh: load a kernel module into the kernel, and mount it
(2) undoit.sh: unmount a file system, and unload the kernel module

Linux: see man pages for insmod, lsmod, rmmod, and mount.  See the
	distributed un/doit.sh script as to how to u/mount these file
	systems.

	To turn off debugging: fist_ioctl -d /mnt 0
	To turn on full debugging: fist_ioctl -d /mnt 18
	To turn on fast-appends (for SCA file systems such as gzipfs)
		fist_ioctl -f /mnt 1
	To turn off fast-appends:
		fist_ioctl -f /mnt 0

Solaris: see man pages for modload, modinfo, and modunload.  I generate a
	 special "fist_mount" program for mounting new file systems.  Use it
	 for example as: fist_mount rot13fs /n/fist/data /mnt
	 Solaris's /etc/mount program cannot mount arbitrary file systems.

	To turn off debugging: fist_ioctl /mnt 0
	To turn on full debugging: fist_ioctl /mnt 18
	To set an encryption key for cryptfs: fist_setkey /mnt
		and type your passphrase.

FreeBSD: see man pages for kldload, kldstat, and kldunload.  I generate a
	 special "mount_rot13fs" program for mounting new file systems.  Use
	 it for example as: mount_rot13fs -t rot13fs /n/fist/data /mnt
	 FreeBSD's /etc/mount program cannot mount arbitrary file systems.

After you've mounted the file system, you can go ahead and use it.
Stackable file systems can be mounted on top of other directories of already
mounted file systems, not on devices such as /dev/sd1c.  So make sure you
mount your FFS, UFS, EXT2FS, NFS, etc. file systems first, then stack the
new file system on top of them.  When done, unmount the file system, unload
the kernel module, and you can repeat this process all you want.

Happy stacking.

Erez Zadok.
