Skip to content

Commit

Permalink
OpenZFS restructuring - move platform specific headers
Browse files Browse the repository at this point in the history
Move platform specific Linux headers under include/os/linux/.
Update the build system accordingly to detect the platform.
This lays some of the initial groundwork to supporting building
for other platforms.

As part of this change it was necessary to create both a user
and kernel space sys/simd.h header which can be included in
either context.  No functional change, the source has been
refactored and the relevant #include's updated.

Reviewed-by: Jorgen Lundman <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Matthew Macy <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#9198
  • Loading branch information
mattmacy authored and behlendorf committed Sep 5, 2019
1 parent d02186e commit 006e9a4
Show file tree
Hide file tree
Showing 116 changed files with 699 additions and 469 deletions.
26 changes: 26 additions & 0 deletions config/always-system.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
dnl #
dnl # Set the target system
dnl #
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_SYSTEM], [
AC_MSG_CHECKING([for system type ($host_os)])
case $host_os in
*linux*)
AC_DEFINE([SYSTEM_LINUX], [1],
[True if ZFS is to be compiled for a Linux system])
ac_system="Linux"
;;
*freebsd*)
AC_DEFINE([SYSTEM_FREEBSD], [1],
[True if ZFS is to be compiled for a FreeBSD system])
ac_system="FreeBSD"
;;
*)
ac_system="unknown"
;;
esac
AC_MSG_RESULT([$ac_system])
AC_SUBST([ac_system])
AM_CONDITIONAL([BUILD_LINUX], [test "x$ac_system" = "xLinux"])
AM_CONDITIONAL([BUILD_FREEBSD], [test "x$ac_system" = "xFreeBSD"])
])
1 change: 1 addition & 0 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER
ZFS_AC_CONFIG_ALWAYS_CC_ASAN
ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD
ZFS_AC_CONFIG_ALWAYS_SYSTEM
ZFS_AC_CONFIG_ALWAYS_ARCH
ZFS_AC_CONFIG_ALWAYS_PYTHON
ZFS_AC_CONFIG_ALWAYS_PYZFS
Expand Down
13 changes: 9 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,15 @@ AC_CONFIG_FILES([
module/icp/Makefile
module/spl/Makefile
include/Makefile
include/linux/Makefile
include/spl/Makefile
include/spl/rpc/Makefile
include/spl/sys/Makefile
include/os/Makefile
include/os/linux/Makefile
include/os/linux/kernel/Makefile
include/os/linux/kernel/linux/Makefile
include/os/linux/spl/Makefile
include/os/linux/spl/rpc/Makefile
include/os/linux/spl/sys/Makefile
include/os/linux/zfs/Makefile
include/os/linux/zfs/sys/Makefile
include/sys/Makefile
include/sys/fs/Makefile
include/sys/fm/Makefile
Expand Down
4 changes: 3 additions & 1 deletion copy-builtin
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ EOF
{
cat <<-"EOF"
ZFS_MODULE_CFLAGS = -I$(srctree)/include/zfs
ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/spl
ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/spl
ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/zfs
ZFS_MODULE_CFLAGS += -I$(srctree)/include/zfs/os/linux/kernel
ZFS_MODULE_CFLAGS += -include $(srctree)/include/zfs/zfs_config.h
ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
ZFS_MODULE_CPPFLAGS = -D_KERNEL
Expand Down
1 change: 1 addition & 0 deletions include/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/zfs_gitrev.h
/spl
2 changes: 1 addition & 1 deletion include/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SUBDIRS = linux spl sys
SUBDIRS = sys os

COMMON_H = \
$(top_srcdir)/include/zfeature_common.h \
Expand Down
29 changes: 0 additions & 29 deletions include/linux/Makefile.am

This file was deleted.

3 changes: 3 additions & 0 deletions include/os/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
if BUILD_LINUX
SUBDIRS = linux
endif
1 change: 1 addition & 0 deletions include/os/linux/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = kernel spl zfs
1 change: 1 addition & 0 deletions include/os/linux/kernel/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUBDIRS = linux
29 changes: 29 additions & 0 deletions include/os/linux/kernel/linux/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
COMMON_H =

KERNEL_H = \
$(top_srcdir)/include/os/linux/kernel/linux/dcache_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/xattr_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/vfs_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/blkdev_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/utsname_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/kmap_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/simd.h \
$(top_srcdir)/include/os/linux/kernel/linux/simd_x86.h \
$(top_srcdir)/include/os/linux/kernel/linux/simd_aarch64.h \
$(top_srcdir)/include/os/linux/kernel/linux/mod_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/page_compat.h \
$(top_srcdir)/include/os/linux/kernel/linux/compiler_compat.h

USER_H =

EXTRA_DIST = $(COMMON_H) $(KERNEL_H) $(USER_H)

if CONFIG_USER
libzfsdir = $(includedir)/libzfs/linux
libzfs_HEADERS = $(COMMON_H) $(USER_H)
endif

if CONFIG_KERNEL
kerneldir = @prefix@/src/zfs-$(VERSION)/include/linux
kernel_HEADERS = $(COMMON_H) $(KERNEL_H)
endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions include/linux/simd.h → include/os/linux/kernel/linux/simd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* Copyright (C) 2019 Lawrence Livermore National Security, LLC.
*/

#ifndef _SIMD_H
#define _SIMD_H
#ifndef _LINUX_SIMD_H
#define _LINUX_SIMD_H

#if defined(__x86)
#include <linux/simd_x86.h>
Expand All @@ -32,10 +32,10 @@
#include <linux/simd_aarch64.h>
#else

#define kfpu_allowed() 1
#define kfpu_allowed() 0
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() do {} while (0)
#define kfpu_end() do {} while (0)

#endif
#endif /* _SIMD_H */
#endif /* _LINUX_SIMD_H */
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,21 @@
* kfpu_end()
*/

#ifndef _SIMD_AARCH64_H
#define _SIMD_AARCH64_H
#ifndef _LINUX_SIMD_AARCH64_H
#define _LINUX_SIMD_AARCH64_H

#include <sys/isa_defs.h>

#if defined(__aarch64__)

#include <sys/types.h>

#if defined(_KERNEL)
#include <asm/neon.h>

#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() kernel_neon_begin()
#define kfpu_end() kernel_neon_end()
#else
/*
* fpu dummy methods for userspace
*/
#define kfpu_allowed() 1
#define kfpu_initialize(tsk) do {} while (0)
#define kfpu_begin() do {} while (0)
#define kfpu_end() do {} while (0)
#endif /* defined(_KERNEL) */

#endif /* __aarch64__ */

#endif /* _SIMD_AARCH64_H */
#endif /* _LINUX_SIMD_AARCH64_H */
Loading

0 comments on commit 006e9a4

Please sign in to comment.