Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / fs / aufs / dynop.h
1 /*
2  * Copyright (C) 2010-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  * dynamically customizable operations (for regular files only)
21  */
22
23 #ifndef __AUFS_DYNOP_H__
24 #define __AUFS_DYNOP_H__
25
26 #ifdef __KERNEL__
27
28 #include "inode.h"
29
30 enum {AuDy_AOP, AuDyLast};
31
32 struct au_dynop {
33         int                                             dy_type;
34         union {
35                 const void                              *dy_hop;
36                 const struct address_space_operations   *dy_haop;
37         };
38 };
39
40 struct au_dykey {
41         union {
42                 struct list_head        dk_list;
43                 struct rcu_head         dk_rcu;
44         };
45         struct au_dynop         dk_op;
46
47         /*
48          * during I am in the branch local array, kref is gotten. when the
49          * branch is removed, kref is put.
50          */
51         struct kref             dk_kref;
52 };
53
54 /* stop unioning since their sizes are very different from each other */
55 struct au_dyaop {
56         struct au_dykey                 da_key;
57         struct address_space_operations da_op; /* not const */
58         int (*da_get_xip_mem)(struct address_space *, pgoff_t, int,
59                               void **, unsigned long *);
60 };
61
62 /* ---------------------------------------------------------------------- */
63
64 /* dynop.c */
65 struct au_branch;
66 void au_dy_put(struct au_dykey *key);
67 int au_dy_iaop(struct inode *inode, aufs_bindex_t bindex,
68                 struct inode *h_inode);
69 int au_dy_irefresh(struct inode *inode);
70 void au_dy_arefresh(int do_dio);
71
72 void __init au_dy_init(void);
73 void au_dy_fin(void);
74
75 #endif /* __KERNEL__ */
76 #endif /* __AUFS_DYNOP_H__ */