2
* Copyright (C) 2005, 2006, 2007 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
19
/* $Id: dentry.h,v 1.24 2007/05/07 03:43:36 sfjro Exp $ */
21
#ifndef __AUFS_DENTRY_H__
22
#define __AUFS_DENTRY_H__
25
#include <linux/aufs_type.h>
31
struct dentry *hd_dentry;
35
atomic_t di_generation;
37
struct aufs_rwsem di_rwsem;
38
aufs_bindex_t di_bstart, di_bend, di_bwh, di_bdiropq;
39
struct aufs_hdentry *di_hdentry;
43
struct vfsmount *nfsmnt;
45
//struct super_block *sb;
48
/* ---------------------------------------------------------------------- */
50
#if defined(CONFIG_AUFS_LHASH_PATCH) || defined(CONFIG_AUFS_DLGT)
51
struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
52
struct lkup_args *lkup);
55
struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
56
struct lkup_args *lkup)
58
return lookup_one_len(name, parent, len);
62
extern struct dentry_operations aufs_dop;
63
struct dentry *sio_lkup_one(const char *name, struct dentry *parent, int len,
64
struct lkup_args *lkup);
65
int lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type);
66
int lkup_neg(struct dentry *dentry, aufs_bindex_t bindex);
67
int au_refresh_hdentry(struct dentry *dentry, mode_t type);
68
int au_reval_dpath(struct dentry *dentry, int sgen);
71
int au_alloc_dinfo(struct dentry *dentry);
72
struct aufs_dinfo *dtodi(struct dentry *dentry);
74
void di_read_lock(struct dentry *d, int flags, unsigned int lsc);
75
void di_read_unlock(struct dentry *d, int flags);
76
void di_downgrade_lock(struct dentry *d, int flags);
77
void di_write_lock(struct dentry *d, unsigned int lsc);
78
void di_write_unlock(struct dentry *d);
79
void di_write_lock2_child(struct dentry *d1, struct dentry *d2, int isdir);
80
void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir);
81
void di_write_unlock2(struct dentry *d1, struct dentry *d2);
83
aufs_bindex_t dbstart(struct dentry *dentry);
84
aufs_bindex_t dbend(struct dentry *dentry);
85
aufs_bindex_t dbwh(struct dentry *dentry);
86
aufs_bindex_t dbdiropq(struct dentry *dentry);
87
struct dentry *au_h_dptr_i(struct dentry *dentry, aufs_bindex_t bindex);
88
struct dentry *au_h_dptr(struct dentry *dentry);
90
aufs_bindex_t dbtail(struct dentry *dentry);
91
aufs_bindex_t dbtaildir(struct dentry *dentry);
92
aufs_bindex_t dbtail_generic(struct dentry *dentry);
94
void set_dbstart(struct dentry *dentry, aufs_bindex_t bindex);
95
void set_dbend(struct dentry *dentry, aufs_bindex_t bindex);
96
void set_dbwh(struct dentry *dentry, aufs_bindex_t bindex);
97
void set_dbdiropq(struct dentry *dentry, aufs_bindex_t bindex);
98
void hdput(struct aufs_hdentry *hdentry);
99
void set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
100
struct dentry *h_dentry);
102
void au_update_digen(struct dentry *dentry);
103
void au_update_dbstart(struct dentry *dentry);
104
int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry);
106
/* ---------------------------------------------------------------------- */
108
static inline int au_digen(struct dentry *d)
110
return atomic_read(&dtodi(d)->di_generation);
113
#ifdef CONFIG_AUFS_HINOTIFY
114
static inline void au_digen_dec(struct dentry *d)
116
atomic_dec(&dtodi(d)->di_generation);
118
#endif /* CONFIG_AUFS_HINOTIFY */
120
/* ---------------------------------------------------------------------- */
125
AuLsc_DI_CHILD, /* child first */
126
AuLsc_DI_CHILD2, /* rename(2), link(2), and cpup at hinotify */
127
AuLsc_DI_CHILD3, /* copyup dirs */
133
#define ReadLockFunc(name, lsc) \
134
static inline void di_read_lock_##name(struct dentry *d, int flags) \
135
{di_read_lock(d, flags, AuLsc_DI_##lsc);}
137
#define WriteLockFunc(name, lsc) \
138
static inline void di_write_lock_##name(struct dentry *d) \
139
{di_write_lock(d, AuLsc_DI_##lsc);}
141
#define RWLockFuncs(name, lsc) \
142
ReadLockFunc(name, lsc); \
143
WriteLockFunc(name, lsc)
145
RWLockFuncs(child, CHILD);
146
RWLockFuncs(child2, CHILD2);
147
RWLockFuncs(child3, CHILD3);
148
RWLockFuncs(parent, PARENT);
149
RWLockFuncs(parent2, PARENT2);
150
RWLockFuncs(parent3, PARENT3);
156
#define DiMustReadLock(d) do { \
157
SiMustAnyLock((d)->d_sb); \
158
RwMustReadLock(&dtodi(d)->di_rwsem); \
161
#define DiMustWriteLock(d) do { \
162
SiMustAnyLock((d)->d_sb); \
163
RwMustWriteLock(&dtodi(d)->di_rwsem); \
166
#define DiMustAnyLock(d) do { \
167
SiMustAnyLock((d)->d_sb); \
168
RwMustAnyLock(&dtodi(d)->di_rwsem); \
171
#define DiMustNoWaiters(d) RwMustNoWaiters(&dtodi(d)->di_rwsem)
173
#endif /* __KERNEL__ */
174
#endif /* __AUFS_DENTRY_H__ */