cpup.h 3.17 KB
Newer Older
J. R. Okajima's avatar
J. R. Okajima committed
1
2
/* SPDX-License-Identifier: GPL-2.0 */
/*
3
 * Copyright (C) 2005-2020 Junjiro R. Okajima
4
5
6
7
8
9
10
11
12
13
14
15
16
 *
 * This program, aufs is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
J. R. Okajima's avatar
J. R. Okajima committed
17
18
19
20
21
22
23
24
25
26
27
 */

/*
 * copy-up/down functions
 */

#ifndef __AUFS_CPUP_H__
#define __AUFS_CPUP_H__

#ifdef __KERNEL__

J. R. Okajima's avatar
J. R. Okajima committed
28
29
#include <linux/path.h>

J. R. Okajima's avatar
J. R. Okajima committed
30
struct inode;
J. R. Okajima's avatar
J. R. Okajima committed
31
struct file;
J. R. Okajima's avatar
J. R. Okajima committed
32
struct au_pin;
J. R. Okajima's avatar
J. R. Okajima committed
33

J. R. Okajima's avatar
J. R. Okajima committed
34
35
36
37
void au_cpup_attr_flags(struct inode *dst, unsigned int iflags);
void au_cpup_attr_timesizes(struct inode *inode);
void au_cpup_attr_nlink(struct inode *inode, int force);
void au_cpup_attr_changeable(struct inode *inode);
J. R. Okajima's avatar
J. R. Okajima committed
38
void au_cpup_igen(struct inode *inode, struct inode *h_inode);
J. R. Okajima's avatar
J. R. Okajima committed
39
40
41
42
void au_cpup_attr_all(struct inode *inode, int force);

/* ---------------------------------------------------------------------- */

J. R. Okajima's avatar
J. R. Okajima committed
43
44
45
46
47
48
49
50
51
52
53
54
55
struct au_cp_generic {
	struct dentry	*dentry;
	aufs_bindex_t	bdst, bsrc;
	loff_t		len;
	struct au_pin	*pin;
	unsigned int	flags;
};

/* cpup flags */
#define AuCpup_DTIME		1		/* do dtime_store/revert */
#define AuCpup_KEEPLINO		(1 << 1)	/* do not clear the lower xino,
						   for link(2) */
#define AuCpup_RENAME		(1 << 2)	/* rename after cpup */
J. R. Okajima's avatar
J. R. Okajima committed
56
57
#define AuCpup_HOPEN		(1 << 3)	/* call h_open_pre/post() in
						   cpup */
J. R. Okajima's avatar
J. R. Okajima committed
58
59
60
61
#define AuCpup_OVERWRITE	(1 << 4)	/* allow overwriting the
						   existing entry */
#define AuCpup_RWDST		(1 << 5)	/* force write target even if
						   the branch is marked as RO */
J. R. Okajima's avatar
J. R. Okajima committed
62

J. R. Okajima's avatar
J. R. Okajima committed
63
64
65
66
67
#ifndef CONFIG_AUFS_BR_HFSPLUS
#undef AuCpup_HOPEN
#define AuCpup_HOPEN		0
#endif

J. R. Okajima's avatar
J. R. Okajima committed
68
69
70
71
72
73
74
#define au_ftest_cpup(flags, name)	((flags) & AuCpup_##name)
#define au_fset_cpup(flags, name) \
	do { (flags) |= AuCpup_##name; } while (0)
#define au_fclr_cpup(flags, name) \
	do { (flags) &= ~AuCpup_##name; } while (0)

int au_copy_file(struct file *dst, struct file *src, loff_t len);
75
int au_sio_cpup_simple(struct au_cp_generic *cpg);
J. R. Okajima's avatar
J. R. Okajima committed
76
int au_sio_cpdown_simple(struct au_cp_generic *cpg);
J. R. Okajima's avatar
J. R. Okajima committed
77
int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file);
J. R. Okajima's avatar
J. R. Okajima committed
78

J. R. Okajima's avatar
J. R. Okajima committed
79
80
81
82
83
84
85
86
int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst,
	       int (*cp)(struct dentry *dentry, aufs_bindex_t bdst,
			 struct au_pin *pin,
			 struct dentry *h_parent, void *arg),
	       void *arg);
int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst);
int au_test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst);

J. R. Okajima's avatar
J. R. Okajima committed
87
88
/* ---------------------------------------------------------------------- */

J. R. Okajima's avatar
J. R. Okajima committed
89
90
91
92
93
94
95
96
97
/* keep timestamps when copyup */
struct au_dtime {
	struct dentry *dt_dentry;
	struct path dt_h_path;
	struct timespec64 dt_atime, dt_mtime;
};
void au_dtime_store(struct au_dtime *dt, struct dentry *dentry,
		    struct path *h_path);
void au_dtime_revert(struct au_dtime *dt);
J. R. Okajima's avatar
J. R. Okajima committed
98
99
100

#endif /* __KERNEL__ */
#endif /* __AUFS_CPUP_H__ */