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 * whiteout for logical deletion and opaque directory
23 #ifndef __AUFS_WHOUT_H__
24 #define __AUFS_WHOUT_H__
31 int au_wh_name_alloc(struct qstr *wh, const struct qstr *name);
33 int au_wh_test(struct dentry *h_parent, struct qstr *wh_name,
34 struct au_branch *br, int try_sio);
35 int au_diropq_test(struct dentry *h_dentry, struct au_branch *br);
36 struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct au_branch *br,
38 int au_whtmp_ren(struct dentry *h_dentry, struct au_branch *br);
39 int au_wh_unlink_dentry(struct inode *h_dir, struct path *h_path,
40 struct dentry *dentry);
41 int au_wh_init(struct au_branch *br, struct super_block *sb);
44 #define AuDiropq_CREATE 1
45 #define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name)
46 #define au_fset_diropq(flags, name) \
47 do { (flags) |= AuDiropq_##name; } while (0)
48 #define au_fclr_diropq(flags, name) \
49 do { (flags) &= ~AuDiropq_##name; } while (0)
51 struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
53 struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
54 struct au_branch *br);
55 struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex,
56 struct dentry *h_parent);
58 /* real rmdir for the whiteout-ed dir */
59 struct au_whtmp_rmdir {
62 struct dentry *wh_dentry;
63 struct au_nhash whlist;
66 struct au_whtmp_rmdir *au_whtmp_rmdir_alloc(struct super_block *sb, gfp_t gfp);
67 void au_whtmp_rmdir_free(struct au_whtmp_rmdir *whtmp);
68 int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex,
69 struct dentry *wh_dentry, struct au_nhash *whlist);
70 void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex,
71 struct dentry *wh_dentry, struct au_whtmp_rmdir *args);
73 /* ---------------------------------------------------------------------- */
75 static inline struct dentry *au_diropq_create(struct dentry *dentry,
78 return au_diropq_sio(dentry, bindex, AuDiropq_CREATE);
81 static inline int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex)
83 return PTR_ERR(au_diropq_sio(dentry, bindex, !AuDiropq_CREATE));
86 #endif /* __KERNEL__ */
87 #endif /* __AUFS_WHOUT_H__ */