16
16
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
/* $Id: dentry.h,v 1.25 2007/05/14 03:41:52 sfjro Exp $ */
19
/* $Id: dentry.h,v 1.37 2007/11/05 01:37:02 sfjro Exp $ */
21
21
#ifndef __AUFS_DENTRY_H__
22
22
#define __AUFS_DENTRY_H__
26
26
#include <linux/fs.h>
27
27
#include <linux/aufs_type.h>
31
/* nameidata open_intent */
38
struct aufs_hdintent {
39
struct list_head hdi_list;
40
struct file *hdi_file[AuIntent_Last];
30
43
struct aufs_hdentry {
31
struct dentry *hd_dentry;
44
struct dentry *hd_dentry;
46
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) \
47
&& !defined(AuNoNfsBranch)
48
spinlock_t hd_lock; /* intest_list */
49
struct list_head *hd_intent_list;
34
53
struct aufs_dinfo {
39
58
struct aufs_hdentry *di_hdentry;
61
/* nameidata extension */
43
63
struct vfsmount *nfsmnt;
45
//struct super_block *sb;
66
struct aufs_branch *br;
48
70
/* ---------------------------------------------------------------------- */
51
#if defined(CONFIG_AUFS_LHASH_PATCH) || defined(CONFIG_AUFS_DLGT)
52
struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
53
struct lkup_args *lkup);
56
struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
57
struct lkup_args *lkup)
59
return lookup_one_len(name, parent, len);
63
73
extern struct dentry_operations aufs_dop;
64
struct dentry *sio_lkup_one(const char *name, struct dentry *parent, int len,
65
struct lkup_args *lkup);
66
int lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type);
67
int lkup_neg(struct dentry *dentry, aufs_bindex_t bindex);
74
#if !defined(AuNoNfsBranch) || defined(CONFIG_AUFS_DLGT)
75
struct dentry *au_lkup_one(const char *name, struct dentry *parent, int len,
76
struct aufs_ndx *ndx);
79
struct dentry *au_lkup_one(const char *name, struct dentry *parent, int len,
82
//todo: ndx->nd_file = NULL;
83
return vfsub_lookup_one_len(name, parent, len);
86
struct dentry *au_sio_lkup_one(const char *name, struct dentry *parent, int len,
87
struct aufs_ndx *ndx);
88
int au_lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type,
89
struct nameidata *nd);
90
int au_lkup_neg(struct dentry *dentry, aufs_bindex_t bindex);
68
91
int au_refresh_hdentry(struct dentry *dentry, mode_t type);
69
int au_reval_dpath(struct dentry *dentry, int sgen);
92
int au_reval_dpath(struct dentry *dentry, au_gen_t sgen);
72
95
int au_alloc_dinfo(struct dentry *dentry);
100
123
void set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
101
124
struct dentry *h_dentry);
126
static inline void au_do_h_dentry_init(struct aufs_hdentry *hdentry)
128
hdentry->hd_dentry = NULL;
131
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) \
132
&& !defined(AuNoNfsBranch)
133
static inline void au_h_dentry_init(struct aufs_hdentry *hdentry)
135
au_do_h_dentry_init(hdentry);
136
spin_lock_init(&hdentry->hd_lock);
139
static inline void au_h_dentry_init_all(struct aufs_hdentry *hdentry, int n)
142
spin_lock_init(&hdentry[n].hd_lock);
145
int au_set_h_intent(struct dentry *dentry, aufs_bindex_t bindex,
146
struct file *file, struct file *h_file);
147
struct file *au_h_intent(struct dentry *dentry, aufs_bindex_t bindex,
151
struct file *au_h_intent(struct dentry *dentry, aufs_bindex_t bindex,
154
return ERR_PTR(-ENOSYS);
157
static inline void au_h_dentry_init(struct aufs_hdentry *hdentry)
159
au_do_h_dentry_init(hdentry);
162
static inline void au_h_dentry_init_all(struct aufs_hdentry *hdentry, int n)
103
168
void au_update_digen(struct dentry *dentry);
169
void au_update_dbrange(struct dentry *dentry, int do_put_zero);
104
170
void au_update_dbstart(struct dentry *dentry);
171
void au_update_dbend(struct dentry *dentry);
105
172
int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry);
107
174
/* ---------------------------------------------------------------------- */
109
static inline int au_digen(struct dentry *d)
176
static inline au_gen_t au_digen(struct dentry *d)
111
178
return atomic_read(&dtodi(d)->di_generation);
114
181
#ifdef CONFIG_AUFS_HINOTIFY
115
static inline void au_digen_dec(struct dentry *d)
182
static inline au_gen_t au_digen_dec(struct dentry *d)
117
atomic_dec(&dtodi(d)->di_generation);
184
return atomic_dec_return(&dtodi(d)->di_generation);
119
186
#endif /* CONFIG_AUFS_HINOTIFY */
141
208
#define ReadLockFunc(name, lsc) \
142
209
static inline void di_read_lock_##name(struct dentry *d, int flags) \
143
{di_read_lock(d, flags, AuLsc_DI_##lsc);}
210
{ di_read_lock(d, flags, AuLsc_DI_##lsc); }
145
212
#define WriteLockFunc(name, lsc) \
146
213
static inline void di_write_lock_##name(struct dentry *d) \
147
{di_write_lock(d, AuLsc_DI_##lsc);}
214
{ di_write_lock(d, AuLsc_DI_##lsc); }
149
216
#define RWLockFuncs(name, lsc) \
150
ReadLockFunc(name, lsc); \
217
ReadLockFunc(name, lsc) \
151
218
WriteLockFunc(name, lsc)
153
220
RWLockFuncs(child, CHILD);