Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / fs / aufs / module.h
1 /*
2  * Copyright (C) 2005-2012 Junjiro R. Okajima
3  *
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.
8  *
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.
13  *
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
17  */
18
19 /*
20  * module initialization and module-global
21  */
22
23 #ifndef __AUFS_MODULE_H__
24 #define __AUFS_MODULE_H__
25
26 #ifdef __KERNEL__
27
28 #include <linux/slab.h>
29
30 struct path;
31 struct seq_file;
32
33 /* module parameters */
34 extern int sysaufs_brs;
35
36 /* ---------------------------------------------------------------------- */
37
38 extern int au_dir_roflags;
39
40 enum {
41         AuLcNonDir_FIINFO,
42         AuLcNonDir_DIINFO,
43         AuLcNonDir_IIINFO,
44
45         AuLcDir_FIINFO,
46         AuLcDir_DIINFO,
47         AuLcDir_IIINFO,
48
49         AuLcSymlink_DIINFO,
50         AuLcSymlink_IIINFO,
51
52         AuLcKey_Last
53 };
54 extern struct lock_class_key au_lc_key[AuLcKey_Last];
55
56 void *au_kzrealloc(void *p, unsigned int nused, unsigned int new_sz, gfp_t gfp);
57 int au_seq_path(struct seq_file *seq, struct path *path);
58
59 #ifdef CONFIG_PROC_FS
60 /* procfs.c */
61 int __init au_procfs_init(void);
62 void au_procfs_fin(void);
63 #else
64 AuStubInt0(au_procfs_init, void);
65 AuStubVoid(au_procfs_fin, void);
66 #endif
67
68 /* ---------------------------------------------------------------------- */
69
70 /* kmem cache */
71 enum {
72         AuCache_DINFO,
73         AuCache_ICNTNR,
74         AuCache_FINFO,
75         AuCache_VDIR,
76         AuCache_DEHSTR,
77 #ifdef CONFIG_AUFS_HNOTIFY
78         AuCache_HNOTIFY,
79 #endif
80         AuCache_Last
81 };
82
83 #define AuCacheFlags            (SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD)
84 #define AuCache(type)           KMEM_CACHE(type, AuCacheFlags)
85 #define AuCacheCtor(type, ctor) \
86         kmem_cache_create(#type, sizeof(struct type), \
87                           __alignof__(struct type), AuCacheFlags, ctor)
88
89 extern struct kmem_cache *au_cachep[];
90
91 #define AuCacheFuncs(name, index) \
92 static inline struct au_##name *au_cache_alloc_##name(void) \
93 { return kmem_cache_alloc(au_cachep[AuCache_##index], GFP_NOFS); } \
94 static inline void au_cache_free_##name(struct au_##name *p) \
95 { kmem_cache_free(au_cachep[AuCache_##index], p); }
96
97 AuCacheFuncs(dinfo, DINFO);
98 AuCacheFuncs(icntnr, ICNTNR);
99 AuCacheFuncs(finfo, FINFO);
100 AuCacheFuncs(vdir, VDIR);
101 AuCacheFuncs(vdir_dehstr, DEHSTR);
102 #ifdef CONFIG_AUFS_HNOTIFY
103 AuCacheFuncs(hnotify, HNOTIFY);
104 #endif
105
106 #endif /* __KERNEL__ */
107 #endif /* __AUFS_MODULE_H__ */