diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..04ebc204f6 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,4 @@ +Brian Behlendorf , +Herb Wartens , +Jim Garlick , +Ricardo M. Correia diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..8a74328d6c --- /dev/null +++ b/ChangeLog @@ -0,0 +1,114 @@ +2008-11-19 Brian Behlendorf + + * : Tag zfs-0.4.0 + + * : ZFS project migrated from Subversion which leveraged a + quilt based patch stack to Git and a TopGit managed patch + stack. The new method treats all patches as Git branches + which can be more easily shared for distributed development. + Consult the top level GIT file for detailed information on + how to properly develop for this package using Git+TopGit. + +2008-11-12 Brian Behlendorf + + * : Tag zfs-0.3.4 + + * zfs-07-create-dev-zfs.patch: + Ricardo M. Correia + - Make libzfs create /dev/zfs if it doesn't exist. + + * zfs-05-check-zvol-size.patch: + Ricardo M. Correia + - Properly check zvol size under Linux. + + * zfs-04-no-openat-fdopendir.patch: + Ricardo M. Correia + - Do not use openat() and fdopendir() since they are not available + on older systems. + + * zfs-03-fix-bio-sync.patch: + Ricardo M. Correia + - Fix memory corruption in RHEL4 due to synchronous IO becoming + asynchronous. + +2008-11-06 Brian Behlendorf + + * zfs-02-zpios-fix-stuck-thread-memleak.patch: + Ricardo M. Correia + - Fix stuck threads and memory leaks when errors occur while writing. + + * zfs-01-zpios-arg-corruption.patch: + Ricardo M. Correia + - Fix zpios cmd line argument corruption problem. + + * zfs-00-minor-fixes.patch: + Ricardo M. Correia + - Minor build system improvements + - Minor script improvements + - Create a full copy and not a link tree with quilt + - KPIOS_MAJOR changed from 231 to 232 + - BIO_RW_BARRIER flag removed from IO request + +2008-06-30 Brian Behlendorf + + * : Tag zfs-0.3.3 + + * : Minor script updates and tweaks to be compatible with + the latest version of the SPL. + +2008-06-13 Brian Behlendorf + + * vdev_disk.diff: Replace vdev_disk implementation which was + based on the kmalloc'ed logical address space with a version + which works with vmalloc'ed memory in the virtual address space. + This was done to support the new SPL slab implementation which + is based on virtual addresses to avoid the need for contigeously + allocated memory. + +2008-06-05 Brian Behlendorf + + * arc-vm-integration.diff: Reduce maximum default arc memory + usage to 1/4 of total system memory. Because all the bulk data + is still allocated on the slab memory fragmentation is a serious + concern. To address this in the short term we simply need to + leave lots of free memory. + + * fix-stack.diff: First step towards reducing stack usage so + we can run the full ZFS stack using a stock kernel. + +2008-06-04 Brian Behlendorf + + * : Tag zfs-0.3.2 + + * : Extensive improvements to the build system to detect kernel + API changes so we can flexibly build with a wider range of kernel + versions. The code has now been testing with the 2.6.18-32chaos + and 2.6.25.3-18.fc9 kernels, however we should also be compatible + with other kernels in the range of 2.6.18-2.6.25. The only + remaining issue preventing us from running with a stock + kernel is ZFS stack usage. + +2008-05-21 Brian Behlendorf + + * : Tag zfs-0.3.1 + + * : License headers including URCL added for release. + +2008-05-21 Brian Behlendorf + + * : Tag zfs-0.3.0 + + * configure.ac: Improved autotools support and configurable debug. + +2008-05-15 Brian Behlendorf + + * : Updating original ZFS sources to build 89 which + includes the new write throttling changes plus support + for using ZFS as your root device. Neither of which + will work exactly right without some more work but this + gets us much closers to the latest source. + + +2008-02-28 Brian Behlendorf + + * : First attempt based on SPL module and zfs-lustre sources diff --git a/GIT b/GIT new file mode 100644 index 0000000000..eea0b4e6a1 --- /dev/null +++ b/GIT @@ -0,0 +1,186 @@ +=========================== WHY USE GIT+TOPGIT? ========================== + +Three major concerns were on our mind when setting up this project. + + o First we needed to structure the project in such a way that it would be + easy to rebase all of our changes on the latest official ZFS release + from Sun. We absolutely need to be able to benefit from the upstream + improvements and not get locked in to an old version of the code base. + + o Secondly, we wanted to be able to easily manage our changes in terms + of a patch stack or graph. This allows us to easily isolate specific + changes and push them upstream for inclusion. It also allows us to + easily update or drop specific changes based on what occurs upstream. + + o Thirdly we needed our DVCS to be integrated with the management of this + patch stack or graph. We have tried other methods in the past such as + SVN+Quilt but have found managing the patch stack becomes cumbersome. + By using Git+TopGit to more tightly integrate our patches in to the repo + we expect several benefits. One of the most important will be the + ability to easily work on the patch's with a distributed development + team, additionally the repo can track patch history, and we can utilize + Git to merge patches and resolve conflicts. + +TopGit is designed to specifically address these concerns by providing +tools to simplify the handling of large numbers of interdependent topic +branches. When using a TopGit aware repo every topic branch represents +a 'patch' and that branch references its dependent branches. The union +of all these branches is your final source base. + +========================= SETTING UP GIT+TOPGIT ========================== + +First off you need to install a Git package on your system. For my +purposes I have been working on a RHEL5 system with git version 1.5.4.5 +installed and it has been working well. You will also need to go get +the latest version of TopGit which likely is not packaged nicely so you +will need to build it from source. You can use Git to clone TopGit +from the official site here and your all set: + + > git clone git://repo.or.cz/w/topgit.git + > make + > make install # Default installs to $(HOME) + +========================== TOPGIT AND ZFS ================================ + +One you have Git and TopGit installed you will want to clone a copy of +the Linux ZFS repo. While this project does not yet have a public home +it hopefully will some day. In the meanwhile if you have VPN access to +LLNL you can clone the latest official repo here. Cloning a TopGit +controlled repo is very similar to cloning a normal Git repo, but you +need to remember to use 'tg remote' to populate all topic branches. + + > git clone http://eris.llnl.gov/git/zfs.git zfs + > cd zfs + > tg remote --populate origin + +Now that you have the Linux ZFS repo the first thing you will probably +want to do is have a look at all the topic branches. TopGit provides +a summary command which shows all the branches and a brief summary for +each branch obtained from the .topmsg files. + + > tg summary + 0 feature-branch [PATCH] feature-branch + feature-commit-cb [PATCH] feature commit cb + feature-zap-cursor-to-key [PATCH] feature zap cursor to key + ... + +By convention all TopGit branches are usually prefixed with 't/', however +I have chosen not to do this for simplicity. A different convention I have +adopted is to tag the top most TopGit branch as 'top' for easy reference. +This provides a consistent label to be used when you need to reference the +branch which contains the union of all topic branches. + +One thing you may also notice about the 'tg summary' command is it does +not show the branches in dependent order. This is done because TopGit allows +each branch to express multiple dependencies as a DAC. Initially this seemed +like an added complication which I planned to avoid by just implementing a +stack using the graph. However, this ended up being problematic because +with a stack when a change was made to a branch near the base, it was a +very expensive operation to merge the change up to the top of the stack. +By defining the dependencies as a graph it is possible to keep the depth +much shallower thus minimizing the merging. It has also proved insightful +as to each patches actual dependencies. + +To see the dependencies you will need to use the --graphviz option and pipe +the result to dot for display. The following command works fairly well for +me. Longer term it would be nice to update this option to use a preferred +config options stored in the repo. + + > tg summary --graphviz | dot -Txlib -Nfontsize=8 + +========================= UPDATING A TOPIC BRANCH ======================== + +Updating a topic branch in TopGit is a pretty straight forward but there +are a few rules you need to be aware of. The basic process involves +checking out the relevant topic branch where the changes need to be made, +making the changes, committing the changes to the branch and then merging +those changes in to dependent branches. TopGit provides some tools to make +this pretty easy, although it may be a little sluggish depending on how many +dependent branches are impacted by the change. Here is an example: + + > git checkout modify-topic-branch # Checkout the proper branch + > ...update branch... # Update the branch + > git commit -a # Commit your changes + > git checkout top # Checkout the top branch + > tg update # Recursively merge in new branch + +Assuming you change does not introduce any conflicts your done. All branches +were dependent on your change will have had the changed merged in. If your +change introduced a conflict you will need to resolve the conflict and then +continue on with the update. + +========================== ADDING A TOPIC BRANCH ========================= + +Adding a topic branch in TopGit can be pretty straight forward. If your +adding a non-conflicting patch in parallel with other patches of the same +type, then things are pretty easy and TopGit does all the work. + + > git co existing-topic-branch # Checkout the branch to add after + > tg create new-topic-branch # Create a new topic branch + > ...update .topmsg... # Update the branch message + > ...create patch... # Update with your changes + > git commit -a # Commit your changes + > git co dependent-topic-branch # Checkout dependent branch + > tg depend add new-topic-branch # Update dependencies + > git checkout top # Checkout the top branch + > tg update # Recursively merge in new branch + +If you need to add your patch in series with another change things are +a little more complicated. In this case TopGit does not yet support removing +dependencies so you will need to do it by hand, as follows. + + > git co existing-topic-branch # Checkout the branch to add after + > tg create new-topic-branch # Create a new topic branch + > ...update .topmsg... # Update the branch message + > ...create patch... # Update with your changes + > git commit -a # Commit your changes + > git co dependent-topic-branch # Checkout dependent branch + > ...update .topdeps... # Manually update dependencies + > git commit -a # Commit your changes + > tg update # TopGit update + > git checkout top # Checkout the top branch + > tg update # Recursively merge in new branch + +Once your done, I find it is a good idea view the repo using the +'tg summary --graphviz' command and verify the updated dependency graph. + +========================= REMOVING A TOPIC BRANCH ======================== + +Removing a topic branch in TopGit is also currently not very easy. To remove +a dependent branch the basic process is to commit a patch which reverts all +changes on the branch. Then that reversion must be merged in to all dependent +branches, the dependencies manually updated and finally the branch removed. +If the branch is not empty you will not be able to remove it. + + > git co delete-topic-branch # Checkout the branch to delete + > tg patch | patch -R -p1 # Revert all branch changes + > git commit -a # Commit your changes + > git checkout top # Checkout the top branch + > tg update # Recursively merge revert + > git co dependent-topic-branch # Checkout dependent branch + > ...update .topdeps... # Manually update dependencies + > git commit -a # Commit your changes + > tg delete delete-topic-branch # Delete empty topic branch + +Once your done, I find it is a good idea view the repo using the +'tg summary --graphviz' command and verify the updated dependency graph. + +============================ TOPGIT TODO ================================= + +TopGit is still a young package which seems to be under active development +by its author. It provides the minimum set of commands needed but there +are clearly areas which simply have not yet been implemented. My short +list of features includes: + + o 'tg summary --deps', option to display a text version of the topic + branch dependency DAC. + + o 'tg depend list', list all topic branch dependencies. + + o 'tg depend delete', cleanly remove a topic branch dependency. + + o 'tg create', cleanly insert a topic branch in the middle + of the graph and properly take care updating all dependencies. + + o 'tg delete', cleanly delete a topic branch in the middle + of the graph and properly take care updating all dependencies. diff --git a/META b/META new file mode 100644 index 0000000000..d43327990b --- /dev/null +++ b/META @@ -0,0 +1,6 @@ +Meta: 1 +Name: zfs +Branch: 1.0 +Version: 0.4.0 +Release: 1 +Release-Tags: relext diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..39f3fd0848 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,25 @@ +AUTOMAKE_OPTIONS = foreign dist-zip + +SUBDIRS = doc scripts $(BUILDDIR) +CONFIG_CLEAN_FILES = aclocal.m4 config.guess config.sub +CONFIG_CLEAN_FILES += depcomp missing mkinstalldirs +EXTRA_DIST = autogen.sh + +.PHONY: quilt +quilt: .quilt-$(BUILDDIR) +autogen: .autogen-$(BUILDDIR) +config: .config-$(BUILDDIR) +.quilt-$(BUILDDIR): + ./scripts/quilt.sh -p $(NAME) -b $(BUILDDIR) -s $(SERIESFILE) -d $(PATCHDIR) + echo $(BUILDDIR) >$@ + +unquilt: + rm -rf $(BUILDDIR) + rm -f .quilt-$(BUILDDIR) + +clean-generic: + +distclean: unquilt + +rpms: dist Makefile + rpmbuild -ta $(distdir).tar.gz diff --git a/README b/README new file mode 100644 index 0000000000..b25659dd4e --- /dev/null +++ b/README @@ -0,0 +1,74 @@ +============================ ZFS KERNEL BUILD ============================ + +1) Build the SPL (Solaris Porting Layer) module which is designed to + provide many Solaris APIs in the Linux kernel which are needed + by ZFS. To build the SPL: + + tar -xzf spl-x.y.z.tgz + cd spl-x.y.z + ./configure --with-linux= + make + make check + +2) Build ZFS, this port is based on build 89 of ZFS from OpenSolaris. + You will need to have both the kernel and SPL source available. + To build ZFS for use as a Linux kernel module (default): + + tar -xzf zfs-x.y.z.tgz + cd zfs-x.y.z + ./configure --with-linux= \ + --with-spl= + make + make check + +========================= ZFS USER LIBRARY BUILD ========================= + +1) Build ZFS, this port is based on build 89 of ZFS from OpenSolaris. + To build ZFS as a userspace library: + + tar -xzf zfs-x.y.z.tgz + cd zfs-x.y.z + ./configure --zfsconfig=user + make + make check + +============================ ZFS LUSTRE BUILD ============================ + +1) Build the SPL (Solaris Porting Layer) module which is designed to + provide many Solaris APIs in the Linux kernel which are needed + by ZFS. To build the SPL: + + tar -xzf spl-x.y.z.tgz + cd spl-x.y.z + ./configure --with-linux= + make + make check + +2) Build ZFS, this port is based on build 89 of ZFS from OpenSolaris. + To build ZFS as a userspace library for use by a Lustre filesystem: + + tar -xzf zfs-x.y.z.tgz + cd zfs-x.y.z + ./configure --zfsconfig=lustre \ + --with-linux= \ + --with-spl= + make + make check + +3) Provided is an in-kernel test application called zpios which can be + used to simulate a Lustre IO load. It may be used as a stress test + or as a performance to measure your configuration. To simplify testing + there are scripts provided in the scripts/ directory. A single test + can be run as follows: + + WARNING: You MUST update DEVICES in the create-zpool.sh script + to reference the devices you wish to use. + + cd scripts + ./load-zfs.sh # Load the ZFS/SPL module stack + ./create-zpool.sh # Modify DEVICES to list your zpool devices + ./zpios.sh # Modify for your particular zpios test + ./unload-zfs.sh # Unload the ZFS/SPL module stack + +Enjoy, +Brian Behlendorf diff --git a/autogen.sh b/autogen.sh new file mode 100644 index 0000000000..72bba5b035 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +aclocal -I config && +libtoolize --automake --copy +autoheader && +automake --add-missing --include-deps 2>/dev/null +autoconf +rm -rf autom4te.cache aclocal.m4 diff --git a/build/Makefile b/build/Makefile new file mode 100644 index 0000000000..f84b8e9ccf --- /dev/null +++ b/build/Makefile @@ -0,0 +1 @@ +obj-m := conftest.o diff --git a/config/Makefile.am b/config/Makefile.am new file mode 100644 index 0000000000..d1fde7bb45 --- /dev/null +++ b/config/Makefile.am @@ -0,0 +1,3 @@ +EXTRA_DIST = zfs-build.m4 +EXTRA_DIST = kernel user lustre + diff --git a/config/kernel.m4 b/config/kernel.m4 new file mode 100644 index 0000000000..a146a5f088 --- /dev/null +++ b/config/kernel.m4 @@ -0,0 +1,62 @@ +dnl # +dnl # Default ZFS kernel configuration +dnl # +AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ + dnl # Kernel build make options + dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build + KERNELMAKE_PARAMS= + + dnl # Kernel build cpp flags + KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL " + KERNELCPPFLAGS="$KERNELCPPFLAGS -I$splsrc -I$splsrc/include -I$TOPDIR" + + dnl # Required for pread() functionality an other GNU goodness + HOSTCFLAGS="$HOSTCFLAGS -ggdb -O2 -std=c99 " + HOSTCFLAGS="$HOSTCFLAGS -D_GNU_SOURCE -D__EXTENSIONS__ " + + dnl # XXX: Quiet warnings not covered by the gcc-* patches + dnl # XXX: Remove once all the warnings are resolved + HOSTCFLAGS="$HOSTCFLAGS -Wno-switch -Wno-unused -Wno-missing-braces " + HOSTCFLAGS="$HOSTCFLAGS -Wno-parentheses " + HOSTCFLAGS="$HOSTCFLAGS -Wno-uninitialized -fno-strict-aliasing " + + dnl # Expected defines not covered by zfs_config.h or spl_config.h + HOSTCFLAGS="$HOSTCFLAGS -DHAVE_SPL -D_POSIX_PTHREAD_SEMANTICS " + HOSTCFLAGS="$HOSTCFLAGS -D_FILE_OFFSET_BITS=64 " + HOSTCFLAGS="$HOSTCFLAGS -D_LARGEFILE64_SOURCE -D_REENTRANT " + HOSTCFLAGS="$HOSTCFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\" " + + dnl # Expected default include path + HOSTCFLAGS="$HOSTCFLAGS -I$TOPDIR " + + if test "$kernelbuild" != "$kernelsrc"; then + KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild" + fi + + AC_SUBST(KERNELMAKE_PARAMS) + AC_SUBST(KERNELCPPFLAGS) + AC_SUBST(HOSTCFLAGS) + + dnl # XXX: I really, really hate this... but to ensure the kernel + dnl # build system compiles C files shared between a library and a + dnl # kernel module, we need to ensure each file has a unique make + dnl # target. To do that I'm creating symlinks for each shared + dnl # file at configure time. It may be possible something better + dnl # can be done in the Makefile but it will take some serious + dnl # investigation and I don't have the time now. + + echo "creating symlinks for additional kernel make targets" + ln -f -s $LIBDIR/libport/u8_textprep.c $LIBDIR/libport/ku8_textprep.c + ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/kavl.c + ln -f -s $LIBDIR/libavl/avl.c $LIBDIR/libavl/uavl.c + ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/knvpair.c + ln -f -s $LIBDIR/libnvpair/nvpair.c $LIBDIR/libnvpair/unvpair.c + ln -f -s $LIBDIR/libzcommon/zfs_deleg.c $LIBDIR/libzcommon/kzfs_deleg.c + ln -f -s $LIBDIR/libzcommon/zfs_prop.c $LIBDIR/libzcommon/kzfs_prop.c + ln -f -s $LIBDIR/libzcommon/zprop_common.c $LIBDIR/libzcommon/kzprop_common.c + ln -f -s $LIBDIR/libzcommon/compress.c $LIBDIR/libzcommon/kcompress.c + ln -f -s $LIBDIR/libzcommon/list.c $LIBDIR/libzcommon/klist.c + ln -f -s $LIBDIR/libzcommon/zfs_namecheck.c $LIBDIR/libzcommon/kzfs_namecheck.c + ln -f -s $LIBDIR/libzcommon/zfs_comutil.c $LIBDIR/libzcommon/kzfs_comutil.c + ln -f -s $LIBDIR/libzcommon/zpool_prop.c $LIBDIR/libzcommon/kzpool_prop.c +]) diff --git a/config/lustre.m4 b/config/lustre.m4 new file mode 100644 index 0000000000..eee871cf96 --- /dev/null +++ b/config/lustre.m4 @@ -0,0 +1,4 @@ +dnl # +dnl # Default ZFS lustre configuration +dnl # +AC_DEFUN([ZFS_AC_CONFIG_LUSTRE], []) diff --git a/config/user.m4 b/config/user.m4 new file mode 100644 index 0000000000..11187d422e --- /dev/null +++ b/config/user.m4 @@ -0,0 +1,4 @@ +dnl # +dnl # Default ZFS user configuration +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER], []) diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 new file mode 100644 index 0000000000..6df90696d3 --- /dev/null +++ b/config/zfs-build.m4 @@ -0,0 +1,387 @@ +AC_DEFUN([ZFS_AC_KERNEL], [ + ver=`uname -r` + + AC_ARG_WITH([linux], + AS_HELP_STRING([--with-linux=PATH], + [Path to kernel source]), + [kernelsrc="$withval"; kernelbuild="$withval"]) + + AC_ARG_WITH(linux-obj, + AS_HELP_STRING([--with-linux-obj=PATH], + [Path to kernel build objects]), + [kernelbuild="$withval"]) + + AC_MSG_CHECKING([kernel source directory]) + if test -z "$kernelsrc"; then + kernelbuild= + sourcelink=/lib/modules/${ver}/source + buildlink=/lib/modules/${ver}/build + + if test -e $sourcelink; then + kernelsrc=`(cd $sourcelink; /bin/pwd)` + fi + if test -e $buildlink; then + kernelbuild=`(cd $buildlink; /bin/pwd)` + fi + if test -z "$kernelsrc"; then + kernelsrc=$kernelbuild + fi + if test -z "$kernelsrc" -o -z "$kernelbuild"; then + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Please specify the location of the kernel source + *** with the '--with-linux=PATH' option]) + fi + fi + + AC_MSG_RESULT([$kernelsrc]) + AC_MSG_CHECKING([kernel build directory]) + AC_MSG_RESULT([$kernelbuild]) + + AC_MSG_CHECKING([kernel source version]) + if test -r $kernelbuild/include/linux/version.h && + fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then + + kernsrcver=`(echo "#include "; + echo "kernsrcver=UTS_RELEASE") | + cpp -I $kernelbuild/include | + grep "^kernsrcver=" | cut -d \" -f 2` + + elif test -r $kernelbuild/include/linux/utsrelease.h && + fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then + + kernsrcver=`(echo "#include "; + echo "kernsrcver=UTS_RELEASE") | + cpp -I $kernelbuild/include | + grep "^kernsrcver=" | cut -d \" -f 2` + fi + + if test -z "$kernsrcver"; then + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Cannot determine the version of the linux kernel source. + *** Please prepare the kernel before running this script]) + fi + + AC_MSG_RESULT([$kernsrcver]) + + kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver + LINUX=${kernelsrc} + LINUX_OBJ=${kernelbuild} + + AC_SUBST(LINUX) + AC_SUBST(LINUX_OBJ) + AC_SUBST(kmoduledir) +]) + +AC_DEFUN([ZFS_AC_SPL], [ + + AC_ARG_WITH([spl], + AS_HELP_STRING([--with-spl=PATH], + [Path to spl source]), + [splsrc="$withval"; splbuild="$withval"]) + + AC_ARG_WITH([spl-obj], + AS_HELP_STRING([--with-spl-obj=PATH], + [Path to spl build objects]), + [splbuild="$withval"]) + + + AC_MSG_CHECKING([spl source directory]) + if test -z "$splsrc"; then + splbuild= + sourcelink=/tmp/`whoami`/spl + buildlink=/tmp/`whoami`/spl + + if test -e $sourcelink; then + splsrc=`(cd $sourcelink; /bin/pwd)` + fi + if test -e $buildlink; then + splbuild=`(cd $buildlink; /bin/pwd)` + fi + if test -z "$splsrc"; then + splsrc=$splbuild + fi + fi + + if test -z "$splsrc" -o -z "$splbuild"; then + sourcelink=/lib/modules/${ver}/source + buildlink=/lib/modules/${ver}/build + + if test -e $sourcelink; then + splsrc=`(cd $sourcelink; /bin/pwd)` + fi + if test -e $buildlink; then + splbuild=`(cd $buildlink; /bin/pwd)` + fi + if test -z "$splsrc"; then + splsrc=$splbuild + fi + if test -z "$splsrc" -o -z "$splbuild"; then + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Please specify the location of the spl source + *** with the '--with-spl=PATH' option]) + fi + fi + + AC_MSG_RESULT([$splsrc]) + AC_MSG_CHECKING([spl build directory]) + AC_MSG_RESULT([$splbuild]) + + AC_MSG_CHECKING([spl source version]) + if test -r $splbuild/spl_config.h && + fgrep -q VERSION $splbuild/spl_config.h; then + + splsrcver=`(echo "#include "; + echo "splsrcver=VERSION") | + cpp -I $splbuild | + grep "^splsrcver=" | cut -d \" -f 2` + fi + + if test -z "$splsrcver"; then + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Cannot determine the version of the spl source. + *** Please prepare the spl source before running this script]) + fi + + AC_MSG_RESULT([$splsrcver]) + + AC_MSG_CHECKING([spl Module.symvers]) + if test -r $splbuild/modules/Module.symvers; then + splsymvers=$splbuild/modules/Module.symvers + elif test -r $kernelbuild/Module.symvers; then + splsymvers=$kernelbuild/Module.symvers + fi + + if test -z "$splsymvers"; then + AC_MSG_RESULT([Not found]) + AC_MSG_ERROR([ + *** Cannot find extra Module.symvers in the spl source. + *** Please prepare the spl source before running this script]) + fi + + AC_MSG_RESULT([$splsymvers]) + AC_SUBST(splsrc) + AC_SUBST(splsymvers) +]) + +AC_DEFUN([ZFS_AC_LICENSE], [ + AC_MSG_CHECKING([license]) + AC_MSG_RESULT([CDDL]) +dnl # AC_DEFINE([HAVE_GPL_ONLY_SYMBOLS], [1], +dnl # [Define to 1 if module is licensed under the GPL]) +]) + +AC_DEFUN([ZFS_AC_DEBUG], [ + AC_MSG_CHECKING([whether debugging is enabled]) + AC_ARG_ENABLE( [debug], + AS_HELP_STRING([--enable-debug], + [Enable generic debug support (default off)]), + [ case "$enableval" in + yes) zfs_ac_debug=yes ;; + no) zfs_ac_debug=no ;; + *) AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; + esac ] + ) + if test "$zfs_ac_debug" = yes; then + AC_MSG_RESULT([yes]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG " + HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG " + else + AC_MSG_RESULT([no]) + AC_DEFINE([NDEBUG], [1], + [Define to 1 to disable debug tracing]) + KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG " + HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG " + fi +]) + +AC_DEFUN([ZFS_AC_CONFIG_SCRIPT], [ + SCRIPT_CONFIG=.script-config + rm -f ${SCRIPT_CONFIG} + echo "KERNELSRC=${LINUX}" >>${SCRIPT_CONFIG} + echo "KERNELBUILD=${LINUX_OBJ}" >>${SCRIPT_CONFIG} + echo "KERNELSRCVER=$kernsrcver" >>${SCRIPT_CONFIG} + echo >>${SCRIPT_CONFIG} + echo "SPLSRC=$splsrc" >>${SCRIPT_CONFIG} + echo "SPLBUILD=$splbuild" >>${SCRIPT_CONFIG} + echo "SPLSRCVER=$splsrcver" >>${SCRIPT_CONFIG} + echo "SPLSYMVERS=$splsymvers" >>${SCRIPT_CONFIG} + echo >>${SCRIPT_CONFIG} + echo "ZFSSRC=${TOPDIR}/src" >>${SCRIPT_CONFIG} + echo "ZFSBUILD=${ZFSDIR}" >>${SCRIPT_CONFIG} + echo >>${SCRIPT_CONFIG} + echo "TOPDIR=${TOPDIR}" >>${SCRIPT_CONFIG} + echo "LIBDIR=${LIBDIR}" >>${SCRIPT_CONFIG} + echo "CMDDIR=${CMDDIR}" >>${SCRIPT_CONFIG} +]) + +AC_DEFUN([ZFS_AC_CONFIG], [ + + TOPDIR=`/bin/pwd` + BUILDDIR=$ZFS_META_NAME #+$zfsconfig + ZFSDIR=$TOPDIR/$BUILDDIR + LIBDIR=$ZFSDIR/lib + CMDDIR=$ZFSDIR/zcmd + UNAME=`uname -r | cut -d- -f1` + + AC_SUBST(UNAME) + AC_SUBST(TOPDIR) + AC_SUBST(BUILDDIR) + AC_SUBST(ZFSDIR) + AC_SUBST(LIBDIR) + AC_SUBST(CMDDIR) + AC_SUBST(UNAME) + + AC_ARG_WITH([zfs-config], + AS_HELP_STRING([--with-config=CONFIG], + [Config file 'kernel|user|lustre']), + [zfsconfig="$withval"]) + + AC_MSG_CHECKING([zfs config]) + AC_MSG_RESULT([$zfsconfig]); + + case "$zfsconfig" in + kernel) ZFS_AC_CONFIG_KERNEL ;; + user) ZFS_AC_CONFIG_USER ;; + lustre) ZFS_AC_CONFIG_LUSTRE ;; + *) + AC_MSG_RESULT([Error!]) + AC_MSG_ERROR([Bad value "$zfsconfig" for --with-config, + user kernel|user|lustre]) ;; + esac + + ZFS_AC_CONFIG_SCRIPT +]) + +dnl # +dnl # ZFS_LINUX_CONFTEST +dnl # +AC_DEFUN([ZFS_LINUX_CONFTEST], [ +cat >conftest.c <<_ACEOF +$1 +_ACEOF +]) + +dnl # +dnl # ZFS_LANG_PROGRAM(C)([PROLOGUE], [BODY]) +dnl # +m4_define([ZFS_LANG_PROGRAM], [ +$1 +int +main (void) +{ +dnl Do *not* indent the following line: there may be CPP directives. +dnl Don't move the `;' right after for the same reason. +$2 + ; + return 0; +} +]) + +dnl # +dnl # ZFS_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE +dnl # +AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ +m4_ifvaln([$1], [ZFS_LINUX_CONFTEST([$1])])dnl +rm -f build/conftest.o build/conftest.mod.c build/conftest.ko build/Makefile +echo "obj-m := conftest.o" >build/Makefile +dnl AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], +AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" LINUXINCLUDE="-Iinclude -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])], + [$4], + [_AC_MSG_LOG_CONFTEST +m4_ifvaln([$5],[$5])dnl])dnl +rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl +]) + +dnl # +dnl # ZFS_LINUX_TRY_COMPILE like AC_TRY_COMPILE +dnl # +AC_DEFUN([ZFS_LINUX_TRY_COMPILE], + [ZFS_LINUX_COMPILE_IFELSE( + [AC_LANG_SOURCE([ZFS_LANG_PROGRAM([[$1]], [[$2]])])], + [modules], + [test -s build/conftest.o], + [$3], [$4]) +]) + +dnl # +dnl # ZFS_LINUX_CONFIG +dnl # +AC_DEFUN([ZFS_LINUX_CONFIG], + [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) + ZFS_LINUX_TRY_COMPILE([ + #ifndef AUTOCONF_INCLUDED + #include + #endif + ],[ + #ifndef CONFIG_$1 + #error CONFIG_$1 not #defined + #endif + ],[ + AC_MSG_RESULT([yes]) + $2 + ],[ + AC_MSG_RESULT([no]) + $3 + ]) +]) + +dnl # +dnl # ZFS_CHECK_SYMBOL_EXPORT +dnl # check symbol exported or not +dnl # +AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], + [AC_MSG_CHECKING([whether symbol $1 is exported]) + grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/Module.symvers 2>/dev/null + rc=$? + if test $rc -ne 0; then + export=0 + for file in $2; do + grep -q -E "EXPORT_SYMBOL.*($1)" "$LINUX/$file" 2>/dev/null + rc=$? + if test $rc -eq 0; then + export=1 + break; + fi + done + if test $export -eq 0; then + AC_MSG_RESULT([no]) + $4 + else + AC_MSG_RESULT([yes]) + $3 + fi + else + AC_MSG_RESULT([yes]) + $3 + fi +]) + +dnl # +dnl # 2.6.x API change +dnl # bio_end_io_t uses 2 args (size was dropped from prototype) +dnl # +AC_DEFUN([ZFS_AC_2ARGS_BIO_END_IO_T], + [AC_MSG_CHECKING([whether bio_end_io_t wants 2 args]) + tmp_flags="$EXTRA_KCFLAGS" + EXTRA_KCFLAGS="-Werror" + ZFS_LINUX_TRY_COMPILE([ + #include + ],[ + void (*wanted_end_io)(struct bio *, int) = NULL; + bio_end_io_t *local_end_io; + + local_end_io = wanted_end_io; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_2ARGS_BIO_END_IO_T, 1, + [bio_end_io_t wants 2 args]) + ],[ + AC_MSG_RESULT(no) + ]) + EXTRA_KCFLAGS="$tmp_flags" +]) diff --git a/config/zfs-meta.m4 b/config/zfs-meta.m4 new file mode 100644 index 0000000000..7ec44a3fc3 --- /dev/null +++ b/config/zfs-meta.m4 @@ -0,0 +1,112 @@ +dnl # +dnl # ZFS_AC_META +dnl # Read metadata from the META file. +dnl # +dnl # AUTHOR: +dnl # Chris Dunlap +dnl # +AC_DEFUN([ZFS_AC_META], [ + AC_MSG_CHECKING([metadata]) + + META="$srcdir/META" + _zfs_ac_meta_got_file=no + if test -f "$META"; then + _zfs_ac_meta_got_file=yes + + ZFS_META_NAME=_ZFS_AC_META_GETVAL([(?:NAME|PROJECT|PACKAGE)]); + if test -n "$ZFS_META_NAME"; then + AC_DEFINE_UNQUOTED([ZFS_META_NAME], ["$ZFS_META_NAME"], + [Define the project name.] + ) + AC_SUBST([ZFS_META_NAME]) + fi + + ZFS_META_VERSION=_ZFS_AC_META_GETVAL([VERSION]); + if test -n "$ZFS_META_VERSION"; then + AC_DEFINE_UNQUOTED([ZFS_META_VERSION], ["$ZFS_META_VERSION"], + [Define the project version.] + ) + AC_SUBST([ZFS_META_VERSION]) + fi + + ZFS_META_RELEASE=_ZFS_AC_META_GETVAL([RELEASE]); + if test -n "$ZFS_META_RELEASE"; then + AC_DEFINE_UNQUOTED([ZFS_META_RELEASE], ["$ZFS_META_RELEASE"], + [Define the project release.] + ) + AC_SUBST([ZFS_META_RELEASE]) + fi + + if test -n "$ZFS_META_NAME" -a -n "$ZFS_META_VERSION"; then + ZFS_META_ALIAS="$ZFS_META_NAME-$ZFS_META_VERSION" + test -n "$ZFS_META_RELEASE" && + ZFS_META_ALIAS="$ZFS_META_ALIAS-$ZFS_META_RELEASE" + AC_DEFINE_UNQUOTED([ZFS_META_ALIAS], + ["$ZFS_META_ALIAS"], + [Define the project alias string.] + ) + AC_SUBST([ZFS_META_ALIAS]) + fi + + ZFS_META_DATA=_ZFS_AC_META_GETVAL([DATE]); + if test -n "$ZFS_META_DATA"; then + AC_DEFINE_UNQUOTED([ZFS_META_DATA], ["$ZFS_META_DATA"], + [Define the project release date.] + ) + AC_SUBST([ZFS_META_DATA]) + fi + + ZFS_META_AUTHOR=_ZFS_AC_META_GETVAL([AUTHOR]); + if test -n "$ZFS_META_AUTHOR"; then + AC_DEFINE_UNQUOTED([ZFS_META_AUTHOR], ["$ZFS_META_AUTHOR"], + [Define the project author.] + ) + AC_SUBST([ZFS_META_AUTHOR]) + fi + + m4_pattern_allow([^LT_(CURRENT|REVISION|AGE)$]) + ZFS_META_LT_CURRENT=_ZFS_AC_META_GETVAL([LT_CURRENT]); + ZFS_META_LT_REVISION=_ZFS_AC_META_GETVAL([LT_REVISION]); + ZFS_META_LT_AGE=_ZFS_AC_META_GETVAL([LT_AGE]); + if test -n "$ZFS_META_LT_CURRENT" \ + -o -n "$ZFS_META_LT_REVISION" \ + -o -n "$ZFS_META_LT_AGE"; then + test -n "$ZFS_META_LT_CURRENT" || ZFS_META_LT_CURRENT="0" + test -n "$ZFS_META_LT_REVISION" || ZFS_META_LT_REVISION="0" + test -n "$ZFS_META_LT_AGE" || ZFS_META_LT_AGE="0" + AC_DEFINE_UNQUOTED([ZFS_META_LT_CURRENT], + ["$ZFS_META_LT_CURRENT"], + [Define the libtool library 'current' + version information.] + ) + AC_DEFINE_UNQUOTED([ZFS_META_LT_REVISION], + ["$ZFS_META_LT_REVISION"], + [Define the libtool library 'revision' + version information.] + ) + AC_DEFINE_UNQUOTED([ZFS_META_LT_AGE], ["$ZFS_META_LT_AGE"], + [Define the libtool library 'age' + version information.] + ) + AC_SUBST([ZFS_META_LT_CURRENT]) + AC_SUBST([ZFS_META_LT_REVISION]) + AC_SUBST([ZFS_META_LT_AGE]) + fi + fi + + AC_MSG_RESULT([$_zfs_ac_meta_got_file]) + ] +) + +AC_DEFUN([_ZFS_AC_META_GETVAL], + [`perl -n\ + -e "BEGIN { \\$key=shift @ARGV; }"\ + -e "next unless s/^\s*\\$key@<:@:=@:>@//i;"\ + -e "s/^((?:@<:@^'\"#@:>@*(?:(@<:@'\"@:>@)@<:@^\2@:>@*\2)*)*)#.*/\\@S|@1/;"\ + -e "s/^\s+//;"\ + -e "s/\s+$//;"\ + -e "s/^(@<:@'\"@:>@)(.*)\1/\\@S|@2/;"\ + -e "\\$val=\\$_;"\ + -e "END { print \\$val if defined \\$val; }"\ + '$1' $META`]dnl +) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000000..15db501914 --- /dev/null +++ b/configure.ac @@ -0,0 +1,141 @@ +# +# This file is part of the ZFS Linux port. +# +# Copyright (c) 2008 Lawrence Livermore National Security, LLC. +# Produced at Lawrence Livermore National Laboratory +# Written by: +# Brian Behlendorf , +# Herb Wartens , +# Jim Garlick +# LLNL-CODE-403049 +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License, Version 1.0 only +# (the "License"). You may not use this file except in compliance +# with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +AC_INIT +AC_LANG(C) +ZFS_AC_META +AC_CONFIG_AUX_DIR([config]) +AC_CANONICAL_SYSTEM +AM_INIT_AUTOMAKE([$ZFS_META_NAME], [$ZFS_META_VERSION]) +AC_CONFIG_HEADERS([zfs_config.h]) +AM_MAINTAINER_MODE + +AC_PROG_INSTALL +AC_PROG_CC +AC_PROG_LIBTOOL + +zfsconfig=kernel +kernelsrc= +kernelbuild= +splsrc= +splbuild= + +ZFS_AC_KERNEL +ZFS_AC_SPL +ZFS_AC_CONFIG +ZFS_AC_LICENSE +ZFS_AC_DEBUG +ZFS_AC_2ARGS_BIO_END_IO_T + +# Check for needed userspace bits +AC_CHECK_HEADERS(sys/types.h sys/byteorder.h sys/isa_defs.h \ + sys/systeminfo.h sys/u8_textprep.h libdiskmgt.h) + +AC_CHECK_FUNCS(strlcat strlcpy strnlen issetugid setmntent getexecname) + +AC_CHECK_LIB([diskmgt], [libdiskmgt_error], + [AC_DEFINE([HAVE_LIBDISKMGT], 1, + [Define to 1 if 'libdiskmgt' library available])]) + +AC_CHECK_LIB([efi], [efi_alloc_and_init], + [AC_DEFINE([HAVE_LIBEFI], 1, + [Define to 1 if 'libefi' library available])]) + +AC_CHECK_LIB([share], [sa_init], + [AC_DEFINE([HAVE_LIBSHARE], 1, + [Define to 1 if 'libshare' library available])]) + +AC_EGREP_HEADER(ioctl, unistd.h, + [AC_DEFINE([HAVE_IOCTL_IN_UNISTD_H], 1, + [Define to 1 if ioctl() is defined in header file])]) + +AC_EGREP_HEADER(ioctl, sys/ioctl.h, + [AC_DEFINE([HAVE_IOCTL_IN_SYS_IOCTL_H], 1, + [Define to 1 if ioctl() is defined in header file])]) + +AC_EGREP_HEADER(ioctl, stropts.h, + [AC_DEFINE([HAVE_IOCTL_IN_STROPTS_H], 1, + [Define to 1 if ioctl() is defined in header file])]) + +AC_EGREP_HEADER(strcmp, strings.h, + [AC_DEFINE([HAVE_STRCMP_IN_STRINGS_H], 1, + [Define to 1 if strcmpl() is defined in header file])]) + +AC_EGREP_HEADER(sysinfo, sys/systeminfo.h, + [AC_DEFINE([HAVE_SYSINFO_IN_SYS_SYSTEMINFO_H], 1, + [Define to 1 if sysinfo() is defined in header file])]) + +#AC_DEFINE([HAVE_ZVOL], 1, ["Define to 1 to include ZVOL support"]) +#AC_DEFINE([HAVE_ZPL], 1, ["Define to 1 to include ZPL support"]) +#AC_DEFINE([WANT_FAKE_IOCTL], 1, ["Define to 1 to use fake ioctl() support"]) +#AC_DEFINE([HAVE_DM_INUSE_SWAP], 1, ["None"]) +#AC_DEFINE([HAVE_UNICODE], 1, ["None"]) +#AC_DEFINE([HAVE_INTTYPES], 1, [Define to 1 if unint16 defined in header file]) + +AC_CONFIG_FILES([ Makefile + config/Makefile + doc/Makefile + scripts/Makefile + zfs/Makefile + zfs/lib/Makefile + zfs/lib/libnvpair/include/sys/Makefile + zfs/lib/libnvpair/include/Makefile + zfs/lib/libnvpair/Makefile + zfs/lib/libavl/include/sys/Makefile + zfs/lib/libavl/include/Makefile + zfs/lib/libavl/Makefile + zfs/lib/libuutil/include/Makefile + zfs/lib/libuutil/Makefile + zfs/lib/libzfs/include/Makefile + zfs/lib/libzfs/Makefile + zfs/lib/libumem/include/Makefile + zfs/lib/libumem/Makefile + zfs/lib/libumem/sys/Makefile + zfs/lib/libzcommon/include/Makefile + zfs/lib/libzcommon/include/sys/fm/fs/Makefile + zfs/lib/libzcommon/include/sys/fm/Makefile + zfs/lib/libzcommon/include/sys/Makefile + zfs/lib/libzcommon/include/sys/fs/Makefile + zfs/lib/libzcommon/Makefile + zfs/lib/libzpool/Makefile + zfs/lib/libspl/include/sys/Makefile + zfs/lib/libspl/include/Makefile + zfs/lib/libspl/Makefile + zfs/zcmd/ztest/Makefile + zfs/zcmd/Makefile + zfs/zcmd/zfs/Makefile + zfs/zcmd/zdb/Makefile + zfs/zcmd/zinject/Makefile + zfs/zcmd/zdump/Makefile + zfs/zcmd/zpool/Makefile + ]) +AC_OUTPUT diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000000..07f6386f45 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = LEGAL diff --git a/scripts/Makefile.am b/scripts/Makefile.am new file mode 100644 index 0000000000..e708530758 --- /dev/null +++ b/scripts/Makefile.am @@ -0,0 +1,8 @@ +EXTRA_DIST = check.sh create-zpool.sh load-zfs.sh unload-zfs.sh +EXTRA_DIST += profile-kpios-disk.sh profile-kpios-pids.sh +EXTRA_DIST += profile-kpios-post.sh profile-kpios-pre.sh profile-kpios.sh +EXTRA_DIST += survey.sh update-zfs.sh zpios-jbod.sh zpios.sh + +check: + ./check.sh + diff --git a/scripts/check.sh b/scripts/check.sh new file mode 100644 index 0000000000..bf93ee564e --- /dev/null +++ b/scripts/check.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +prog=check.sh + +die() { + echo "${prog}: $1" >&2 + exit 1 +} + +if [ $(id -u) != 0 ]; then + die "Must run as root" +fi + +./load-zfs.sh || die "" +./unload-zfs.sh || die "" + +exit 0 diff --git a/scripts/create-zpool.sh b/scripts/create-zpool.sh new file mode 100644 index 0000000000..197e1ef4cb --- /dev/null +++ b/scripts/create-zpool.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +prog=create-zpool.sh +. ../.script-config + +# Device list, e.g. +# +# Single device +#DEVICES="/dev/sda" +# +# All disks in a Sun Thumper/Thor +#DEVICES="/dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf \ +# /dev/sdg /dev/sdh /dev/sdi /dev/sdj /dev/sdk /dev/sdl \ +# /dev/sdm /dev/sdn /dev/sdo /dev/sdp /dev/sdq /dev/sdr \ +# /dev/sds /dev/sdt /dev/sdu /dev/sdv /dev/sdw /dev/sdx \ +# /dev/sdy /dev/sdz /dev/sdaa /dev/sdab /dev/sdac /dev/sdad \ +# /dev/sdae /dev/sdaf /dev/sdag /dev/sdah /dev/sdai /dev/sdaj \ +# /dev/sdak /dev/sdal /dev/sdam /dev/sdan /dev/sdao /dev/sdap \ +# /dev/sdaq /dev/sdar /dev/sdas /dev/sdat /dev/sdau /dev/sdav" +# +# Promise JBOD config +#DEVICES="/dev/sdb /dev/sdc /dev/sdd \ +# /dev/sde /dev/sdf /dev/sdg \ +# /dev/sdh /dev/sdi /dev/sdj \ +# /dev/sdk /dev/sdl /dev/sdm" +# +DEVICES="" + +echo +echo "zpool create lustre " +${CMDDIR}/zpool/zpool create -F lustre ${DEVICES} + +echo +echo "zpool list" +${CMDDIR}/zpool/zpool list + +echo +echo "zpool status lustre" +${CMDDIR}/zpool/zpool status lustre diff --git a/scripts/load-zfs.sh b/scripts/load-zfs.sh new file mode 100644 index 0000000000..6ba111b1d0 --- /dev/null +++ b/scripts/load-zfs.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +prog=load-zfs.sh +. ../.script-config + +spl_options=$1 +zpool_options=$2 + +spl_module=${SPLBUILD}/modules/spl/spl.ko +zlib_module=/lib/modules/${KERNELSRCVER}/kernel/lib/zlib_deflate/zlib_deflate.ko +zavl_module=${ZFSBUILD}/lib/libavl/zavl.ko +znvpair_module=${ZFSBUILD}/lib/libnvpair/znvpair.ko +zport_module=${ZFSBUILD}/lib/libport/zport.ko +zcommon_module=${ZFSBUILD}/lib/libzcommon/zcommon.ko +zpool_module=${ZFSBUILD}/lib/libzpool/zpool.ko +zctl_module=${ZFSBUILD}/lib/libdmu-ctl/zctl.ko +zpios_module=${ZFSBUILD}/lib/libzpios/zpios.ko + +die() { + echo "${prog}: $1" >&2 + exit 1 +} + +load_module() { + echo "Loading $1" + /sbin/insmod $* || die "Failed to load $1" +} + +if [ $(id -u) != 0 ]; then + die "Must run as root" +fi + +if /sbin/lsmod | egrep -q "^spl|^zavl|^znvpair|^zport|^zcommon|^zlib_deflate|^zpool"; then + die "Must start with modules unloaded" +fi + +if [ ! -f ${zavl_module} ] || + [ ! -f ${znvpair_module} ] || + [ ! -f ${zport_module} ] || + [ ! -f ${zcommon_module} ] || + [ ! -f ${zpool_module} ]; then + die "Source tree must be built, run 'make'" +fi + +load_module ${spl_module} ${spl_options} +load_module ${zlib_module} +load_module ${zavl_module} +load_module ${znvpair_module} +load_module ${zport_module} +load_module ${zcommon_module} +load_module ${zpool_module} ${zpool_options} +load_module ${zctl_module} +load_module ${zpios_module} + +sleep 1 +echo "Successfully loaded ZFS module stack" + +exit 0 diff --git a/scripts/unload-zfs.sh b/scripts/unload-zfs.sh new file mode 100644 index 0000000000..12e987bd3f --- /dev/null +++ b/scripts/unload-zfs.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +prog=unload-zfs.sh +. ../.script-config + +spl_module=${SPLBUILD}/modules/spl/spl.ko +zlib_module=/lib/modules/${KERNELSRCVER}/kernel/lib/zlib_deflate/zlib_deflate.ko +zavl_module=${ZFSBUILD}/lib/libavl/zavl.ko +znvpair_module=${ZFSBUILD}/lib/libnvpair/znvpair.ko +zport_module=${ZFSBUILD}/lib/libport/zport.ko +zcommon_module=${ZFSBUILD}/lib/libzcommon/zcommon.ko +zpool_module=${ZFSBUILD}/lib/libzpool/zpool.ko +zctl_module=${ZFSBUILD}/lib/libdmu-ctl/zctl.ko +zpios_module=${ZFSBUILD}/lib/libzpios/zpios.ko + +die() { + echo "${prog}: $1" >&2 + exit 1 +} + +unload_module() { + echo "Unloading $1" + /sbin/rmmod $1 || die "Failed to unload $1" +} + +if [ $(id -u) != 0 ]; then + die "Must run as root" +fi + +unload_module ${zpios_module} +unload_module ${zctl_module} +unload_module ${zpool_module} +unload_module ${zcommon_module} +unload_module ${zport_module} +unload_module ${znvpair_module} +unload_module ${zavl_module} +unload_module ${zlib_module} + +# Set DUMP=1 to generate debug logs on unload +if [ -n "${DUMP}" ]; then + sysctl -w kernel.spl.debug.dump=1 + # This is racy, I don't like it, but for a helper script it will do. + SPL_LOG=`dmesg | tail -n 1 | cut -f5 -d' '` + ${SPLBUILD}/cmd/spl ${SPL_LOG} >${SPL_LOG}.log + echo + echo "Dumped debug log: ${SPL_LOG}.log" + tail -n1 ${SPL_LOG}.log + echo +fi + +unload_module ${spl_module} + +echo "Successfully unloaded ZFS module stack" + +exit 0 diff --git a/zfs/Makefile.in b/zfs/Makefile.in new file mode 100644 index 0000000000..e0b30c8373 --- /dev/null +++ b/zfs/Makefile.in @@ -0,0 +1,16 @@ +subdir-m += lib +subdir-m += zcmd + +all: +# Make the exported SPL symbols available to this module. There +# is probably a better way to do this, but this will have to do +# for now... an option to modpost perhaps. + cp @splsymvers@ . + +# Kick off the kernel build system + $(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ modules + +install uninstall clean distclean maintainer-clean distdir: + $(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@ + +check: diff --git a/zfs/lib/Makefile.in b/zfs/lib/Makefile.in new file mode 100644 index 0000000000..8e328ca2df --- /dev/null +++ b/zfs/lib/Makefile.in @@ -0,0 +1,10 @@ +subdir-m += libuutil # User space util support +subdir-m += libumem # User space memory support +subdir-m += libzfs # User space library support +subdir-m += libspl # User space compatibility library + +subdir-m += libzpool # Kernel | User SPA/DMU/ZVOL/ZPL + +subdir-m += libavl # Kernel &| User space AVL tree support +subdir-m += libnvpair # Kernel &| User space name/value support +subdir-m += libzcommon # Kernel &| User space common support diff --git a/zfs/lib/libavl/Makefile.in b/zfs/lib/libavl/Makefile.in new file mode 100644 index 0000000000..6b9d4d5401 --- /dev/null +++ b/zfs/lib/libavl/Makefile.in @@ -0,0 +1,31 @@ +subdir-m += include +DISTFILES = avl.c + +MODULE := zavl +LIBRARY := libavl + +# Compile as kernel module. Needed symlinks created for all +# k* objects created by top level configure script. + +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -I@LIBDIR@/libavl/include + +obj-m := ${MODULE}.o + +${MODULE}-objs += kavl.o # Generic AVL support + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += uavl.o diff --git a/zfs/lib/libavl/include/Makefile.in b/zfs/lib/libavl/include/Makefile.in new file mode 100644 index 0000000000..6611e4143d --- /dev/null +++ b/zfs/lib/libavl/include/Makefile.in @@ -0,0 +1 @@ +subdir-m += sys diff --git a/zfs/lib/libavl/include/sys/Makefile.in b/zfs/lib/libavl/include/sys/Makefile.in new file mode 100644 index 0000000000..8149c3861f --- /dev/null +++ b/zfs/lib/libavl/include/sys/Makefile.in @@ -0,0 +1 @@ +DISTFILES = avl.h avl_impl.h diff --git a/zfs/lib/libnvpair/Makefile.in b/zfs/lib/libnvpair/Makefile.in new file mode 100644 index 0000000000..90599ca488 --- /dev/null +++ b/zfs/lib/libnvpair/Makefile.in @@ -0,0 +1,34 @@ +subdir-m += include +DISTFILES = libnvpair.c nvpair.c nvpair_alloc_fixed.c nvpair_alloc_system.c + +MODULE := znvpair +LIBRARY := libnvpair + +# Compile as kernel module. Needed symlinks created for all +# k* objects created by top level configure script. + +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -I@LIBDIR@/libnvpair/include + +obj-m := ${MODULE}.o + +${MODULE}-objs += knvpair.o # Interfaces name/value pairs +${MODULE}-objs += nvpair_alloc_spl.o # Generic alloc/free support + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += unvpair.o +${LIBRARY}-objs += nvpair_alloc_system.o +${LIBRARY}-objs += libnvpair.o diff --git a/zfs/lib/libnvpair/include/Makefile.in b/zfs/lib/libnvpair/include/Makefile.in new file mode 100644 index 0000000000..d92f7114c6 --- /dev/null +++ b/zfs/lib/libnvpair/include/Makefile.in @@ -0,0 +1,2 @@ +subdir-m += sys +DISTFILES = libnvpair.h diff --git a/zfs/lib/libnvpair/include/sys/Makefile.in b/zfs/lib/libnvpair/include/sys/Makefile.in new file mode 100644 index 0000000000..4f970cea58 --- /dev/null +++ b/zfs/lib/libnvpair/include/sys/Makefile.in @@ -0,0 +1 @@ +DISTFILES = nvpair.h nvpair_impl.h diff --git a/zfs/lib/libport/Makefile.in b/zfs/lib/libport/Makefile.in new file mode 100644 index 0000000000..85bdc959ae --- /dev/null +++ b/zfs/lib/libport/Makefile.in @@ -0,0 +1,37 @@ +subdir-m += include +DISTFILES = port.c strlcat.c strlcpy.c strnlen.c u8_textprep.c + +MODULE := zport +LIBRARY := libzport + +# Compile as kernel module. Needed symlinks created for all +# k* objects created by top level configure script. + +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -I@LIBDIR@/libzcommon/include +EXTRA_CFLAGS += -I@LIBDIR@/libport/include + +obj-m := ${MODULE}.o + +${MODULE}-objs += spl.o +${MODULE}-objs += ku8_textprep.o + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libport/include + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += strlcpy.o +${LIBRARY}-objs += strlcat.o +${LIBRARY}-objs += strnlen.o +${LIBRARY}-objs += port.o +${LIBRARY}-objs += u8_textprep.o + diff --git a/zfs/lib/libport/include/Makefile.in b/zfs/lib/libport/include/Makefile.in new file mode 100644 index 0000000000..e65438354c --- /dev/null +++ b/zfs/lib/libport/include/Makefile.in @@ -0,0 +1,4 @@ +subdir-m += sys + +DISTFILES = fake_ioctl.h libdiskmgt.h libshare.h mntent.h stdlib.h +DISTFILES += string.h strings.h stropts.h unistd.h diff --git a/zfs/lib/libport/include/sys/Makefile.in b/zfs/lib/libport/include/sys/Makefile.in new file mode 100644 index 0000000000..6472080e18 --- /dev/null +++ b/zfs/lib/libport/include/sys/Makefile.in @@ -0,0 +1,3 @@ +DISTFILES = byteorder.h debug.h efi_partition.h ioctl.h isa_defs.h +DISTFILES += policy.h socket.h swap.h systeminfo.h systm.h time.h +DISTFILES += types.h u8_textprep.h u8_textprep_data.h diff --git a/zfs/lib/libumem/Makefile.in b/zfs/lib/libumem/Makefile.in new file mode 100644 index 0000000000..008748e7cf --- /dev/null +++ b/zfs/lib/libumem/Makefile.in @@ -0,0 +1,40 @@ +subdir-m += include sys +DISTFILES = COPYING COPYRIGHT OPENSOLARIS.LICENSE README README-alpha TODO +DISTFILES += config.h envvar.c getpcstack.c init_lib.c misc.c misc.h +DISTFILES += sol_compat.h umem.c umem_agent_support.c umem_base.h +DISTFILES += umem_fail.c umem_fork.c umem_impl.h umem_update_thread.c +DISTFILES += vmem.c vmem_base.c vmem_base.h vmem_mmap.c vmem_sbrk.c +DISTFILES += vmem_stand.h + +LIBRARY := libumem + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libumem +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libumem/sys + +HOSTLDFLAGS += -pthread +HOSTLDFLAGS += -ldl + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += envvar.o +${LIBRARY}-objs += getpcstack.o +${LIBRARY}-objs += init_lib.o +${LIBRARY}-objs += misc.o +${LIBRARY}-objs += umem.o +${LIBRARY}-objs += umem_agent_support.o +${LIBRARY}-objs += umem_fail.o +${LIBRARY}-objs += umem_fork.o +${LIBRARY}-objs += umem_update_thread.o +${LIBRARY}-objs += vmem.o +${LIBRARY}-objs += vmem_base.o +${LIBRARY}-objs += vmem_mmap.o +${LIBRARY}-objs += vmem_sbrk.o diff --git a/zfs/lib/libumem/include/Makefile.in b/zfs/lib/libumem/include/Makefile.in new file mode 100644 index 0000000000..b16a5d217a --- /dev/null +++ b/zfs/lib/libumem/include/Makefile.in @@ -0,0 +1 @@ +DISTFILES = umem.h diff --git a/zfs/lib/libumem/sys/Makefile.in b/zfs/lib/libumem/sys/Makefile.in new file mode 100644 index 0000000000..eed2c31187 --- /dev/null +++ b/zfs/lib/libumem/sys/Makefile.in @@ -0,0 +1 @@ +DISTFILES = vmem.h vmem_impl_user.h diff --git a/zfs/lib/libuutil/Makefile.in b/zfs/lib/libuutil/Makefile.in new file mode 100644 index 0000000000..8931bd8500 --- /dev/null +++ b/zfs/lib/libuutil/Makefile.in @@ -0,0 +1,35 @@ +subdir-m += include +DISTFILES = Makefile.in *.c + +LIBRARY := libuutil + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -DNATIVE_BUILD + +HOSTLDFLAGS += -pthread +HOSTLDFLAGS += -lrt +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += uu_alloc.o +${LIBRARY}-objs += uu_avl.o +${LIBRARY}-objs += uu_dprintf.o +${LIBRARY}-objs += uu_ident.o +${LIBRARY}-objs += uu_list.o +${LIBRARY}-objs += uu_misc.o +${LIBRARY}-objs += uu_open.o +${LIBRARY}-objs += uu_pname.o +${LIBRARY}-objs += uu_strtoint.o diff --git a/zfs/lib/libuutil/include/Makefile.in b/zfs/lib/libuutil/include/Makefile.in new file mode 100644 index 0000000000..ff0ba14404 --- /dev/null +++ b/zfs/lib/libuutil/include/Makefile.in @@ -0,0 +1 @@ +DISTFILES = libuutil.h libuutil_common.h libuutil_impl.h diff --git a/zfs/lib/libzcommon/Makefile.in b/zfs/lib/libzcommon/Makefile.in new file mode 100644 index 0000000000..7a19291134 --- /dev/null +++ b/zfs/lib/libzcommon/Makefile.in @@ -0,0 +1,55 @@ +subdir-m += include +DISTFILES = compress.c list.c zfs_comutil.c zfs_deleg.c zfs_namecheck.c +DISTFILES += zfs_prop.c zpool_prop.c zprop_common.c + +MODULE := zcommon +LIBRARY := libzcommon + +# Compile as kernel module. Needed symlinks created for all +# k* objects created by top level configure script. + +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -I@LIBDIR@/libzcommon/include +EXTRA_CFLAGS += -I@LIBDIR@/libport/include +EXTRA_CFLAGS += -I@LIBDIR@/libavl/include +EXTRA_CFLAGS += -I@LIBDIR@/libnvpair/include + +obj-m := ${MODULE}.o + +${MODULE}-objs += spl.o +${MODULE}-objs += kzfs_deleg.o +${MODULE}-objs += kzfs_prop.o +${MODULE}-objs += kzprop_common.o +${MODULE}-objs += kcompress.o +${MODULE}-objs += klist.o +${MODULE}-objs += kzfs_namecheck.o +${MODULE}-objs += kzfs_comutil.o +${MODULE}-objs += kzpool_prop.o + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include + +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += zfs_deleg.o +${LIBRARY}-objs += zfs_prop.o +${LIBRARY}-objs += zprop_common.o +${LIBRARY}-objs += compress.o +${LIBRARY}-objs += list.o +${LIBRARY}-objs += zfs_namecheck.o +${LIBRARY}-objs += zfs_comutil.o +${LIBRARY}-objs += zpool_prop.o diff --git a/zfs/lib/libzcommon/include/Makefile.in b/zfs/lib/libzcommon/include/Makefile.in new file mode 100644 index 0000000000..69ab6afa2e --- /dev/null +++ b/zfs/lib/libzcommon/include/Makefile.in @@ -0,0 +1,2 @@ +subdir-m += sys +DISTFILES = zfs_comutil.h zfs_deleg.h zfs_namecheck.h zfs_prop.h diff --git a/zfs/lib/libzcommon/include/sys/Makefile.in b/zfs/lib/libzcommon/include/sys/Makefile.in new file mode 100644 index 0000000000..e73a05fcec --- /dev/null +++ b/zfs/lib/libzcommon/include/sys/Makefile.in @@ -0,0 +1,14 @@ +subdir-m += fm fs + +DISTFILES = arc.h bplist.h compress.h dbuf.h dmu.h dmu_impl.h +DISTFILES += dmu_objset.h dmu_traverse.h dmu_tx.h dmu_zfetch.h +DISTFILES += dnode.h dsl_dataset.h dsl_deleg.h dsl_dir.h dsl_pool.h +DISTFILES += dsl_prop.h dsl_synctask.h list.h list_impl.h metaslab.h +DISTFILES += metaslab_impl.h refcount.h rprwlock.h rrwlock.h spa.h +DISTFILES += spa_boot.h spa_impl.h space_map.h txg.h txg_impl.h uberblock.h +DISTFILES += uberblock_impl.h unique.h vdev.h vdev_disk.h vdev_file.h +DISTFILES += vdev_impl.h zap.h zap_impl.h zap_leaf.h zfs_acl.h +DISTFILES += zfs_context.h zfs_context_user.h zfs_ctldir.h zfs_debug.h +DISTFILES += zfs_dir.h zfs_fuid.h zfs_i18n.h zfs_ioctl.h zfs_rlock.h +DISTFILES += zfs_vfsops.h zfs_znode.h zil.h zil_impl.h zio.h +DISTFILES += zio_checksum.h zio_compress.h zio_impl.h zvol.h diff --git a/zfs/lib/libzcommon/include/sys/fm/Makefile.in b/zfs/lib/libzcommon/include/sys/fm/Makefile.in new file mode 100644 index 0000000000..0a4dc0223e --- /dev/null +++ b/zfs/lib/libzcommon/include/sys/fm/Makefile.in @@ -0,0 +1 @@ +subdir-m += fs diff --git a/zfs/lib/libzcommon/include/sys/fm/fs/Makefile.in b/zfs/lib/libzcommon/include/sys/fm/fs/Makefile.in new file mode 100644 index 0000000000..cbfbe3c671 --- /dev/null +++ b/zfs/lib/libzcommon/include/sys/fm/fs/Makefile.in @@ -0,0 +1 @@ +DISTFILES = zfs.h diff --git a/zfs/lib/libzcommon/include/sys/fs/Makefile.in b/zfs/lib/libzcommon/include/sys/fs/Makefile.in new file mode 100644 index 0000000000..cbfbe3c671 --- /dev/null +++ b/zfs/lib/libzcommon/include/sys/fs/Makefile.in @@ -0,0 +1 @@ +DISTFILES = zfs.h diff --git a/zfs/lib/libzfs/Makefile.in b/zfs/lib/libzfs/Makefile.in new file mode 100644 index 0000000000..4718bed00f --- /dev/null +++ b/zfs/lib/libzfs/Makefile.in @@ -0,0 +1,46 @@ +subdir-m += include +DISTFILES = libzfs_changelist.c libzfs_config.c libzfs_dataset.c +DISTFILES += libzfs_graph.c libzfs_import.c libzfs_mount.c libzfs_pool.c +DISTFILES += libzfs_sendrecv.c libzfs_status.c libzfs_util.c + +LIBRARY := libzfs + +# Compile as shared library. There's an extra useless host program +# here called 'zu' because it was the easiest way I could convince +# the kernel build system to construct a user space shared library. + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@LIBDIR@/libzfs/include +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libdmu-ctl/include +HOSTCFLAGS += -I@LIBDIR@/libzpool # For existing fletcher.c hack + +HOSTLDFLAGS += -ldl -lm +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon + +hostprogs-y := zu +always := $(hostprogs-y) + +zu-objs := zu.o ${LIBRARY}.so + +${LIBRARY}-objs += libzfs_dataset.o # Interface for manipulating datasets +${LIBRARY}-objs += libzfs_pool.o # Interface for manipulating pools +${LIBRARY}-objs += libzfs_changelist.o # Support for property changes +${LIBRARY}-objs += libzfs_config.o # Interface for manipulating configuration +${LIBRARY}-objs += libzfs_graph.o # Support for dependent list for datasets +${LIBRARY}-objs += libzfs_import.o # Discover and import pools +${LIBRARY}-objs += libzfs_mount.o # Mount, unmount, and share datasets +${LIBRARY}-objs += libzfs_status.o # Status +${LIBRARY}-objs += libzfs_util.o # Misc support +${LIBRARY}-objs += libzfs_sendrecv.o diff --git a/zfs/lib/libzfs/include/Makefile.in b/zfs/lib/libzfs/include/Makefile.in new file mode 100644 index 0000000000..23c0b471f1 --- /dev/null +++ b/zfs/lib/libzfs/include/Makefile.in @@ -0,0 +1 @@ +DISTFILES = libzfs.h libzfs_impl.h diff --git a/zfs/lib/libzpool/Makefile.in b/zfs/lib/libzpool/Makefile.in new file mode 100644 index 0000000000..440fd1cbca --- /dev/null +++ b/zfs/lib/libzpool/Makefile.in @@ -0,0 +1,102 @@ +# NOTE: kernel.c, taskq.c, util.c unused by kernel port. +# Potentially they should just be removed if we don't care +# able user space lustre intergration from this source base. + +DISTFILES = arc.c bplist.c dbuf.c dmu.c dmu_object.c dmu_objset.c +DISTFILES += dmu_traverse.c dmu_tx.c dmu_zfetch.c dnode.c dnode_sync.c +DISTFILES += dsl_dataset.c dsl_deleg.c dsl_dir.c dsl_pool.c dsl_prop.c +DISTFILES += dsl_synctask.c fletcher.c gzip.c kernel.c lzjb.c metaslab.c +DISTFILES += refcount.c sha256.c spa.c spa_boot.c spa_config.c spa_errlog.c +DISTFILES += spa_history.c spa_misc.c space_map.c taskq.c txg.c uberblock.c +DISTFILES += unique.c util.c vdev.c vdev_cache.c vdev_disk.c vdev_missing.c +DISTFILES += vdev_file.c vdev_label.c vdev_mirror.c vdev_queue.c vdev_raidz.c +DISTFILES += vdev_root.c zap.c zap_leaf.c zap_micro.c zfs_byteswap.c zfs_fm.c +DISTFILES += zfs_znode.c zil.c zio.c zio_checksum.c zio_compress.c zio_inject.c + +MODULE := zpool + +EXTRA_CFLAGS = @KERNELCPPFLAGS@ +EXTRA_CFLAGS += -I@LIBDIR@/libzcommon/include +EXTRA_CFLAGS += -I@LIBDIR@/libport/include +EXTRA_CFLAGS += -I@LIBDIR@/libavl/include +EXTRA_CFLAGS += -I@LIBDIR@/libnvpair/include + +obj-m := ${MODULE}.o + +# DMU (Data Management Unit) +${MODULE}-objs += dmu.o # Interfaces dmu core +${MODULE}-objs += dmu_objset.o # Interfaces dmu objset open/close/manipulate +${MODULE}-objs += dmu_object.o # Interfaces dmu alloc/free +${MODULE}-objs += txg.o # Transaction model control threads +${MODULE}-objs += dmu_tx.o # Interfaces dmu transaction create/manipulate +${MODULE}-objs += dnode.o # Open context object-level support +${MODULE}-objs += dnode_sync.o # Syncing context object-level support +${MODULE}-objs += dbuf.o # Buffer management support +${MODULE}-objs += dmu_zfetch.o # Data stream prefetch logic +${MODULE}-objs += refcount.o # Generic refcount support +#${MODULE}-objs += dmu_send.o # XXX missing: Snapshot send/received support + +# DSL (Dataset and Snapshot Layer) +${MODULE}-objs += dsl_dir.o # Namespace and management support +${MODULE}-objs += dsl_dataset.o # Interfaces snapshot/rollback/clone +${MODULE}-objs += dsl_pool.o # Pool-level support +${MODULE}-objs += dsl_prop.o # Property manipulation support +${MODULE}-objs += dsl_deleg.o # XXX: ? +${MODULE}-objs += dsl_synctask.o# XXX: ? +${MODULE}-objs += unique.o # Unique objset ID support + +# ZAP (ZFS Attribute Processor) +${MODULE}-objs += zap.o # Interfaces (fat) +${MODULE}-objs += zap_leaf.o # Low-level support +${MODULE}-objs += zap_micro.o # Interfaces (micro) + +# ZIL (ZFS Intent Log) +${MODULE}-objs += zil.o # Intent log + +# ARC (Adaptive Replacement Cache) +${MODULE}-objs += arc.o # Adaptive replacement cache + +# SPA (Storage Pool Allocator) +${MODULE}-objs += spa.o # Open/import/export/destroy support +${MODULE}-objs += spa_misc.o # Misc support (includes locking) +${MODULE}-objs += spa_config.o # Parse and update pool config data +${MODULE}-objs += spa_errlog.o # Log of persistent pool-wide data errors +${MODULE}-objs += spa_history.o # Command history support +${MODULE}-objs += spa_boot.o # Bootable root partitions +${MODULE}-objs += zfs_fm.o # Post reports of FMA consumption support + +# ZIO (ZFS I/O Pipeline) +${MODULE}-objs += zio.o # Interfaces zio core +${MODULE}-objs += zio_checksum.o# Generic checksum interface +${MODULE}-objs += fletcher.o # Fletcher 2 and 4 checksum algorithms +${MODULE}-objs += sha256.o # SHA256 checksum algorithms +${MODULE}-objs += zio_compress.o# Generic compression interface +${MODULE}-objs += lzjb.o # LZJB compression algorithm +${MODULE}-objs += gzip.o # GZIP compression algorithm +${MODULE}-objs += uberblock.o # Basic uberblock routines +${MODULE}-objs += bplist.o # Keeps track of list of block pointers +${MODULE}-objs += metaslab.o # Bulk of DVA translation +${MODULE}-objs += space_map.o # Keeps track of free space +${MODULE}-objs += zio_inject.o # Framework for persistent error injection + +# VDEV (Virtual Devices) +${MODULE}-objs += vdev.o # Interfaces vdev code +${MODULE}-objs += vdev_disk.o # Disk virtual device +${MODULE}-objs += vdev_file.o # File virtual device +${MODULE}-objs += vdev_mirror.o # N-Way mirroring +${MODULE}-objs += vdev_raidz.o # RAID-Z grouping +${MODULE}-objs += vdev_root.o # Top-level pseudo vdev +${MODULE}-objs += vdev_missing.o# Special device for import +${MODULE}-objs += vdev_label.o # Read/write indentifying label support +${MODULE}-objs += vdev_cache.o # Simple device-level caching for reads +${MODULE}-objs += vdev_queue.o # I/O scheduling algorithm for vdevs + +# ZPL (ZFS Posix Layer) +${MODULE}-objs += zfs_byteswap.o# Byteswap support for ZPL +${MODULE}-objs += zfs_znode.o # Vnode to znode mapping + +# Traversal +${MODULE}-objs += dmu_traverse.o# Traversal code + +# SPL (Solaris Porting Layer) +${MODULE}-objs += spl.o # Linux kernel glue and misc support diff --git a/zfs/zcmd/Makefile.in b/zfs/zcmd/Makefile.in new file mode 100644 index 0000000000..23720a5c77 --- /dev/null +++ b/zfs/zcmd/Makefile.in @@ -0,0 +1,6 @@ +subdir-m += zfs +subdir-m += zpool +#subdir-m += zdb +#subdir-m += ztest +#subdir-m += zdump +#subdir-m += zinject diff --git a/zfs/zcmd/zdb/Makefile.in b/zfs/zcmd/zdb/Makefile.in new file mode 100644 index 0000000000..119b29767e --- /dev/null +++ b/zfs/zcmd/zdb/Makefile.in @@ -0,0 +1,32 @@ +DISTFILES = Makefile.in zdb.c zdb_il.c + +CMD := zdb + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/zdb/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += zdb_il.o +${CMD}-objs += zdb.o # Core command diff --git a/zfs/zcmd/zdump/Makefile.in b/zfs/zcmd/zdump/Makefile.in new file mode 100644 index 0000000000..e9662462c7 --- /dev/null +++ b/zfs/zcmd/zdump/Makefile.in @@ -0,0 +1,31 @@ +DISTFILES = Makefile.in zdump.c + +CMD := zdump + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/zdump/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += zdump.o # Arg processing diff --git a/zfs/zcmd/zfs/Makefile.in b/zfs/zcmd/zfs/Makefile.in new file mode 100644 index 0000000000..2d07982fbf --- /dev/null +++ b/zfs/zcmd/zfs/Makefile.in @@ -0,0 +1,32 @@ +DISTFILES = Makefile.in zfs_iter.c zfs_main.c zfs_util.h zfs_iter.h + +CMD := zfs + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/zpool/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += zfs_main.o # Arg processing +${CMD}-objs += zfs_iter.o # Iterator support diff --git a/zfs/zcmd/zinject/Makefile.in b/zfs/zcmd/zinject/Makefile.in new file mode 100644 index 0000000000..6ff89ac01d --- /dev/null +++ b/zfs/zcmd/zinject/Makefile.in @@ -0,0 +1,32 @@ +DISTFILES = Makefile.in translate.c zinject.c zinject.h + +CMD := zinject + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/zinject/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += translate.o # Translation support +${CMD}-objs += zinject.o # Core command diff --git a/zfs/zcmd/zpool/Makefile.in b/zfs/zcmd/zpool/Makefile.in new file mode 100644 index 0000000000..c91593300c --- /dev/null +++ b/zfs/zcmd/zpool/Makefile.in @@ -0,0 +1,34 @@ +DISTFILES = Makefile.in zpool_main.c zpool_iter.c zpool_util.c zpool_vdev.c zpool_util.h + +CMD := zpool + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/zpool/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += zpool_main.o # Arg processing +${CMD}-objs += zpool_iter.o # Iterator support +${CMD}-objs += zpool_util.o # Misc support +${CMD}-objs += zpool_vdev.o # Converts vdevs to nvlists for libzfs diff --git a/zfs/zcmd/ztest/Makefile.in b/zfs/zcmd/ztest/Makefile.in new file mode 100644 index 0000000000..af0719f610 --- /dev/null +++ b/zfs/zcmd/ztest/Makefile.in @@ -0,0 +1,32 @@ +DISTFILES = Makefile.in ztest.c + +CMD := ztest + +HOSTCFLAGS += @HOSTCFLAGS@ +HOSTCFLAGS += -I@CMDDIR@/ztest/ +HOSTCFLAGS += -I@LIBDIR@/libsolcompat/include +HOSTCFLAGS += -I@LIBDIR@/libport/include +HOSTCFLAGS += -I@LIBDIR@/libavl/include +HOSTCFLAGS += -I@LIBDIR@/libnvpair/include +HOSTCFLAGS += -I@LIBDIR@/libumem/include +HOSTCFLAGS += -I@LIBDIR@/libuutil/include +HOSTCFLAGS += -I@LIBDIR@/libzcommon/include +HOSTCFLAGS += -I@LIBDIR@/libzfs/include + +HOSTLDFLAGS += -lavl -L@LIBDIR@/libavl +HOSTLDFLAGS += -lnvpair -L@LIBDIR@/libnvpair +HOSTLDFLAGS += -lumem -L@LIBDIR@/libumem +HOSTLDFLAGS += -luutil -L@LIBDIR@/libuutil +HOSTLDFLAGS += -lzport -L@LIBDIR@/libport +HOSTLDFLAGS += -lsolcompat -L@LIBDIR@/libsolcompat +HOSTLDFLAGS += -lzcommon -L@LIBDIR@/libzcommon +HOSTLDFLAGS += -lzfs -L@LIBDIR@/libzfs + +# Additional shared library paths for executing binaries in-tree +export LD_RUN_PATH = @LIBDIR@/libavl:@LIBDIR@/libnvpair:@LIBDIR@/libumem:@LIBDIR@/libuutil:@LIBDIR@/libport:@LIBDIR@/libsolcompat:@LIBDIR@/libzcommon:@LIBDIR@/libzfs + +hostprogs-y := ${CMD} +always := $(hostprogs-y) + +${CMD}-objs += ztest.o # Core command +