cpup.h 2.14 KB
Newer Older
J. R. Okajima's avatar
J. R. Okajima committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2005-2019 Junjiro R. Okajima
 */

/*
 * copy-up/down functions
 */

#ifndef __AUFS_CPUP_H__
#define __AUFS_CPUP_H__

#ifdef __KERNEL__

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

J. R. Okajima's avatar
J. R. Okajima committed
17
struct inode;
J. R. Okajima's avatar
J. R. Okajima committed
18
struct file;
J. R. Okajima's avatar
J. R. Okajima committed
19
struct au_pin;
J. R. Okajima's avatar
J. R. Okajima committed
20

J. R. Okajima's avatar
J. R. Okajima committed
21
22
23
24
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
25
void au_cpup_igen(struct inode *inode, struct inode *h_inode);
J. R. Okajima's avatar
J. R. Okajima committed
26
27
28
29
void au_cpup_attr_all(struct inode *inode, int force);

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

J. R. Okajima's avatar
J. R. Okajima committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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 */

#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);
51
int au_sio_cpup_simple(struct au_cp_generic *cpg);
J. R. Okajima's avatar
J. R. Okajima committed
52
int au_sio_cpup_wh(struct au_cp_generic *cpg, struct file *file);
J. R. Okajima's avatar
J. R. Okajima committed
53

J. R. Okajima's avatar
J. R. Okajima committed
54
55
56
57
58
59
60
61
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
62
63
/* ---------------------------------------------------------------------- */

J. R. Okajima's avatar
J. R. Okajima committed
64
65
66
67
68
69
70
71
72
/* 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
73
74
75

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