2
* Copyright (C) 2007 Junjiro Okajima
4
* This program, aufs is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
* module global variables and operations
22
* $Id: module.c,v 1.3 2008/04/28 03:02:06 sfjro Exp $
25
#include <linux/module.h>
28
/* ---------------------------------------------------------------------- */
33
struct kmem_cache *au_cachep[AuCache_Last];
34
static int __init create_cache(void)
36
au_cachep[AuCache_DINFO] = AuCache(au_dinfo);
37
if (au_cachep[AuCache_DINFO])
38
au_cachep[AuCache_ICNTNR] = AuCache(aufs_icntnr);
39
if (au_cachep[AuCache_ICNTNR])
40
au_cachep[AuCache_FINFO] = AuCache(au_finfo);
41
//au_cachep[AuCache_FINFO] = NULL;
42
if (au_cachep[AuCache_FINFO])
43
au_cachep[AuCache_VDIR] = AuCache(au_vdir);
44
if (au_cachep[AuCache_VDIR])
45
au_cachep[AuCache_DEHSTR] = AuCache(au_vdir_dehstr);
46
if (au_cachep[AuCache_DEHSTR])
52
static void destroy_cache(void)
55
for (i = 0; i < AuCache_Last; i++)
57
kmem_cache_destroy(au_cachep[i]);
62
/* ---------------------------------------------------------------------- */
64
char au_esc_chars[0x20 + 3]; /* 0x01-0x20, backslash, del, and NULL */
68
* functions for module interface.
70
MODULE_LICENSE("GPL");
71
MODULE_AUTHOR("Junjiro Okajima");
72
MODULE_DESCRIPTION(AUFS_NAME " -- Another unionfs");
73
MODULE_VERSION(AUFS_VERSION);
75
/* it should be 'byte', but param_set_byte() prints it by "%c" */
76
short aufs_nwkq = AUFS_NWKQ_DEF;
77
MODULE_PARM_DESC(nwkq, "the number of workqueue thread, " AUFS_WKQ_NAME);
78
module_param_named(nwkq, aufs_nwkq, short, S_IRUGO);
81
MODULE_PARM_DESC(brs, "use <sysfs>/fs/aufs/sbi_*/brN");
82
module_param_named(brs, sysaufs_brs, int, S_IRUGO);
84
/* ---------------------------------------------------------------------- */
86
static int __init aufs_init(void)
94
for (i = 1; i <= ' '; i++)
100
au_dir_roflags = au_file_roflags(O_DIRECTORY | O_LARGEFILE);
103
if (unlikely(aufs_nwkq <= 0))
106
err = sysaufs_init();
112
err = au_inotify_init();
115
err = au_sysrq_init();
119
err = create_cache();
123
err = register_filesystem(&aufs_fs_type);
126
pr_info(AUFS_NAME " " AUFS_VERSION "\n");
127
return 0; /* success */
144
static void __exit aufs_exit(void)
146
unregister_filesystem(&aufs_fs_type);
155
module_init(aufs_init);
156
module_exit(aufs_exit);
158
/* ---------------------------------------------------------------------- */
163
#ifdef CONFIG_AUFS_HINOTIFY
164
#ifndef CONFIG_INOTIFY
165
#error enable CONFIG_INOTIFY to use CONFIG_AUFS_HINOTIFY.
167
#endif /* CONFIG_AUFS_HINOTIFY */
169
#if AUFS_BRANCH_MAX > 511 && PAGE_SIZE > 4096
170
#warning pagesize is larger than 4kb, \
171
CONFIG_AUFS_BRANCH_MAX_511 or smaller is recommended.
174
#ifdef CONFIG_AUFS_STAT
176
#error CONFIG_AUFS_STAT requires CONFIG_SYSFS.
178
#endif /* CONFIG_AUFS_STAT */
180
#ifdef CONFIG_AUFS_SYSAUFS
181
#warning CONFIG_AUFS_SYSAUFS is unnecessary for linux-2.6.25 and later.
184
#ifdef CONFIG_AUFS_EXPORT
185
#if !defined(CONFIG_EXPORTFS) && !defined(CONFIG_EXPORTFS_MODULE)
186
#error CONFIG_AUFS_EXPORT requires CONFIG_EXPORTFS
188
#if defined(CONFIG_EXPORTFS_MODULE) && defined(CONFIG_AUFS)
189
#error need CONFIG_EXPORTFS = y to link aufs statically with CONFIG_AUFS_EXPORT
191
#endif /* CONFIG_AUFS_EXPORT */
193
#ifdef CONFIG_AUFS_SEC_PERM_PATCH
194
#ifndef CONFIG_SECURITY
195
#warning CONFIG_AUFS_SEC_PERM_PATCH is unnecessary since CONFIG_SECURITY is disabled.
198
#warning CONFIG_AUFS_SEC_PERM_PATCH is unnecessary since CONFIG_AUFS is not a module.
202
#ifdef CONFIG_AUFS_PUT_FILP_PATCH
203
#if !defined(CONFIG_NFS_FS) && !defined(CONFIG_NFS_FS_MODULE)
204
#warning CONFIG_AUFS_PUT_FILP_PATCH is unnecessary since CONFIG_NFS_FS is disabled.
207
#warning CONFIG_AUFS_PUT_FILP_PATCH is unnecessary since CONFIG_AUFS is not a module.
209
#ifdef CONFIG_AUFS_FAKE_DM
210
#error CONFIG_AUFS_FAKE_DM must be disabled for CONFIG_AUFS_PUT_FILP_PATCH.
212
#endif /* CONFIG_AUFS_PUT_FILP_PATCH */
214
#ifdef CONFIG_AUFS_LHASH_PATCH
215
#if !defined(CONFIG_NFS_FS) && !defined(CONFIG_NFS_FS_MODULE)
216
#warning CONFIG_AUFS_LHASH_PATCH is unnecessary since CONFIG_NFS_FS is disabled.
218
#ifdef CONFIG_AUFS_FAKE_DM
219
#error CONFIG_AUFS_FAKE_DM must be disabled for CONFIG_AUFS_LHASH_PATCH.
223
#ifdef CONFIG_AUFS_KSIZE_PATCH
224
#warning CONFIG_AUFS_KSIZE_PATCH is unnecessary for linux-2.6.22 and later.
227
#ifdef CONFIG_AUFS_WORKAROUND_FUSE
228
#if !defined(CONFIG_FUSE_FS) && !defined(CONFIG_FUSE_FS_MODULE)
229
#warning CONFIG_AUFS_WORKAROUND_FUSE is enabled while FUSE is disabled.
233
#ifdef CONFIG_DEBUG_PROVE_LOCKING
234
#if MAX_LOCKDEP_SUBCLASSES < AuLsc_I_End
235
#warning lockdep will not work since aufs uses deeper locks.
239
#ifdef CONFIG_AUFS_COMPAT
240
#warning CONFIG_AUFS_COMPAT will be removed in the near future.