~ubuntu-branches/ubuntu/vivid/aufs/vivid

« back to all changes in this revision

Viewing changes to fs/aufs/dentry.h

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2007-12-15 23:32:51 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071215233251-2vgs2lmg8mai5d9e
Tags: 0+20071211-1ubuntu1
* Merge from debian unstable (LP: #175705), remaining changes:
  - Fix for Ubuntu Kernels (updated)
* patches/01_vserver.dpatch: Removed
* patches/06_ubuntu.dpatch: Added (update of ubuntu patch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
17
 */
18
18
 
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 $ */
20
20
 
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>
28
28
#include "misc.h"
 
29
#include "vfsub.h"
 
30
 
 
31
/* nameidata open_intent */
 
32
enum {
 
33
        AuIntent_AUFS,
 
34
        AuIntent_BRANCH,
 
35
        AuIntent_Last
 
36
};
 
37
 
 
38
struct aufs_hdintent {
 
39
        struct list_head        hdi_list;
 
40
        struct file             *hdi_file[AuIntent_Last];
 
41
};
29
42
 
30
43
struct aufs_hdentry {
31
 
        struct dentry   *hd_dentry;
 
44
        struct dentry           *hd_dentry;
 
45
 
 
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;
 
50
#endif
32
51
};
33
52
 
34
53
struct aufs_dinfo {
39
58
        struct aufs_hdentry     *di_hdentry;
40
59
};
41
60
 
42
 
struct lkup_args {
 
61
/* nameidata extension */
 
62
struct aufs_ndx {
43
63
        struct vfsmount *nfsmnt;
44
64
        int dlgt;
45
 
        //struct super_block *sb;
 
65
        struct nameidata *nd;
 
66
        struct aufs_branch *br;
 
67
        struct file *nd_file;
46
68
};
47
69
 
48
70
/* ---------------------------------------------------------------------- */
49
71
 
50
72
/* dentry.c */
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);
54
 
#else
55
 
static inline
56
 
struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
57
 
                        struct lkup_args *lkup)
58
 
{
59
 
        return lookup_one_len(name, parent, len);
60
 
}
61
 
#endif
62
 
 
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);
 
77
#else
 
78
static inline
 
79
struct dentry *au_lkup_one(const char *name, struct dentry *parent, int len,
 
80
                           struct aufs_ndx *ndx)
 
81
{
 
82
        //todo: ndx->nd_file = NULL;
 
83
        return vfsub_lookup_one_len(name, parent, len);
 
84
}
 
85
#endif
 
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);
70
93
 
71
94
/* dinfo.c */
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);
102
125
 
 
126
static inline void au_do_h_dentry_init(struct aufs_hdentry *hdentry)
 
127
{
 
128
        hdentry->hd_dentry = NULL;
 
129
}
 
130
 
 
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)
 
134
{
 
135
        au_do_h_dentry_init(hdentry);
 
136
        spin_lock_init(&hdentry->hd_lock);
 
137
}
 
138
 
 
139
static inline void au_h_dentry_init_all(struct aufs_hdentry *hdentry, int n)
 
140
{
 
141
        while (n--)
 
142
                spin_lock_init(&hdentry[n].hd_lock);
 
143
}
 
144
 
 
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,
 
148
                         struct file *file);
 
149
#else
 
150
static inline
 
151
struct file *au_h_intent(struct dentry *dentry, aufs_bindex_t bindex,
 
152
                         struct file *file)
 
153
{
 
154
        return ERR_PTR(-ENOSYS);
 
155
}
 
156
 
 
157
static inline void au_h_dentry_init(struct aufs_hdentry *hdentry)
 
158
{
 
159
        au_do_h_dentry_init(hdentry);
 
160
}
 
161
 
 
162
static inline void au_h_dentry_init_all(struct aufs_hdentry *hdentry, int n)
 
163
{
 
164
        /* nothing */
 
165
}
 
166
#endif
 
167
 
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);
106
173
 
107
174
/* ---------------------------------------------------------------------- */
108
175
 
109
 
static inline int au_digen(struct dentry *d)
 
176
static inline au_gen_t au_digen(struct dentry *d)
110
177
{
111
178
        return atomic_read(&dtodi(d)->di_generation);
112
179
}
113
180
 
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)
116
183
{
117
 
        atomic_dec(&dtodi(d)->di_generation);
 
184
        return atomic_dec_return(&dtodi(d)->di_generation);
118
185
}
119
186
#endif /* CONFIG_AUFS_HINOTIFY */
120
187
 
140
207
 */
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); }
144
211
 
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); }
148
215
 
149
216
#define RWLockFuncs(name, lsc) \
150
 
        ReadLockFunc(name, lsc); \
 
217
        ReadLockFunc(name, lsc) \
151
218
        WriteLockFunc(name, lsc)
152
219
 
153
220
RWLockFuncs(child, CHILD);