141
141
/* ---------------------------------------------------------------------- */
145
void free_branches(struct aufs_sbinfo *sinfo);
146
int br_rdonly(struct aufs_branch *br);
145
void au_br_free(struct au_sbinfo *sinfo);
147
146
int au_test_def_rr(struct super_block *h_sb);
148
int find_brindex(struct super_block *sb, aufs_bindex_t br_id);
147
int au_br_index(struct super_block *sb, aufs_bindex_t br_id);
149
148
struct au_opt_add;
150
int br_add(struct super_block *sb, struct au_opt_add *add, int remount);
149
int au_br_add(struct super_block *sb, struct au_opt_add *add, int remount);
151
150
struct au_opt_del;
152
int br_del(struct super_block *sb, struct au_opt_del *del, int remount);
151
int au_br_del(struct super_block *sb, struct au_opt_del *del, int remount);
153
152
struct au_opt_mod;
154
int br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
153
int au_br_mod(struct super_block *sb, struct au_opt_mod *mod, int remount,
158
int xib_trunc(struct super_block *sb);
157
int au_xib_trunc(struct super_block *sb);
160
struct file *xino_create(struct super_block *sb, char *fname, int silent,
161
struct dentry *parent);
162
ino_t xino_new_ino(struct super_block *sb);
163
int xino_write0(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
165
int xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
166
struct xino_entry *xinoe);
167
int xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
168
struct xino_entry *xinoe);
169
int xino_br(struct super_block *sb, aufs_bindex_t bindex,
170
struct file *base_file, int do_test);
171
int xino_trunc(struct super_block *sb, aufs_bindex_t bindex);
159
struct file *au_xino_create(struct super_block *sb, char *fname, int silent,
160
struct dentry *parent);
161
ino_t au_xino_new_ino(struct super_block *sb);
162
int au_xino_write0(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
164
int au_xino_write(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
165
struct au_xino_entry *xinoe);
166
int au_xino_read(struct super_block *sb, aufs_bindex_t bindex, ino_t h_ino,
167
struct au_xino_entry *xinoe);
168
int au_xino_br(struct super_block *sb, aufs_bindex_t bindex,
169
struct file *base_file, int do_test);
170
int au_xino_trunc(struct super_block *sb, aufs_bindex_t bindex);
173
172
struct au_opt_xino;
174
int xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount);
175
void xino_clr(struct super_block *sb);
176
struct file *xino_def(struct super_block *sb);
173
int au_xino_set(struct super_block *sb, struct au_opt_xino *xino, int remount);
174
void au_xino_clr(struct super_block *sb);
175
struct file *au_xino_def(struct super_block *sb);
178
177
/* ---------------------------------------------------------------------- */
180
static inline int br_count(struct aufs_branch *br)
179
static inline int au_br_count(struct au_branch *br)
182
181
return atomic_read(&br->br_count);
185
static inline int br_get(struct aufs_branch *br)
184
static inline int au_br_get(struct au_branch *br)
187
186
return atomic_inc_return(&br->br_count);
190
static inline int br_put(struct aufs_branch *br)
189
static inline int au_br_put(struct au_branch *br)
192
191
return atomic_dec_return(&br->br_count);
195
static inline au_gen_t au_br_gen(struct aufs_branch *br)
194
static inline au_gen_t au_br_gen(struct au_branch *br)
197
196
return br->br_generation;
200
* test if the @br is readonly or not.
202
static inline int au_br_rdonly(struct au_branch *br)
204
return ((br->br_mnt->mnt_sb->s_flags & MS_RDONLY)
205
|| !au_br_writable(br->br_perm))
200
209
/* ---------------------------------------------------------------------- */
202
211
/* Superblock to branch */
203
static inline aufs_bindex_t sbr_id(struct super_block *sb, aufs_bindex_t bindex)
205
return stobr(sb, bindex)->br_id;
209
struct vfsmount *sbr_mnt(struct super_block *sb, aufs_bindex_t bindex)
211
return stobr(sb, bindex)->br_mnt;
215
struct super_block *sbr_sb(struct super_block *sb, aufs_bindex_t bindex)
217
return sbr_mnt(sb, bindex)->mnt_sb;
213
aufs_bindex_t au_sbr_id(struct super_block *sb, aufs_bindex_t bindex)
215
return au_sbr(sb, bindex)->br_id;
219
struct vfsmount *au_sbr_mnt(struct super_block *sb, aufs_bindex_t bindex)
221
return au_sbr(sb, bindex)->br_mnt;
225
struct super_block *au_sbr_sb(struct super_block *sb, aufs_bindex_t bindex)
227
return au_sbr_mnt(sb, bindex)->mnt_sb;
221
static inline int sbr_count(struct super_block *sb, aufs_bindex_t bindex)
223
return br_count(stobr(sb, bindex));
226
static inline void sbr_get(struct super_block *sb, aufs_bindex_t bindex)
228
br_get(stobr(sb, bindex));
232
static inline void sbr_put(struct super_block *sb, aufs_bindex_t bindex)
234
br_put(stobr(sb, bindex));
237
static inline int sbr_perm(struct super_block *sb, aufs_bindex_t bindex)
239
return stobr(sb, bindex)->br_perm;
242
static inline int sbr_whable(struct super_block *sb, aufs_bindex_t bindex)
244
return br_whable(sbr_perm(sb, bindex));
247
/* ---------------------------------------------------------------------- */
249
#ifndef AuNoNfsBranch
231
static inline int au_sbr_count(struct super_block *sb, aufs_bindex_t bindex)
233
return au_br_count(au_sbr(sb, bindex));
236
static inline void au_sbr_get(struct super_block *sb, aufs_bindex_t bindex)
238
au_br_get(au_sbr(sb, bindex));
242
static inline void au_sbr_put(struct super_block *sb, aufs_bindex_t bindex)
244
au_br_put(au_sbr(sb, bindex));
247
static inline int au_sbr_perm(struct super_block *sb, aufs_bindex_t bindex)
249
return au_sbr(sb, bindex)->br_perm;
252
static inline int au_sbr_whable(struct super_block *sb, aufs_bindex_t bindex)
254
return au_br_whable(au_sbr_perm(sb, bindex));
257
static inline int au_test_trunc_xino(struct super_block *sb)
259
return au_test_tmpfs(sb);
262
/* temporary support for i#1 in cramfs */
263
static inline int au_test_unique_ino(struct dentry *h_dentry, ino_t h_ino)
265
#if defined(CONFIG_CRAMFS) || defined(CONFIG_CRAMFS_MODULE)
266
if (unlikely(h_dentry->d_sb->s_magic == CRAMFS_MAGIC))
272
#ifdef CONFIG_AUFS_BR_NFS
250
273
static inline int au_test_unsupported_nfs(struct super_block *h_sb)