be25a13462115892c7676b243959dae43f5ec73a
[linux-flexiantxendom0-natty.git] / ubuntu / aufs / dcsub.h
1 /*
2  * Copyright (C) 2005-2010 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  * sub-routines for dentry cache
21  */
22
23 #ifndef __AUFS_DCSUB_H__
24 #define __AUFS_DCSUB_H__
25
26 #ifdef __KERNEL__
27
28 #include <linux/dcache.h>
29 #include <linux/types.h>
30
31 struct dentry;
32
33 struct au_dpage {
34         int ndentry;
35         struct dentry **dentries;
36 };
37
38 struct au_dcsub_pages {
39         int ndpage;
40         struct au_dpage *dpages;
41 };
42
43 /* ---------------------------------------------------------------------- */
44
45 /* dcsub.c */
46 int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp);
47 void au_dpages_free(struct au_dcsub_pages *dpages);
48 typedef int (*au_dpages_test)(struct dentry *dentry, void *arg);
49 int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root,
50                    au_dpages_test test, void *arg);
51 int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry,
52                        int do_include, au_dpages_test test, void *arg);
53 int au_test_subdir(struct dentry *d1, struct dentry *d2);
54
55 /* ---------------------------------------------------------------------- */
56
57 static inline int au_d_removed(struct dentry *d)
58 {
59         return !IS_ROOT(d) && d_unhashed(d);
60 }
61
62 #endif /* __KERNEL__ */
63 #endif /* __AUFS_DCSUB_H__ */