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