]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - fs/aufs/whout.h
eb4b1823bd4977c4bfc5ea01c7104c3484c77955
[mirror_ubuntu-bionic-kernel.git] / fs / aufs / whout.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 * whiteout for logical deletion and opaque directory
20 */
21
22 #ifndef __AUFS_WHOUT_H__
23 #define __AUFS_WHOUT_H__
24
25 #ifdef __KERNEL__
26
27 #include "dir.h"
28
29 /* whout.c */
30 int au_wh_name_alloc(struct qstr *wh, const struct qstr *name);
31 int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio);
32 int au_diropq_test(struct dentry *h_dentry);
33 struct au_branch;
34 struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br,
35 struct qstr *prefix);
36 int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br);
37 int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path,
38 struct dentry *dentry);
39 int au_wh_init(struct au_branch *br, struct super_block *sb);
40
41 /* diropq flags */
42 #define AuDiropq_CREATE 1
43 #define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name)
44 #define au_fset_diropq(flags, name) \
45 do { (flags) |= AuDiropq_##name; } while (0)
46 #define au_fclr_diropq(flags, name) \
47 do { (flags) &= ~AuDiropq_##name; } while (0)
48
49 struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
50 unsigned int flags);
51 struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
52 struct au_branch *br);
53 struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex,
54 struct dentry *h_parent);
55
56 /* real rmdir for the whiteout-ed dir */
57 struct au_whtmp_rmdir {
58 struct inode *dir;
59 struct au_branch *br;
60 struct dentry *wh_dentry;
61 struct au_nhash whlist;
62 };
63
64 struct au_whtmp_rmdir *au_whtmp_rmdir_alloc(struct super_block *sb, gfp_t gfp);
65 void au_whtmp_rmdir_free(struct au_whtmp_rmdir *whtmp);
66 int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex,
67 struct dentry *wh_dentry, struct au_nhash *whlist);
68 void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex,
69 struct dentry *wh_dentry, struct au_whtmp_rmdir *args);
70
71 /* ---------------------------------------------------------------------- */
72
73 static inline struct dentry *au_diropq_create(struct dentry *dentry,
74 aufs_bindex_t bindex)
75 {
76 return au_diropq_sio(dentry, bindex, AuDiropq_CREATE);
77 }
78
79 static inline int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex)
80 {
81 return PTR_ERR(au_diropq_sio(dentry, bindex, !AuDiropq_CREATE));
82 }
83
84 #endif /* __KERNEL__ */
85 #endif /* __AUFS_WHOUT_H__ */