~ubuntu-branches/ubuntu/raring/aufs/raring

« back to all changes in this revision

Viewing changes to fs/aufs25/whout.h

  • Committer: Bazaar Package Importer
  • Author(s): Julian Andres Klode
  • Date: 2008-05-06 18:35:50 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080506183550-0b6c974kkgc46oeh
Tags: 0+20080506-1
* New upstream release, supports Kernel 2.6.25 (Closes: #479717)
* Fix building with older Kernels (Closes: #475042)
* Update the patches 01, 04 and 07 to also patch fs/aufs25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2008 Junjiro Okajima
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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
 
17
 */
 
18
 
 
19
/*
 
20
 * whiteout for logical deletion and opaque directory
 
21
 *
 
22
 * $Id: whout.h,v 1.2 2008/04/21 02:00:37 sfjro Exp $
 
23
 */
 
24
 
 
25
#ifndef __AUFS_WHOUT_H__
 
26
#define __AUFS_WHOUT_H__
 
27
 
 
28
#ifdef __KERNEL__
 
29
 
 
30
#include <linux/fs.h>
 
31
#include <linux/aufs_type.h>
 
32
#include "dir.h"
 
33
#include "opts.h"
 
34
#include "super.h"
 
35
 
 
36
int au_wh_name_alloc(const char *name, int len, struct qstr *wh);
 
37
void au_wh_name_free(struct qstr *wh);
 
38
 
 
39
struct au_ndx;
 
40
int au_wh_test(struct dentry *h_parent, struct qstr *wh_name, int try_sio,
 
41
               struct au_ndx *ndx);
 
42
int au_diropq_test(struct dentry *h_dentry, struct au_ndx *ndx);
 
43
 
 
44
struct dentry *au_whtmp_lkup(struct dentry *h_parent, struct qstr *prefix,
 
45
                             struct au_ndx *ndx);
 
46
int au_whtmp_ren(struct inode *dir, struct dentry *dentry, aufs_bindex_t bindex,
 
47
                 int noself);
 
48
int au_wh_unlink_dentry(struct inode *h_dir, struct dentry *wh_dentry,
 
49
                        struct dentry *dentry, struct inode *dir, int dlgt);
 
50
 
 
51
struct au_branch;
 
52
int au_wh_init(struct dentry *h_parent, struct au_branch *br,
 
53
               struct vfsmount *nfsmnt, struct super_block *sb);
 
54
 
 
55
/* diropq flags */
 
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
 
62
#undef AuDiropq_DLGT
 
63
#define AuDiropq_DLGT   0
 
64
#endif
 
65
 
 
66
struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
 
67
                             unsigned int flags);
 
68
 
 
69
struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
 
70
                          struct au_ndx *ndx);
 
71
struct dentry *au_wh_create(struct inode *dir, struct dentry *dentry,
 
72
                            aufs_bindex_t bindex, struct dentry *h_parent,
 
73
                            struct au_ndx *ndx);
 
74
 
 
75
/* real rmdir the whiteout-ed dir */
 
76
struct au_whtmp_rmdir_args {
 
77
        struct dentry *h_dentry;
 
78
        struct au_nhash whlist;
 
79
        aufs_bindex_t bindex;
 
80
        struct inode *dir, *inode;
 
81
        int noself;
 
82
};
 
83
 
 
84
struct au_nhash;
 
85
int au_whtmp_rmdir(struct dentry *h_dentry, struct au_nhash *whlist,
 
86
                   aufs_bindex_t bindex, struct inode *dir, struct inode *inode,
 
87
                   int noself);
 
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);
 
92
 
 
93
/* ---------------------------------------------------------------------- */
 
94
 
 
95
static inline
 
96
struct dentry *au_diropq_create(struct dentry *dentry, aufs_bindex_t bindex,
 
97
                                int dlgt)
 
98
{
 
99
        unsigned int flags = AuDiropq_CREATE;
 
100
        if (unlikely(dlgt))
 
101
                au_fset_diropq(flags, DLGT);
 
102
        return au_diropq_sio(dentry, bindex, flags);
 
103
}
 
104
 
 
105
static inline
 
106
int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex, int dlgt)
 
107
{
 
108
        unsigned int flags = !AuDiropq_CREATE;
 
109
        if (unlikely(dlgt))
 
110
                au_fset_diropq(flags, DLGT);
 
111
        return PTR_ERR(au_diropq_sio(dentry, bindex, flags));
 
112
}
 
113
 
 
114
/* ---------------------------------------------------------------------- */
 
115
 
 
116
#ifdef CONFIG_AUFS_ROBR
 
117
/* robr.c */
 
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);
 
121
#else
 
122
static inline
 
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)
 
125
{
 
126
        return au_wh_test(h_parent, wh_name, try_sio, ndx);
 
127
}
 
128
 
 
129
static inline
 
130
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
 
131
{
 
132
        if (unlikely(!au_opt_test(au_mntflags(sb), SHWH)
 
133
                     && !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
 
134
                return -EPERM;
 
135
        return 0;
 
136
}
 
137
#endif /* CONFIG_AUFS_ROBR */
 
138
 
 
139
#endif /* __KERNEL__ */
 
140
#endif /* __AUFS_WHOUT_H__ */