Skip to content

Commit

Permalink
fs: Import openzfs 2.1.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Scirese committed Jun 22, 2023
1 parent ff8e07d commit 8b315d0
Show file tree
Hide file tree
Showing 869 changed files with 496,377 additions and 0 deletions.
1 change: 1 addition & 0 deletions fs/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ config LEGACY_DIRECT_IO
bool

if BLOCK
source "fs/zfs/Kconfig"

source "fs/ext2/Kconfig"
source "fs/ext4/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ obj-y += buffer.o mpage.o
else
obj-y += no-block.o
endif
obj-$(CONFIG_ZFS) += zfs/

obj-$(CONFIG_PROC_FS) += proc_namespace.o

Expand Down
48 changes: 48 additions & 0 deletions fs/zfs/Kbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# When integrated in to a monolithic kernel the spl module must appear
# first. This ensures its module initialization function is run before
# any of the other module initialization functions which depend on it.
ZFS_MODULES += spl/
ZFS_MODULES += avl/
ZFS_MODULES += icp/
ZFS_MODULES += lua/
ZFS_MODULES += nvpair/
ZFS_MODULES += unicode/
ZFS_MODULES += zcommon/
ZFS_MODULES += zfs/
ZFS_MODULES += zstd/

# The rest is only relevant when run by kbuild
ifneq ($(KERNELRELEASE),)

obj-$(CONFIG_ZFS) := $(ZFS_MODULES)

ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
ZFS_MODULE_CFLAGS += -Wno-format-zero-length

ifneq ($(KBUILD_EXTMOD),)
zfs_include = /home/march7th/zfs-2.1.12/include
ZFS_MODULE_CFLAGS += -include /home/march7th/zfs-2.1.12/zfs_config.h
ZFS_MODULE_CFLAGS += -I/home/march7th/zfs-2.1.12/include
else
zfs_include = $(srctree)/include/zfs
ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h
endif

ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/kernel
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/spl
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/zfs
ZFS_MODULE_CFLAGS += -I$(zfs_include)
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += -UDEBUG -DNDEBUG

ifneq ($(KBUILD_EXTMOD),)
#ZFS_MODULE_CFLAGS += -I/include
#KBUILD_EXTRA_SYMBOLS +=
endif

subdir-asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
subdir-ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)


endif
48 changes: 48 additions & 0 deletions fs/zfs/Kbuild.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# When integrated in to a monolithic kernel the spl module must appear
# first. This ensures its module initialization function is run before
# any of the other module initialization functions which depend on it.
ZFS_MODULES += spl/
ZFS_MODULES += avl/
ZFS_MODULES += icp/
ZFS_MODULES += lua/
ZFS_MODULES += nvpair/
ZFS_MODULES += unicode/
ZFS_MODULES += zcommon/
ZFS_MODULES += zfs/
ZFS_MODULES += zstd/

# The rest is only relevant when run by kbuild
ifneq ($(KERNELRELEASE),)

obj-$(CONFIG_ZFS) := $(ZFS_MODULES)

ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @NO_FORMAT_ZERO_LENGTH@

ifneq ($(KBUILD_EXTMOD),)
zfs_include = @abs_top_srcdir@/include
ZFS_MODULE_CFLAGS += -include @abs_top_builddir@/zfs_config.h
ZFS_MODULE_CFLAGS += -I@abs_top_builddir@/include
else
zfs_include = $(srctree)/include/zfs
ZFS_MODULE_CFLAGS += -include $(zfs_include)/zfs_config.h
endif

ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/kernel
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/spl
ZFS_MODULE_CFLAGS += -I$(zfs_include)/os/linux/zfs
ZFS_MODULE_CFLAGS += -I$(zfs_include)
ZFS_MODULE_CPPFLAGS += -D_KERNEL
ZFS_MODULE_CPPFLAGS += @KERNEL_DEBUG_CPPFLAGS@

ifneq ($(KBUILD_EXTMOD),)
@CONFIG_QAT_TRUE@ZFS_MODULE_CFLAGS += -I@QAT_SRC@/include
@CONFIG_QAT_TRUE@KBUILD_EXTRA_SYMBOLS += @QAT_SYMBOLS@
endif

subdir-asflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)
subdir-ccflags-y := $(ZFS_MODULE_CFLAGS) $(ZFS_MODULE_CPPFLAGS)


endif
13 changes: 13 additions & 0 deletions fs/zfs/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config ZFS
tristate "ZFS filesystem support"
depends on EFI_PARTITION
select ZLIB_INFLATE
select ZLIB_DEFLATE
help
This is the ZFS filesystem from the OpenZFS project.

See https://github.com/openzfs/zfs

To compile this file system support as a module, choose M here.

If unsure, say N.
149 changes: 149 additions & 0 deletions fs/zfs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
include Kbuild

INSTALL_MOD_DIR ?= extra
INSTALL_MOD_PATH ?= $(DESTDIR)

SUBDIR_TARGETS = icp lua zstd

all: modules
distclean maintainer-clean: clean
install: modules_install
uninstall: modules_uninstall
check:

