Migrate the backported xarray code to lustre_compat.
Along the way, create the needed build infrastructure
for lustre_compat. Currently, lustre_compat is built
into libcfs.ko.
Eventually, all of the Lustre/LNet compatability code
will live in lustre_compat - maintaining a clear
separation from the functional code in Lustre and LNet.
Test-Parameters: trivial
Signed-off-by: Timothy Day <timday@amazon.com>
Change-Id: I74249d0b5714bee3549bf42a8fede3f279bc37ee
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58114
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
SUBDIRS := @LDISKFS_SUBDIR@ \
. \
@LUSTREIOKIT_SUBDIR@ \
+ lustre_compat \
libcfs \
lnet \
lustre
DIST_SUBDIRS := ldiskfs \
lustre-iokit \
+ lustre_compat \
libcfs \
lnet \
lustre \
])
#
+# LB_COMPAT_CONFIG_FILES
+#
+# build-specific config files (lustre_compat)
+#
+AC_DEFUN([LB_COMPAT_CONFIG_FILES], [
+ AC_CONFIG_FILES(
+ lustre_compat/Makefile
+ lustre_compat/lib/Makefile
+ lustre_compat/autoMakefile
+ lustre_compat/lib/autoMakefile
+ lustre_compat/include/Makefile
+ lustre_compat/include/lustre_compat/Makefile
+ lustre_compat/include/lustre_compat/linux/Makefile
+ )
+])
+
+#
# LB_CONFIG_SERVERS
#
AC_DEFUN([LB_CONFIG_SERVERS], [
LPLUG_CONFIGURE
LIBCFS_CONFIG_FILES
LB_CONFIG_FILES
+LB_COMPAT_CONFIG_FILES
LN_CONFIG_FILES
LC_CONFIG_FILES
LPLUG_CONFIG_FILES
AC_SUBST(CCASFLAGS)
# everyone builds against lnet and lustre kernel headers
-EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/libcfs/include -I$PWD/libcfs/include/libcfs -I$PWD/lnet/include/uapi -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include"
+EXTRA_KCFLAGS="$EXTRA_KCFLAGS -g -I$PWD/libcfs/include -I$PWD/libcfs/include/libcfs -I$PWD/lnet/include/uapi -I$PWD/lnet/include -I$PWD/lustre/include/uapi -I$PWD/lustre/include -I$PWD/lustre_compat/include"
AC_SUBST(EXTRA_KCFLAGS)
]) # LTC_PROG_CC
EXTRA_DIST = linux-misc.h linux-fs.h linux-mem.h linux-time.h linux-cpu.h \
linux-list.h linux-hash.h linux-wait.h linux-net.h \
- generic-radix-tree.h glob.h refcount.h processor.h xarray.h \
+ generic-radix-tree.h glob.h refcount.h processor.h \
linux-fortify-string.h
MODULES = libcfs
+COMPAT := @top_srcdir@/lustre_compat/lib/
+
+libcfs_dir := $(dir $(lastword $(MAKEFILE_LIST)))
+-include $(libcfs_dir)/../../lustre_compat/lib/Makefile
+
libcfs-linux-objs := linux-prim.o
libcfs-linux-objs += linux-hash.o
libcfs-linux-objs += linux-wait.o
libcfs-linux-objs += generic-radix-tree.o
libcfs-linux-objs += glob.o
-libcfs-linux-objs += xarray.o
+
+libcfs-compat-objs += $(patsubst %,$(COMPAT)%,$(compat_objs))
libcfs-crypto-objs := crypto.o fname.o hkdf.o hooks.o keyring.o
libcfs-crypto-objs += keysetup.o keysetup_v1.o policy.o
libcfs-all-objs := debug.o fail.o module.o tracefile.o
-libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
+libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs) $(libcfs-compat-objs)
@LLCRYPT_TRUE@libcfs-objs += $(libcfs-crypto-objs)
EXTRA_PRE_CFLAGS := -I@LUSTRE@/../libcfs/libcfs
linux-hash.c \
linux-wait.c \
generic-radix-tree.c \
- glob.c \
- xarray.c
+ glob.c
#include <libcfs/linux/linux-wait.h>
#include <libcfs/linux/linux-misc.h>
#include <libcfs/linux/linux-mem.h>
-#ifndef HAVE_XARRAY_SUPPORT
-#include <libcfs/linux/xarray.h>
-#endif
+#include <lustre_compat/linux/xarray.h>
#include <lustre_crypto.h>
#ifndef HAVE_KTIME_GET_TS64
#include <linux/pagevec.h>
#include <linux/workqueue.h>
#include <libcfs/linux/linux-fs.h>
-#ifdef HAVE_XARRAY_SUPPORT
-#include <linux/xarray.h>
-#else
-#include <libcfs/linux/xarray.h>
-#endif
+#include <lustre_compat/linux/xarray.h>
#include <obd_support.h>
#ifdef HAVE_4ARGS_VFS_SYMLINK
#ifndef _LUSTRE_NRS_ORR_H
#define _LUSTRE_NRS_ORR_H
-#ifdef HAVE_XARRAY_SUPPORT
-#include <linux/xarray.h>
-#else
-#include <libcfs/linux/xarray.h>
-#endif
+#include <lustre_compat/linux/xarray.h>
/**
* ORR policy operations
#include <linux/kobject.h>
#include <linux/spinlock.h>
#include <linux/sysfs.h>
-#include <libcfs/linux/xarray.h>
+#include <lustre_compat/linux/xarray.h>
#include <uapi/linux/lustre/lustre_idl.h>
#include <lustre_lib.h>
#include <linux/delay.h>
#include <linux/uidgid.h>
#include <linux/device.h>
-#include <linux/xarray.h>
+#include <lustre_compat/linux/xarray.h>
#include <lustre_errno.h>
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+obj-m += lib/
+
+@INCLUDE_RULES@
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+SUBDIRS = lib include
--- /dev/null
+/Makefile.in
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+SUBDIRS = lustre_compat
+DIST_SUBDIRS = lustre_compat
--- /dev/null
+/Makefile.in
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+SUBDIRS = linux
+DIST_SUBDIRS = linux
--- /dev/null
+/Makefile.in
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+EXTRA_DIST = xarray.h
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+compat_objs := xarray.o
+
+EXTRA_DIST = $(compat_objs:.o=.c)
+
+ifneq "$(MODULES)" "libcfs"
+@INCLUDE_RULES@
+endif
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0
+
+#
+# This file is part of Lustre, http://www.lustre.org/
+#
+
+MOSTLYCLEANFILES := @MOSTLYCLEANFILES@
#include <linux/export.h>
#include <linux/list.h>
#include <linux/slab.h>
-#include <libcfs/linux/xarray.h>
+#include <lustre_compat/linux/xarray.h>
/*
* Coding conventions in this file: