
The Amiga-FFS filesystem for Linux 0.99pl2
==========================================

** Why?

I needed a way to transfer 50+ megabytes of junk from my old Amiga
A2000 to my new 486 box.  I was also interested in learing a little
something about filesystems and Linux kernal stuff.  I had some
experience with writing code to deal with FFS (desperate attempts
to recover data from crashed filesystems :-).  So here it is.
I went a little further than I needed to, but not by much.

I am not a Linux filesystems expert.  In fact this is one of my first
Linux kernal hackings.  I know there are a some deficiencies in the
code, but there could be some real problems that I don't know
about.  Here's what I know:

* It is read only.

  I didn't need to write to the disk, so I didn't write code for it.
  As it is, it doesn't even know what a keymap is.

* Block size stuff is not consistent

  The filesystem block size is pretty much fixed at 512 bytes, but some
  parts of the code are set up to be flexible.  If anyone wanted to use
  this filesystem to run Linux executables, a size of 1024 would be
  better because bmap could be supported.  I don't know whether or not
  AmigaDOS can actually handle other sizes.

* Very few consistency checks

  It doesn't do block checksums, though it would be very easy.  The
  function for it is there.  I was not too concerned about it because
  I knew my filesystem was OK.

* No caching

  It reads file header blocks into memory every time a directory is read.
  It doesn't do anything special with extension blocks either; It has to
  read through the linked list of extension blocks every time it reads
  a file that has them.  This might make it crawl on systems that are
  low on buffer space.

* Filename case

  Not really a big deal.  There should be a mount option to make it
  case insensitive.

* Bash problems

  I don't know why, but Bash exposes a problem.  Typing `pwd' in a
  subdirectory of a filesystem causes an `Unknown error'.  Someone
  let me know if they find this `unknown' bug.


Making it Work
==============

The device I used this FS on was my harddrive from my Amiga.  It has
three partitions and uses the Amiga RDB standard.  I know that this FS
could be used to read other things (floppies, removable harddisks),
but I'll have to describe it in terms of the way I used it.

** Partitions

Linux, like me, doesn't understand RDBs.  This means that to use
Linux's partitions you need to use fdisk.  It will (as far as I know)
wipe out the first block or two of the device it is used on.  This is
probably where the RDB partition info is on an Amiga partitioned
device.  I think AmigaDOS scans the first few sectors for the RDB
info, so it could be possible to make a partitioned disk that both
AmigaDOS and Linux could read.

Another alternative would be to use the offset and size mount options
to get to the partition on the device.  With this method, only one
of the partition can be mounted at a time because Linux allows only
one filesystem to be mounted on a device at a time.

** Mounting

mount -t affs -o offset=N,size=S,root=R /dev/sdxx /mnt

/dev/sdxx is a block device (/dev/sdb) or a partition on one (/dev/sdb1).

N, S, and R are numeric arguments to the mount options.

If offset is given, it specifies a value to add to the key values in
the filesystem.  This is useful when using a disk device (like
/dev/sdb) instead of a partition.  It defaults to zero.

The size option is the number of blocks in the partition the
filesystem is on.  If it is not given, AFFS will try to find the size
of the partition.

The root option is the block number (without offset) of the root
block.  It shouldn't be needed unless the way I calculate its position
is wrong.


References
==========

For info about Amiga-FFS, I used _The AmigaDOS Manual_ (third edition)
from Bantam.  I think there are other documents about it that you can
get from Commodore.  Every thing I learned about the Linux FS stuff
came from looking at the isofs, msdos, and minix filesystem code.
I started with isofs because it was read-only.  I borrowed pieces
of msdos FS because it had a small block size also.


Future
======

In the future, I don't plan to go anywhere near an Amiga-FFS
filesystem unless I have to, so I can't really support this code.  You
can do what you like with it.  If someone wants to adopt it, that's
fine.

---------------------------------------------------------------------------
Ray Burr
ryb%hoggle@peora.sdc.ccur.com