.PHONY: all distclean maintainer-clean install uninstall check distdir \
modules modules-Linux modules-FreeBSD modules-unknown \
clean clean-Linux clean-FreeBSD \
modules_install modules_install-Linux modules_install-FreeBSD \
modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \
cppcheck cppcheck-Linux cppcheck-FreeBSD

# For FreeBSD, use debug options from ./configure if not overridden.
export WITH_DEBUG ?=
export WITH_INVARIANTS ?=

# Filter out options that FreeBSD make doesn't understand
getflags = ( \
set -- \
$(filter-out --%,$(firstword $(MFLAGS))) \
$(filter -I%,$(MFLAGS)) \
$(filter -j%,$(MFLAGS)); \
fmakeflags=""; \
while getopts :deiI:j:knqrstw flag; do \
case $$flag in \
\?) :;; \
:) if [ $$OPTARG = "j" ]; then \
ncpus=$$(sysctl -n kern.smp.cpus 2>/dev/null || :); \
if [ -n "$$ncpus" ]; then fmakeflags="$$fmakeflags -j$$ncpus"; fi; \
fi;; \
d) fmakeflags="$$fmakeflags -dA";; \
*) fmakeflags="$$fmakeflags -$$flag$$OPTARG";; \
esac; \
done; \
echo $$fmakeflags \
)
FMAKEFLAGS = -C /home/march7th/zfs-2.1.12/module -f Makefile.bsd $(shell $(getflags))

ifneq (/home/march7th/zfs-2.1.12/module,/home/march7th/zfs-2.1.12/module)
FMAKEFLAGS += MAKEOBJDIR=/home/march7th/zfs-2.1.12/module
endif

FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)

modules-Linux:
list='$(SUBDIR_TARGETS)'; for td in $$list; do $(MAKE) -C $$td; done
$(MAKE) -C /home/march7th/linux-work $(if ,CC=) \
$(if ,LD=) $(if ,LLVM=) \
M="$$PWD" CONFIG_ZFS=m modules

modules-FreeBSD:
+$(FMAKE)

modules-unknown:
@true

modules: modules-Linux

clean-Linux:
@# Only cleanup the kernel build directories when CONFIG_KERNEL
@# is defined. This indicates that kernel modules should be built.
# $(MAKE) -C /home/march7th/linux-work M="$$PWD" clean

$(RM) NONE Module.markers
find . -name '*.ur-safe' -type f -delete

clean-FreeBSD:
+$(FMAKE) clean

clean: clean-Linux

modules_install-Linux:
@# Install the kernel modules
$(MAKE) -C /home/march7th/linux-work M="$$PWD" modules_install \
INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) \
INSTALL_MOD_DIR=$(INSTALL_MOD_DIR) \
KERNELRELEASE=6.3.9+
@# Remove extraneous build products when packaging
kmoddir=$(INSTALL_MOD_PATH)/lib/modules/6.3.9+; \
if [ -n "$(DESTDIR)" ]; then \
find $$kmoddir -name 'modules.*' -delete; \
fi
@# Debian ships tiny fake System.map files that are
@# syntactically valid but just say
@# "if you want system.map go install this package"
@# Naturally, depmod is less than amused by this.
@# So if we find it missing or with one of these present,
@# we check for the alternate path for the System.map
sysmap=$(INSTALL_MOD_PATH)/boot/System.map-6.3.9+; \
{ [ -f "$$sysmap" ] && [ $$(wc -l < "$$sysmap") -ge 100 ]; } || \
sysmap=$(INSTALL_MOD_PATH)/usr/lib/debug/boot/System.map-6.3.9+; \
if [ -f $$sysmap ]; then \
depmod -ae -F $$sysmap 6.3.9+; \
fi

modules_install-FreeBSD:
@# Install the kernel modules
+$(FMAKE) install

modules_install: modules_install-Linux

modules_uninstall-Linux:
@# Uninstall the kernel modules
kmoddir=$(INSTALL_MOD_PATH)/lib/modules/6.3.9+; \
for objdir in $(ZFS_MODULES); do \
$(RM) -R $$kmoddir/$(INSTALL_MOD_DIR)/$$objdir; \
done

modules_uninstall-FreeBSD:
@false

modules_uninstall: modules_uninstall-Linux

cppcheck-Linux:
-j8 --std=c99 --quiet --force --error-exitcode=2 \
--inline-suppr \
--suppress=unmatchedSuppression \
--suppress=noValidConfiguration \
--enable=warning,information -D_KERNEL \
--include=/home/march7th/linux-work/include/generated/autoconf.h \
--include=../zfs_config.h \
--config-exclude=/home/march7th/linux-work/include \
-I /home/march7th/linux-work/include \
-I ../include/os/linux/kernel \
-I ../include/os/linux/spl \
-I ../include/os/linux/zfs \
-I ../include \
avl icp lua nvpair spl unicode zcommon zfs zstd os/linux

cppcheck-FreeBSD:
@true

cppcheck: cppcheck-Linux

distdir:
(cd . && find $(ZFS_MODULES) os -name '*.[chS]') | \
while read path; do \
mkdir -p $$distdir/$${path%/*}; \
cp ./$$path $$distdir/$$path; \
done; \
cp ./Makefile.bsd $$distdir/Makefile.bsd
Loading

0 comments on commit 8b315d0

Please sign in to comment.