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.2 2008/04/21 02:00:37 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, struct dentry *dentry, aufs_bindex_t bindex,
48
int au_wh_unlink_dentry(struct inode *h_dir, struct dentry *wh_dentry,
49
struct dentry *dentry, struct inode *dir, int dlgt);
52
int au_wh_init(struct dentry *h_parent, struct au_branch *br,
53
struct vfsmount *nfsmnt, struct super_block *sb);
56
#define AuDiropq_CREATE 1
57
#define AuDiropq_DLGT (1 << 1)
58
#define au_ftest_diropq(flags, name) ((flags) & AuDiropq_##name)
59
#define au_fset_diropq(flags, name) { (flags) |= AuDiropq_##name; }
60
#define au_fclr_diropq(flags, name) { (flags) &= ~AuDiropq_##name; }
61
#ifndef CONFIG_AUFS_DLGT
63
#define AuDiropq_DLGT 0
66
struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
69
struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
71
struct dentry *au_wh_create(struct inode *dir, struct dentry *dentry,
72
aufs_bindex_t bindex, struct dentry *h_parent,
75
/* real rmdir the whiteout-ed dir */
76
struct au_whtmp_rmdir_args {
77
struct dentry *h_dentry;
78
struct au_nhash whlist;
80
struct inode *dir, *inode;
85
int au_whtmp_rmdir(struct dentry *h_dentry, struct au_nhash *whlist,
86
aufs_bindex_t bindex, struct inode *dir, struct inode *inode,
88
void au_whtmp_kick_rmdir(struct dentry *h_dentry, struct au_nhash *whlist,
89
aufs_bindex_t bindex, struct inode *dir,
90
struct inode *inode, int noself,
91
struct au_whtmp_rmdir_args *args);
93
/* ---------------------------------------------------------------------- */
96
struct dentry *au_diropq_create(struct dentry *dentry, aufs_bindex_t bindex,
99
unsigned int flags = AuDiropq_CREATE;
101
au_fset_diropq(flags, DLGT);
102
return au_diropq_sio(dentry, bindex, flags);
106
int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex, int dlgt)
108
unsigned int flags = !AuDiropq_CREATE;
110
au_fset_diropq(flags, DLGT);
111
return PTR_ERR(au_diropq_sio(dentry, bindex, flags));
114
/* ---------------------------------------------------------------------- */
116
#ifdef CONFIG_AUFS_ROBR
118
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
119
struct qstr *wh_name, int try_sio, struct au_ndx *ndx);
120
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name);
123
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
124
struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
126
return au_wh_test(h_parent, wh_name, try_sio, ndx);
130
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
132
if (unlikely(!au_opt_test(au_mntflags(sb), SHWH)
133
&& !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
137
#endif /* CONFIG_AUFS_ROBR */
139
#endif /* __KERNEL__ */
140
#endif /* __AUFS_WHOUT_H__ */