pandora: defconfig: update
[pandora-kernel.git] / fs / aufs / cpup.h
1 /*
2  * Copyright (C) 2005-2013 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  * copy-up/down functions
21  */
22
23 #ifndef __AUFS_CPUP_H__
24 #define __AUFS_CPUP_H__
25
26 #ifdef __KERNEL__
27
28 #include <linux/path.h>
29
30 struct inode;
31 struct file;
32 struct au_pin;
33
34 void au_cpup_attr_flags(struct inode *dst, unsigned int iflags);
35 void au_cpup_attr_timesizes(struct inode *inode);
36 void au_cpup_attr_nlink(struct inode *inode, int force);
37 void au_cpup_attr_changeable(struct inode *inode);
38 void au_cpup_igen(struct inode *inode, struct inode *h_inode);
39 void au_cpup_attr_all(struct inode *inode, int force);
40
41 /* ---------------------------------------------------------------------- */
42
43 struct au_cp_generic {
44         struct dentry   *dentry;
45         aufs_bindex_t   bdst, bsrc;
46         loff_t          len;
47         struct au_pin   *pin;
48         unsigned int    flags;
49 };
50
51 /* cpup flags */
52 #define AuCpup_DTIME    1               /* do dtime_store/revert */
53 #define AuCpup_KEEPLINO (1 << 1)        /* do not clear the lower xino,
54                                            for link(2) */
55 #define AuCpup_RENAME   (1 << 2)        /* rename after cpup */
56 #define AuCpup_HOPEN    (1 << 3)        /* call h_open_pre/post() in cpup */
57
58 #define au_ftest_cpup(flags, name)      ((flags) & AuCpup_##name)
59 #define au_fset_cpup(flags, name) \
60         do { (flags) |= AuCpup_##name; } while (0)
61 #define au_fclr_cpup(flags, name) \
62         do { (flags) &= ~AuCpup_##name; } while (0)
63
64 int au_copy_file(struct file *dst, struct file *src, loff_t len);
65 int au_sio_cpup_simple(struct au_cp_generic *cpg);
66 int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file);
67
68 int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst,
69                int (*cp)(struct dentry *dentry, aufs_bindex_t bdst,
70                          struct au_pin *pin,
71                          struct dentry *h_parent, void *arg),
72                void *arg);
73 int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst);
74 int au_test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst);
75
76 /* ---------------------------------------------------------------------- */
77
78 /* keep timestamps when copyup */
79 struct au_dtime {
80         struct dentry *dt_dentry;
81         struct path dt_h_path;
82         struct timespec dt_atime, dt_mtime;
83 };
84 void au_dtime_store(struct au_dtime *dt, struct dentry *dentry,
85                     struct path *h_path);
86 void au_dtime_revert(struct au_dtime *dt);
87
88 #endif /* __KERNEL__ */
89 #endif /* __AUFS_CPUP_H__ */