2 * Copyright (C) 2005-2012 Junjiro R. 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
23 #include <linux/module.h>
24 #include <linux/seq_file.h>
27 void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp)
32 p = krealloc(p, new_sz, gfp);
34 memset(p + nused, 0, new_sz - nused);
38 /* ---------------------------------------------------------------------- */
43 struct kmem_cache *au_cachep[AuCache_Last];
44 static int __init au_cache_init(void)
46 au_cachep[AuCache_DINFO] = AuCacheCtor(au_dinfo, au_di_init_once);
47 if (au_cachep[AuCache_DINFO])
48 /* SLAB_DESTROY_BY_RCU */
49 au_cachep[AuCache_ICNTNR] = AuCacheCtor(au_icntnr,
51 if (au_cachep[AuCache_ICNTNR])
52 au_cachep[AuCache_FINFO] = AuCacheCtor(au_finfo,
54 if (au_cachep[AuCache_FINFO])
55 au_cachep[AuCache_VDIR] = AuCache(au_vdir);
56 if (au_cachep[AuCache_VDIR])
57 au_cachep[AuCache_DEHSTR] = AuCache(au_vdir_dehstr);
58 if (au_cachep[AuCache_DEHSTR])
64 static void au_cache_fin(void)
68 /* including AuCache_HNOTIFY */
69 for (i = 0; i < AuCache_Last; i++)
71 kmem_cache_destroy(au_cachep[i]);
76 /* ---------------------------------------------------------------------- */
80 #ifdef CONFIG_AUFS_SBILIST
82 * iterate_supers_type() doesn't protect us from
83 * remounting (branch management)
85 struct au_splhead au_sbilist;
88 struct lock_class_key au_lc_key[AuLcKey_Last];
91 * functions for module interface.
93 MODULE_LICENSE("GPL");
94 /* MODULE_LICENSE("GPL v2"); */
95 MODULE_AUTHOR("Junjiro R. Okajima <aufs-users@lists.sourceforge.net>");
96 MODULE_DESCRIPTION(AUFS_NAME
97 " -- Advanced multi layered unification filesystem");
98 MODULE_VERSION(AUFS_VERSION);
100 /* this module parameter has no meaning when SYSFS is disabled */
102 MODULE_PARM_DESC(brs, "use <sysfs>/fs/aufs/si_*/brN");
103 module_param_named(brs, sysaufs_brs, int, S_IRUGO);
105 /* ---------------------------------------------------------------------- */
107 static char au_esc_chars[0x20 + 3]; /* 0x01-0x20, backslash, del, and NULL */
109 int au_seq_path(struct seq_file *seq, struct path *path)
111 return seq_path(seq, path, au_esc_chars);
114 /* ---------------------------------------------------------------------- */
116 static int __init aufs_init(void)
122 for (i = 1; i <= ' '; i++)
128 au_dir_roflags = au_file_roflags(O_DIRECTORY | O_LARGEFILE);
134 err = sysaufs_init();
137 err = au_procfs_init();
143 err = au_loopback_init();
146 err = au_hnotify_init();
149 err = au_sysrq_init();
152 err = au_cache_init();
155 err = register_filesystem(&aufs_fs_type);
158 /* since we define pr_fmt, call printk directly */
159 printk(KERN_INFO AUFS_NAME " " AUFS_VERSION "\n");
160 goto out; /* success */
181 static void __exit aufs_exit(void)
183 unregister_filesystem(&aufs_fs_type);
194 module_init(aufs_init);
195 module_exit(aufs_exit);