Skip to content
Permalink
Browse files

Add FreeBSD support to ZoL

- Refactor tree in to os specific parts
- Import FreeBSD SPL
- update tests to work on FreeBSD

Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
  • Loading branch information...
kmoore134 authored and mattmacy committed Jan 4, 2019
1 parent 02fad92 commit 8d19d94d4b73391c61989b72848576d84f25229a
Showing 722 changed files with 105,792 additions and 2,125 deletions.
@@ -63,3 +63,13 @@ cscope.*
*.log
venv

*.so
*.so.debug
*.so.full
*.tmp
*.log
module/export_syms
module/machine
module/x86
module/zfs.ko.debug
module/zfs.ko.full
@@ -19,7 +19,7 @@ notable exceptions and their respective licenses include:
* AES Implementation: module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
* AES Implementation: module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
* PBKDF2 Implementation: lib/libzfs/THIRDPARTYLICENSE.openssl
* SPL Implementation: module/spl/THIRDPARTYLICENSE.gplv2
* SPL Implementation: module/os/linux/spl/THIRDPARTYLICENSE.gplv2

This product includes software developed by the OpenSSL Project for use
in the OpenSSL Toolkit (http://www.openssl.org/)
@@ -4,19 +4,28 @@ include config/rpm.am
include config/deb.am
include config/tgz.am

SUBDIRS = include rpm
SUBDIRS = include
if BUILD_LINUX
SUBDIRS+= rpm
endif

if CONFIG_USER
SUBDIRS += udev etc man scripts lib tests cmd contrib
SUBDIRS += etc man scripts lib tests cmd contrib
if BUILD_LINUX
SUBDIRS+= udev
endif
endif
if CONFIG_KERNEL
SUBDIRS += module

extradir = $(prefix)/src/zfs-$(VERSION)
extra_HEADERS = zfs.release.in zfs_config.h.in

if BUILD_LINUX
kerneldir = $(prefix)/src/zfs-$(VERSION)/$(LINUX_VERSION)
nodist_kernel_HEADERS = zfs.release zfs_config.h module/$(LINUX_SYMBOLS)
endif
endif

AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = autogen.sh copy-builtin
@@ -25,11 +34,16 @@ EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
EXTRA_DIST += CODE_OF_CONDUCT.md

# Include all the extra licensing information for modules
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE module/icp/algs/skein/THIRDPARTYLICENSE.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
EXTRA_DIST += module/spl/THIRDPARTYLICENSE.gplv2 module/spl/THIRDPARTYLICENSE.gplv2.descrip
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash module/zfs/THIRDPARTYLICENSE.cityhash.descrip
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE
EXTRA_DIST += module/icp/algs/skein/THIRDPARTYLICENSE.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.gladman.descrip
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl
EXTRA_DIST += module/icp/asm-x86_64/aes/THIRDPARTYLICENSE.openssl.descrip
EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2
EXTRA_DIST += module/os/linux/spl/THIRDPARTYLICENSE.gplv2.descrip
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash
EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip

@CODE_COVERAGE_RULES@

@@ -39,7 +53,7 @@ gitrev:

BUILT_SOURCES = gitrev

distclean-local::
distclean-local:
-$(RM) -R autom4te*.cache
-find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-o -name .pc -o -name .hg -o -name .git \) -prune -o \
@@ -57,9 +71,10 @@ all-local:

dist-hook: gitrev
cp ${top_srcdir}/include/zfs_gitrev.h $(distdir)/include; \
sed -i 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
sed -i.bak -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \
$(distdir)/META

if BUILD_LINUX
# For compatibility, create a matching spl-x.y.z directly which contains
# symlinks to the updated header and object file locations. These
# compatibility links will be removed in the next major release.
@@ -76,6 +91,7 @@ install-data-hook:
ln -fs zfs_config.h spl_config.h && \
ln -fs zfs.release spl.release
endif
endif

codecheck: cstyle shellcheck flake8 mancheck testscheck vcscheck

@@ -88,15 +104,18 @@ commitcheck:

