Remove unecessary #include "fsal_handle_syscalls.h"

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Pass BADHANDLE error all the way through

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Remove unecessary #include "fsal_handle_syscalls.h"

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
MORE Pass BADHANDLE error all the way through

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
Add fsal_filesystem object and supporting commonlib code

Several features of this code:

- Common code scan of /proc/mounts with getmntent which then stores the
  file systems in a database. Filesystems may be claimed by FSALs while
  creating exports. Sub-mounted filesystems are handled. The scan
  ignores filesystems on major device 0 (such as /proc) and any with
  a type matching "nfs.*"

- filesystems may be looked up by fsid or device

- A filesystem may only be exported via one fsal

- If libblkid and libuuid are available, the default fsid for a
  filesystem is the 128 bit uuid broken into 64 bit major and
  minor, otherwise the fsid from statfs is used.

- The fsid squashing algorithm from nfs3_FSALattr_To_PartialFattr
  is put in a routine squash_fsid.

- Filesystems may have their fsid type changed to one of the
  following formats:
  - one uint64_t (matches NFS v3 fsid, uses the same algorithm
    to compress the fsid that nfs3_FSALattr_To_PartialFattr used)
  - two uint32_t (xor the high order 32 bits with the low order
    32 bits)
  - device (use the device major.minor as the fsid major.minor)
  - two uint64_t (really no change)

- Additional filesystems may be added (just use re_index_fs_fsid
  and re_index_fs_dev to add them)

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
TEMP - MAY ABANDON - Handle EXDEV in cache_inode_readdir

The current implementation of this is to ignore the entry and not
have it present.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>
RFC - NEEDS A BIT OF WORK - Use fsal_filesystem in FSAL_VFS to implement multiple filesystems

This is a major change...

The VFS handle has been reformatted. Now Linux core VFS, FREEBSD, and
XFS each have their own handle format. The FREEBSD and XFS handles
already had an fsid in them. The format of the core Linux handle is:

/* Visual handle format
 *
 * 1 byte		handle_len (doesn't go on wire)
 * 1 byte		flags
 *				00xxxxxx fsid_type
 *				01000000 handle_type fits in one byte
 *				10000000 handle_type fits in two bytes
 *				11000000 handle_type fits in four bytes
 */
 /*
 * 0, 8, or 16 bytes	fsid type
 * 1,2 or 4 bytes 	handle type
 * 12 to 40 bytes	opaque kernel handle
 *
 * NOTE: if handle type doesn't fit in 2 bytes or less, 40 byte handles
 *	 (BTRFS and GPFS are known file systems that use 40 bytes) are
 *	 incompatible with 16 byte uuid form fsids.
 *	 If VMware clients are concerned, the limit is 8 bytes less...
 */

FREEBSD and XFS file systems will use the fsid from the handle as the
fsid, and thus will be re-indexed.

The FSAL configuration for an export may specify the filesystem type.
This really only applies to core Linux filesystems. The types are:

None
One64 (one uint64_t)
Two64 (two uint64_t)
uuid  (synonym for Two64)
Two32 (two uint32_t)
Dev (two uint32_t using the device major.minor)
Device (synonym for Dev)

An FSAL lookup that crosses a filesystem boundary will be properly
handled, with fsid changing and everything. This allows sub-mounted
fileysystems to work properly for both NFS v3 (at least with the Linux
client) and NFS v4 (with any client that crosses filesystem boundaries).

The fsid for the filesystem is used for fsid in getattrs.

Signed-off-by: Frank S. Filz <ffilzlnx@mindspring.com>