Replace libexecdir with datadir

According to the FHS.  Testing scripts and examples which are all
architecture independent should be installed in a subdirectory
under /usr/share.

  http://www.pathname.com/fhs/2.2/fhs-4.11.html

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Fix zfs_config.h install permissions

The default permissions used by install are 755.  Since this
file isn't executable 644 is more appropriate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Add KMODDIR to install target

Provide a mechanism to control the directory name the modules
are installed in.  The kernel privdes INSTALL_MOD_DIR for
this but it was hardcoded to be 'addon/zfs'.

Add a KMODDIR variable which can be passed to 'make install'
to override the default directory name.  While we're here
change the default from 'addon/zfs' to 'extra' which is the
kernel.org default.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Add --with-dracutdir configure option

The standard dracut directory has moved from /usr/share/dracut to
/usr/lib/dracut.  To ensure the dracut modules get installed in
the correct location provide a --with-dracutdir configure option
to set the path.

The default install location has been updated to /usr/lib/dracut
which is used by more current versions of Fedora.  However, this
default is overriden by the RPM packaging for consistency.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Remove ARCH packaging

The kernel modules are now available in the Arch User Repository
(AUR) via zfs.  Since their packaging is maintained and superior
to ours it is being removed from the tree.

  https://wiki.archlinux.org/index.php/ZFS

Now that various distributions are picking up the packages we
should eventually be able to remove most of this infrastructure.
Packaging belongs with the distributions not upstream.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Retire ZFS.RELEASE file

The ZFS.RELEASE file was originally added to document which
version of OpenSolaris the ZoL code was based on.  However,
that's no longer particularly important or useful.  We'll
likely never see a new onnv_* drop from Solaris, and even
if we do the ZoL changes are now extensive enough they
could not be easily applied.  We now treat Illumos as the
official upstream and cherry pick the patches we need.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Refresh links to web site

A few files still refer to @behlendorf's private fork on
github.  Use the primary web site URL instead.  Two typos
are also corrected.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Fix zdb.8 macro warning

Detected by rpmlint the 'rpool/export/home' section was being
interpretted by troff as an undefined macro.  This resulted
in the 'rpool/export/home' output being omitted from 'man zdb'.

This was caused by starting the line with a ' character.  By
moving the 'in' down to the next line we're able to fix it.

  zfs.x86_64: W: manual-page-warning /usr/share/man/man8/zdb.8.gz
  450: warning: macro `rpool/export/home'' not defined

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Merge branch 'build-system'
Linux 3.9 compat: Undefine GCC_VERSION

The mainline kernel started defining GCC_VERSION with commit
torvalds/linux@3f3f8d2f48acfd8ed3b8e6b7377935da57b27b16.
Unfortunately, LZ4 also defines this macro, but the two
defintions are incompatible. We undefine GCC_VERSION in lz4.c
to handle this.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1339
Import ztest.1 man page.

Create a nroff man page for ZoL from:

  http://grml.org/online-docs/ztest.1.html

Which itself was derived from:

  http://opensolaris.org/os/community/zfs/ztest/

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #518
Create mount.zfs, zinject, and zpios man pages.

And update the automake templates to install them.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #518
Remove COPYING

There's no reason to keep this file around it's redundant with
the COPYRIGHT and OPENSOLARIS.LICENSE files and causes lintian
to emit an extra-license-file warning.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Change zfs-kmod-devel install path

Install the common zfs kernel development headers under
/usr/src/zfs-<version>/ rather than in a kernel specific
directory.  The kernel specific build products such as
zfs_config.h and Modules.symvers are left installed under
/usr/src/zfs-<version>/<kernel>.

This was done to be consistent with where dkms expects
kernel module source to be packaged.  It also allows for
a common zfs-kmod-devel package which includes the headers,
and per-kernel zfs-kmod-devel-<kernel> packages.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Configure --with-spl{-obj} auto-detect cleanup

Because the install location for the spl/zfs-devel headers was
changed we need to refresh the auto-detect code.  Note that
for packaging which already explicitly calls --with-spl{-obj}
nothing has changed.

The updated code is now structured like that in ZFS_AC_KERNEL
and should be cleaner and easier to maintain.  In addition,
it's stricter about detecting a valid source and object
directory.  It requires:

* The source directory contains the file 'spl.release'
* The object directory contains the file 'spl_config.h'
* The following paths will be checked.  Notice the /var/lib/
  and /usr/src paths require that the spl and zfs version be
  matched.  This is done to prevent accidentally mixing releases.

        dnl # 1) /var/lib/dkms/spl/<version>/build
        dnl # 2) /usr/src/spl-<version>/<kernel-version>
        dnl # 3) /usr/src/spl-<version>
        dnl # 4) ../spl
        dnl # 5) /usr/src/kernels/<kernel-version>

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Refresh RPM packaging

Refresh the existing RPM packaging to conform to the 'Fedora
Packaging Guidelines'.  This includes adopting the kmods2
packaging standard which is used fod kmods distributed by
rpmfusion for Fedora/RHEL.

  http://fedoraproject.org/wiki/Packaging:Guidelines
  http://rpmfusion.org/Packaging/KernelModules/Kmods2

While the spec files have been entirely rewritten from a
user perspective the only major changes are:

* The Fedora packages now have a build dependency on the
  rpmfusion repositories.  The generic kmod packages also
  have a new dependency on kmodtool-1.22 but it is bundled
  with the source rpm so no additional packages are needed.

* The kernel binary module packages have been renamed from
  zfs-modules-* to kmod-zfs-* as specificed by kmods2.

* The is now a common kmod-zfs-devel-* package in addition
  to the per-kernel devel packages.  The common package
  contains the development headers while the per-kernel
  package contains kernel specific build products.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1341
Add metaslab_debug option

Enabling metaslab debugging will prevent space maps from being
automatically unloaded.  This can significantly increase the
memory footprint but being able to dynamically control this is
helpful for debugging and certain performance testing.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Add zio_ddt_free()+ddt_phys_decref() error handling

The assumption in zio_ddt_free() is that ddt_phys_select() must
always find a match.  However, if that fails due to a damaged
DDT or some other reason the code will NULL dereference in
ddt_phys_decref().

While this should never happen it has been observed on various
platforms.  The result is that unless your willing to patch the
ZFS code the pool is inaccessible.  Therefore, we're choosing
to more gracefully handle this case rather than leave it fatal.

http://mail.opensolaris.org/pipermail/zfs-discuss/2012-February/050972.html

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1308
Create fsck.zfs and zhack man pages.

The automake templates have been updated to install them,
and the existing packaging will automatically include them.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Supplements #518
Add spl-dkms dependency to zfs-dkms

Adding the 'spl-dkms = VERSION' dependency to the zfs-dkms
package ensures the spl will be installed before zfs.  This
cleanly handles the initial 'yum localinstall' case.

However, this does not address the dkms rebuilds caused by
a new kernel being installed.  For that we still rely on the
clunky  --with-spl-timeout=<timeout> configure option which
allows the zfs compilation to be briefly delayed while the
spl components are built.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>