cstyle:
@find ${top_srcdir} -name '*.[hc]' ! -name 'zfs_config.*' \
! -name '*.mod.c' -type f \
! -name '*.mod.c' ! -name '*_if.h' ! -path "*/os/freebsd/*" \
-type f \
-exec ${top_srcdir}/scripts/cstyle.pl -cpP {} \+

filter_executable = -exec test -x '{}' \; -print

shellcheck:
@if type shellcheck > /dev/null 2>&1; then \
shellcheck --exclude=SC1090 --format=gcc \
shellcheck --exclude=SC1090 --exclude=SC1117 --format=gcc \
$$(find ${top_srcdir}/scripts/*.sh -type f) \
$$(find ${top_srcdir}/cmd/zed/zed.d/*.sh -type f) \
$$(find ${top_srcdir}/cmd/zpool/zpool.d/* -executable); \
$$(find ${top_srcdir}/cmd/zpool/zpool.d/* -type f ${filter_executable}); \
else \
echo "skipping shellcheck because shellcheck is not installed"; \
fi
@@ -111,13 +130,19 @@ mancheck:
echo "skipping mancheck because mandoc is not installed"; \
fi

if BUILD_LINUX
stat_fmt = -c '%A %n'
else
stat_fmt = -f '%Sp %N'
endif

testscheck:
@find ${top_srcdir}/tests/zfs-tests -type f \
\( -name '*.ksh' -not -executable \) -o \
\( -name '*.kshlib' -executable \) -o \
\( -name '*.shlib' -executable \) -o \
\( -name '*.cfg' -executable \) | \
xargs -r stat -c '%A %n' | \
\( -name '*.ksh' -not ${filter_executable} \) -o \
\( -name '*.kshlib' ${filter_executable} \) -o \
\( -name '*.shlib' ${filter_executable} \) -o \
\( -name '*.cfg' ${filter_executable} \) | \
xargs -r stat ${stat_fmt} | \
awk '{c++; print} END {if(c>0) exit 1}'

vcscheck:
@@ -1,31 +1,28 @@
![img](http://zfsonlinux.org/images/zfs-linux.png)
![img](https://github.com/zfsonfreebsd/ZoF/raw/master/zof-logo.png)

ZFS on Linux is an advanced file system and volume manager which was originally
developed for Solaris and is now maintained by the OpenZFS community.
developed for Solaris and is now maintained by the OpenZFS community. ZoF is the work
to bring FreeBSD support into the ZoL repo.

[![codecov](https://codecov.io/gh/zfsonlinux/zfs/branch/master/graph/badge.svg)](https://codecov.io/gh/zfsonlinux/zfs)
[![coverity](https://scan.coverity.com/projects/1973/badge.svg)](https://scan.coverity.com/projects/zfsonlinux-zfs)

# Official Resources

* [Site](http://zfsonlinux.org)
* [Wiki](https://github.com/zfsonlinux/zfs/wiki)
* [Mailing lists](https://github.com/zfsonlinux/zfs/wiki/Mailing-Lists)
* [ZoF GitHub Site](https://zfsonfreebsd.github.io/ZoF/)
* [ZoL Site](http://zfsonlinux.org)
* [ZoL Wiki](https://github.com/zfsonlinux/zfs/wiki)
* [ZoL Mailing lists](https://github.com/zfsonlinux/zfs/wiki/Mailing-Lists)
* [OpenZFS site](http://open-zfs.org/)
* [HEAD Snapshots](http://pkg.trueos.org/iso/freebsd-pkgbase/)

# Installation

Full documentation for installing ZoL on your favorite Linux distribution can
be found at [our site](http://zfsonlinux.org/).
[FreeBSD HEAD Snapshot Images](http://pkg.trueos.org/iso/freebsd-pkgbase/) are available from the [TrueOS Project](https://www.trueos.org).

# Contribute & Develop
Legacy ZFS is disabled in the src build (While enabled for the boot-loader) and ZoF is included automatically via the ports system as sysutils/zol and sysutils/zol-kmod.

We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md).
# Issues

# Release
Issues can be reported via GitHub's [Issue Tracker](https://github.com/zfsonfreebsd/ZoF).

ZFS on Linux is released under a CDDL license.
For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197`

# Supported Kernels
* The `META` file contains the officially recognized supported kernel versions.
@@ -0,0 +1 @@
theme: jekyll-theme-slate
@@ -5,4 +5,6 @@ if USING_PYTHON
SUBDIRS += arcstat arc_summary dbufstat
endif

if BUILD_LINUX
SUBDIRS += mount_zfs zed zvol_id
endif
@@ -1,11 +1,17 @@
EXTRA_DIST = arc_summary2 arc_summary3

transform = $(program_transform_name)

if USING_PYTHON_2
dist_bin_SCRIPTS = arc_summary2
install-exec-hook:
mv $(DESTDIR)$(bindir)/arc_summary2 $(DESTDIR)$(bindir)/arc_summary
before=$$(echo arc_summary2 | sed '$(transform)'); \
after=$$(echo arc_summary | sed '$(transform)'); \
mv "$(DESTDIR)$(bindir)/$$before" "$(DESTDIR)$(bindir)/$$after"
else
dist_bin_SCRIPTS = arc_summary3
install-exec-hook:
mv $(DESTDIR)$(bindir)/arc_summary3 $(DESTDIR)$(bindir)/arc_summary
before=$$(echo arc_summary3 | sed '$(transform)'); \
after=$$(echo arc_summary | sed '$(transform)'); \
mv "$(DESTDIR)$(bindir)/$$before" "$(DESTDIR)$(bindir)/$$after"
endif
@@ -54,6 +54,10 @@ import errno
from subprocess import Popen, PIPE
from decimal import Decimal as D

#Requires py27-sysctl on FreeBSD
if sys.platform.startswith('freebsd'):
import sysctl

show_tunable_descriptions = False
alternate_tunable_layout = False

@@ -79,12 +83,18 @@ def get_Kstat():
def load_proc_kstats(fn, namespace):
"""Collect information on a specific subsystem of the ARC"""

kstats = [line.strip() for line in open(fn)]
del kstats[0:2]
for kstat in kstats:
kstat = kstat.strip()
name, _, value = kstat.split()
Kstat[namespace + name] = D(value)
if sys.platform.startswith('freebsd'):
kstats = sysctl.filter(namespace)
for kstat in kstats:
name, value = kstat.name, kstat.value
Kstat[name] = D(value)
else:
kstats = [line.strip() for line in open(fn)]
del kstats[0:2]
for kstat in kstats:
kstat = kstat.strip()
name, _, value = kstat.split()
Kstat[namespace + name] = D(value)

Kstat = {}
load_proc_kstats('/proc/spl/kstat/zfs/arcstats',
@@ -921,13 +931,16 @@ def _tunable_summary(Kstat):
global show_tunable_descriptions
global alternate_tunable_layout

names = os.listdir("/sys/module/zfs/parameters/")
if sys.platform.startswith('freebsd'):
ctls = sysctl.filter('vfs.zfs')
else:
names = os.listdir("/sys/module/zfs/parameters/")

values = {}
for name in names:
with open("/sys/module/zfs/parameters/" + name) as f:
value = f.read()
values[name] = value.strip()
values = {}
for name in names:
with open("/sys/module/zfs/parameters/" + name) as f:
value = f.read()
values[name] = value.strip()

descriptions = {}

@@ -966,22 +979,31 @@ def _tunable_summary(Kstat):
sys.stderr.write("Tunable descriptions will be disabled.\n")

sys.stdout.write("ZFS Tunables:\n")
names.sort()
if not sys.platform.startswith('freebsd'):
names.sort()

if alternate_tunable_layout:
fmt = "\t%s=%s\n"
else:
fmt = "\t%-50s%s\n"

for name in names:
if sys.platform.startswith('freebsd'):
for ctl in ctls:

if show_tunable_descriptions and ctl.name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[ctl.name])

sys.stdout.write(fmt % (ctl.name, ctl.value))
else:
for name in names:

if not name:
continue
if not name:
continue

if show_tunable_descriptions and name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[name])
if show_tunable_descriptions and name in descriptions:
sys.stdout.write("\t# %s\n" % descriptions[name])

sys.stdout.write(fmt % (name, values[name]))
sys.stdout.write(fmt % (name, values[name]))


unSub = [

0 comments on commit 8d19d94

Please sign in to comment.
You can’t perform that action at this time.