2 * Copyright (C) 2005-2013 Junjiro R. Okajima
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.
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.
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
20 * copy-up/down functions
23 #ifndef __AUFS_CPUP_H__
24 #define __AUFS_CPUP_H__
28 #include <linux/path.h>
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);
41 /* ---------------------------------------------------------------------- */
43 struct au_cp_generic {
44 struct dentry *dentry;
45 aufs_bindex_t bdst, bsrc;
52 #define AuCpup_DTIME 1 /* do dtime_store/revert */
53 #define AuCpup_KEEPLINO (1 << 1) /* do not clear the lower xino,
55 #define AuCpup_RENAME (1 << 2) /* rename after cpup */
56 #define AuCpup_HOPEN (1 << 3) /* call h_open_pre/post() in cpup */
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)
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);
68 int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst,
69 int (*cp)(struct dentry *dentry, aufs_bindex_t bdst,
71 struct dentry *h_parent, 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);
76 /* ---------------------------------------------------------------------- */
78 /* keep timestamps when copyup */
80 struct dentry *dt_dentry;
81 struct path dt_h_path;
82 struct timespec dt_atime, dt_mtime;
84 void au_dtime_store(struct au_dtime *dt, struct dentry *dentry,
86 void au_dtime_revert(struct au_dtime *dt);
88 #endif /* __KERNEL__ */
89 #endif /* __AUFS_CPUP_H__ */