mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
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 <behlendorf1@llnl.gov> Signed-off-by: Matt Macy <mmacy@FreeBSD.org> Closes #9542
This commit is contained in:
parent
bd4dde8ef7
commit
4a2ed90013
@ -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 */
|
||||
|
@ -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 \
|
||||
|
28
include/os/linux/spl/sys/mod_os.h
Normal file
28
include/os/linux/spl/sys/mod_os.h
Normal file
@ -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 <behlendorf1@llnl.gov>.
|
||||
* 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 */
|
@ -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 \
|
||||
|
41
include/sys/mod.h
Normal file
41
include/sys/mod.h
Normal file
@ -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 <behlendorf1@llnl.gov>.
|
||||
* 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 */
|
@ -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>
|
||||
@ -206,11 +207,6 @@ typedef struct zfs_kernel_param {
|
||||
#define ZFS_MODULE_PARAM_CALL(scope_prefix, name_prefix, name, setfunc, \
|
||||
getfunc, perm, desc)
|
||||
|
||||
/*
|
||||
* Exported symbols
|
||||
*/
|
||||
#define EXPORT_SYMBOL(x)
|
||||
|
||||
/*
|
||||
* Threads.
|
||||
*/
|
||||
|
@ -103,6 +103,7 @@
|
||||
#include <sys/debug.h>
|
||||
#include <sys/avl.h>
|
||||
#include <sys/cmn_err.h>
|
||||
#include <sys/mod.h>
|
||||
|
||||
/*
|
||||
* Small arrays to translate between balance (or diff) values and child indices.
|
||||
@ -993,7 +994,6 @@ done:
|
||||
}
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#include <linux/module.h>
|
||||
|
||||
static int __init
|
||||
avl_init(void)
|
||||
@ -1008,11 +1008,12 @@ avl_fini(void)
|
||||
|
||||
module_init(avl_init);
|
||||
module_exit(avl_fini);
|
||||
#endif
|
||||
|
||||
MODULE_DESCRIPTION("Generic AVL tree implementation");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
ZFS_MODULE_DESCRIPTION("Generic AVL tree implementation");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
EXPORT_SYMBOL(avl_create);
|
||||
EXPORT_SYMBOL(avl_find);
|
||||
@ -1029,4 +1030,3 @@ EXPORT_SYMBOL(avl_remove);
|
||||
EXPORT_SYMBOL(avl_numnodes);
|
||||
EXPORT_SYMBOL(avl_destroy_nodes);
|
||||
EXPORT_SYMBOL(avl_destroy);
|
||||
#endif
|
||||
|
@ -1295,10 +1295,13 @@ lua_fini(void)
|
||||
module_init(lua_init);
|
||||
module_exit(lua_fini);
|
||||
|
||||
MODULE_DESCRIPTION("Lua Interpreter for ZFS");
|
||||
MODULE_AUTHOR("Lua.org");
|
||||
MODULE_LICENSE("MIT");
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
#endif
|
||||
/* END CSTYLED */
|
||||
|
||||
ZFS_MODULE_DESCRIPTION("Lua Interpreter for ZFS");
|
||||
ZFS_MODULE_AUTHOR("Lua.org");
|
||||
ZFS_MODULE_LICENSE("MIT");
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
EXPORT_SYMBOL(lua_absindex);
|
||||
EXPORT_SYMBOL(lua_atpanic);
|
||||
@ -1340,6 +1343,3 @@ EXPORT_SYMBOL(lua_tonumberx);
|
||||
EXPORT_SYMBOL(lua_touserdata);
|
||||
EXPORT_SYMBOL(lua_type);
|
||||
EXPORT_SYMBOL(lua_typename);
|
||||
|
||||
#endif
|
||||
/* END CSTYLED */
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/strings.h>
|
||||
#include <rpc/xdr.h>
|
||||
#include <sys/mod.h>
|
||||
|
||||
#if defined(_KERNEL)
|
||||
#include <sys/sunddi.h>
|
||||
@ -3601,11 +3602,12 @@ nvpair_fini(void)
|
||||
|
||||
module_init(nvpair_init);
|
||||
module_exit(nvpair_fini);
|
||||
#endif
|
||||
|
||||
MODULE_DESCRIPTION("Generic name/value pair implementation");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
ZFS_MODULE_DESCRIPTION("Generic name/value pair implementation");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
EXPORT_SYMBOL(nv_alloc_init);
|
||||
EXPORT_SYMBOL(nv_alloc_reset);
|
||||
@ -3720,5 +3722,3 @@ EXPORT_SYMBOL(nvpair_value_uint64_array);
|
||||
EXPORT_SYMBOL(nvpair_value_string_array);
|
||||
EXPORT_SYMBOL(nvpair_value_nvlist_array);
|
||||
EXPORT_SYMBOL(nvpair_value_hrtime);
|
||||
|
||||
#endif
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <sys/strings.h>
|
||||
#include <linux/kmod.h>
|
||||
#include "zfs_gitrev.h"
|
||||
#include <linux/mod_compat.h>
|
||||
|
||||
char spl_gitrev[64] = ZFS_META_GITREV;
|
||||
|
||||
@ -751,7 +752,7 @@ spl_fini(void)
|
||||
module_init(spl_init);
|
||||
module_exit(spl_fini);
|
||||
|
||||
MODULE_DESCRIPTION("Solaris Porting Layer");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
ZFS_MODULE_DESCRIPTION("Solaris Porting Layer");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE("GPL");
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
@ -318,9 +318,9 @@ _fini(void)
|
||||
#if defined(_KERNEL)
|
||||
module_init(_init);
|
||||
module_exit(_fini);
|
||||
|
||||
MODULE_DESCRIPTION("ZFS");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
#endif
|
||||
|
||||
ZFS_MODULE_DESCRIPTION("ZFS");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
@ -46,7 +46,7 @@
|
||||
#include <sys/byteorder.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/u8_textprep_data.h>
|
||||
|
||||
#include <sys/mod.h>
|
||||
|
||||
/* The maximum possible number of bytes in a UTF-8 character. */
|
||||
#define U8_MB_CUR_MAX (4)
|
||||
@ -2139,13 +2139,13 @@ unicode_fini(void)
|
||||
|
||||
module_init(unicode_init);
|
||||
module_exit(unicode_fini);
|
||||
#endif
|
||||
|
||||
MODULE_DESCRIPTION("Unicode implementation");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
ZFS_MODULE_DESCRIPTION("Unicode implementation");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
EXPORT_SYMBOL(u8_validate);
|
||||
EXPORT_SYMBOL(u8_strcmp);
|
||||
EXPORT_SYMBOL(u8_textprep_str);
|
||||
#endif
|
||||
|
@ -895,10 +895,12 @@ zcommon_fini(void)
|
||||
module_init(zcommon_init);
|
||||
module_exit(zcommon_fini);
|
||||
|
||||
MODULE_DESCRIPTION("Generic ZFS support");
|
||||
MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
#endif
|
||||
|
||||
ZFS_MODULE_DESCRIPTION("Generic ZFS support");
|
||||
ZFS_MODULE_AUTHOR(ZFS_META_AUTHOR);
|
||||
ZFS_MODULE_LICENSE(ZFS_META_LICENSE);
|
||||
ZFS_MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE);
|
||||
|
||||
/* zfs dataset property functions */
|
||||
EXPORT_SYMBOL(zfs_userquota_prop_prefixes);
|
||||
@ -924,5 +926,3 @@ EXPORT_SYMBOL(zfs_prop_index_to_string);
|
||||
EXPORT_SYMBOL(zfs_prop_string_to_index);
|
||||
EXPORT_SYMBOL(zfs_prop_valid_for_type);
|
||||
EXPORT_SYMBOL(zfs_prop_written);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user