2
* Copyright (C) 2005-2008 Junjiro 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
22
* $Id: whout.h,v 1.3 2008/06/30 03:57:35 sfjro Exp $
25
#ifndef __AUFS_WHOUT_H__
26
#define __AUFS_WHOUT_H__
31
#include <linux/aufs_type.h>
36
int au_wh_name_alloc(const char *name, int len, struct qstr *wh);
37
void au_wh_name_free(struct qstr *wh);
40
int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio,
42
int au_diropq_test(struct dentry *h_dentry, struct au_ndx *ndx);
44
struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct qstr *prefix,
46
int au_whtmp_ren(struct inode *dir, aufs_bindex_t bindex,
47
struct dentry *h_dentry);
48
int au_wh_unlink_dentry(struct au_hinode *dir, struct dentry *wh_dentry,
49
struct dentry *dentry, int dlgt);
52
int au_wh_init(struct dentry *h_parent, struct au_branch *br,
53
struct vfsmount *nfsmnt, struct super_block *sb,
54
aufs_bindex_t bindex);
57
#define AuDiropq_CREATE 1
58
#define AuDiropq_DLGT (1 << 1)
59
#define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name)
60
#define au_fset_diropq(flags, name) { (flags) |= AuDiropq_##name; }
61
#define au_fclr_diropq(flags, name) { (flags) &= ~AuDiropq_##name; }
62
#ifndef CONFIG_AUFS_DLGT
64
#define AuDiropq_DLGT 0
67
struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
70
struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
72
struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex,
73
struct dentry *h_parent, struct au_ndx *ndx);
75
/* real rmdir the whiteout-ed dir */
76
struct au_whtmp_rmdir_args {
79
struct dentry *wh_dentry;
80
struct au_nhash whlist;
84
int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex,
85
struct dentry *wh_dentry, struct au_nhash *whlist);
86
void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex,
87
struct dentry *wh_dentry, struct au_nhash *whlist,
88
struct au_whtmp_rmdir_args *args);
90
/* ---------------------------------------------------------------------- */
93
struct dentry *au_diropq_create(struct dentry *dentry, aufs_bindex_t bindex,
96
unsigned int flags = AuDiropq_CREATE;
98
au_fset_diropq(flags, DLGT);
99
return au_diropq_sio(dentry, bindex, flags);
103
int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex, int dlgt)
105
unsigned int flags = !AuDiropq_CREATE;
107
au_fset_diropq(flags, DLGT);
108
return PTR_ERR(au_diropq_sio(dentry, bindex, flags));
111
/* ---------------------------------------------------------------------- */
113
#ifdef CONFIG_AUFS_ROBR
115
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
116
struct qstr *wh_name, int try_sio, struct au_ndx *ndx);
117
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name);
120
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
121
struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
123
return au_wh_test(h_parent, wh_name, try_sio, ndx);
127
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
129
if (unlikely(!au_opt_test(au_mntflags(sb), SHWH)
130
&& !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
134
#endif /* CONFIG_AUFS_ROBR */
136
#endif /* __KERNEL__ */
137
#endif /* __AUFS_WHOUT_H__ */