summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2019-11-01 10:41:03 -0700
committerBrian Behlendorf <[email protected]>2019-11-01 10:41:03 -0700
commit4a2ed9001353a895ff84594cb34e9c42fd24edaa (patch)
tree5b491b0d933db97f8d33cd6a02b2f18fed0d5d21 /include
parentbd4dde8ef7b3861b20f12619f8994e037b303040 (diff)
Wrap Linux module macros
MODULE_VERSION is already defined on FreeBSD. Wrap all of the used MODULE_* macros for the sake of consistency and portability. Add a user space noop version to reduce the need for _KERNEL ifdefs. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #9542
Diffstat (limited to 'include')
-rw-r--r--include/os/linux/kernel/linux/mod_compat.h5
-rw-r--r--include/os/linux/spl/sys/Makefile.am1
-rw-r--r--include/os/linux/spl/sys/mod_os.h28
-rw-r--r--include/sys/Makefile.am1
-rw-r--r--include/sys/mod.h41
-rw-r--r--include/sys/zfs_context.h8
6 files changed, 78 insertions, 6 deletions
diff --git a/include/os/linux/kernel/linux/mod_compat.h b/include/os/linux/kernel/linux/mod_compat.h
index 11df19411..572093218 100644
--- a/include/os/linux/kernel/linux/mod_compat.h
+++ b/include/os/linux/kernel/linux/mod_compat.h
@@ -139,4 +139,9 @@ enum scope_prefix_types {
MODULE_PARM_DESC(name_prefix ## name, desc)
/* END CSTYLED */
+#define ZFS_MODULE_DESCRIPTION(s) MODULE_DESCRIPTION(s)
+#define ZFS_MODULE_AUTHOR(s) MODULE_AUTHOR(s)
+#define ZFS_MODULE_LICENSE(s) MODULE_LICENSE(s)
+#define ZFS_MODULE_VERSION(s) MODULE_VERSION(s)
+
#endif /* _MOD_COMPAT_H */
diff --git a/include/os/linux/spl/sys/Makefile.am b/include/os/linux/spl/sys/Makefile.am
index 934289321..7e7d95dc0 100644
--- a/include/os/linux/spl/sys/Makefile.am
+++ b/include/os/linux/spl/sys/Makefile.am
@@ -22,6 +22,7 @@ KERNEL_H = \
$(top_srcdir)/include/os/linux/spl/sys/kobj.h \
$(top_srcdir)/include/os/linux/spl/sys/kstat.h \
$(top_srcdir)/include/os/linux/spl/sys/list.h \
+ $(top_srcdir)/include/os/linux/spl/sys/mod_os.h \
$(top_srcdir)/include/os/linux/spl/sys/mode.h \
$(top_srcdir)/include/os/linux/spl/sys/mutex.h \
$(top_srcdir)/include/os/linux/spl/sys/param.h \
diff --git a/include/os/linux/spl/sys/mod_os.h b/include/os/linux/spl/sys/mod_os.h
new file mode 100644
index 000000000..8adf62129
--- /dev/null
+++ b/include/os/linux/spl/sys/mod_os.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <[email protected]>.
+ * UCRL-CODE-235197
+ *
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://zfsonlinux.org/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SPL_MOD_H
+#define _SPL_MOD_H
+#include <linux/mod_compat.h>
+
+#endif /* SPL_MOD_H */
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am
index 4d0afc18c..21e85431c 100644
--- a/include/sys/Makefile.am
+++ b/include/sys/Makefile.am
@@ -48,6 +48,7 @@ COMMON_H = \
$(top_srcdir)/include/sys/metaslab_impl.h \
$(top_srcdir)/include/sys/mmp.h \
$(top_srcdir)/include/sys/mntent.h \
+ $(top_srcdir)/include/sys/mod.h \
$(top_srcdir)/include/sys/multilist.h \
$(top_srcdir)/include/sys/note.h \
$(top_srcdir)/include/sys/nvpair.h \
diff --git a/include/sys/mod.h b/include/sys/mod.h
new file mode 100644
index 000000000..0ad7704af
--- /dev/null
+++ b/include/sys/mod.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
+ * Copyright (C) 2007 The Regents of the University of California.
+ * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
+ * Written by Brian Behlendorf <[email protected]>.
+ * UCRL-CODE-235197
+ *
+ * This file is part of the SPL, Solaris Porting Layer.
+ * For details, see <http://zfsonlinux.org/>.
+ *
+ * The SPL is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * The SPL is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with the SPL. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SYS_MOD_H
+#define _SYS_MOD_H
+
+#ifdef _KERNEL
+#include <sys/mod_os.h>
+#else
+/*
+ * Exported symbols
+ */
+#define EXPORT_SYMBOL(x)
+
+#define ZFS_MODULE_DESCRIPTION(s)
+#define ZFS_MODULE_AUTHOR(s)
+#define ZFS_MODULE_LICENSE(s)
+#define ZFS_MODULE_VERSION(s)
+#endif
+
+#endif /* SYS_MOD_H */
diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h
index 18d9b25a3..8b31bbc08 100644
--- a/include/sys/zfs_context.h
+++ b/include/sys/zfs_context.h
@@ -64,7 +64,7 @@
#include <sys/procfs_list.h>
#include <linux/dcache_compat.h>
#include <linux/utsname_compat.h>
-#include <linux/mod_compat.h>
+#include <sys/mod.h>
#include <sys/sysmacros.h>
#else /* _KERNEL */
@@ -106,6 +106,7 @@
#include <sys/resource.h>
#include <sys/byteorder.h>
#include <sys/list.h>
+#include <sys/mod.h>
#include <sys/uio.h>
#include <sys/zfs_debug.h>
#include <sys/kstat.h>
@@ -207,11 +208,6 @@ typedef struct zfs_kernel_param {
getfunc, perm, desc)
/*
- * Exported symbols
- */
-#define EXPORT_SYMBOL(x)
-
-/*
* Threads.
*/
typedef pthread_t kthread_t;