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

« 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-08-21 14:58:54 UTC
  • mfrom: (1.2.1 upstream) (11 intrepid)
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: james.westby@ubuntu.com-20080821145854-6erljbzg007r476y
01_vserver_apparmor.dpatch: [UPDATE] Disable vserver patches on kernel 
2.6.26, because they are not needed anymore. (Closes: #495921)

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.3 2008/06/30 03:57:35 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, aufs_bindex_t bindex,
 
47
                 struct dentry *h_dentry);
 
48
int au_wh_unlink_dentry(struct au_hinode *dir, struct dentry *wh_dentry,
 
49
                        struct dentry *dentry, 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
               aufs_bindex_t bindex);
 
55
 
 
56
/* diropq flags */
 
57
#define AuDiropq_CREATE 1
 
58
#define AuDiropq_DLGT   (1 << 1)
 
59
#define au_ftest_diropq(flags, name)    ((flags) & AuDiropq_##name)
 
60
#define au_fset_diropq(flags, name)     { (flags) |= AuDiropq_##name; }
 
61
#define au_fclr_diropq(flags, name)     { (flags) &= ~AuDiropq_##name; }
 
62
#ifndef CONFIG_AUFS_DLGT
 
63
#undef AuDiropq_DLGT
 
64
#define AuDiropq_DLGT   0
 
65
#endif
 
66
 
 
67
struct dentry *au_diropq_sio(struct dentry *dentry, aufs_bindex_t bindex,
 
68
                             unsigned int flags);
 
69
 
 
70
struct dentry *au_wh_lkup(struct dentry *h_parent, struct qstr *base_name,
 
71
                          struct au_ndx *ndx);
 
72
struct dentry *au_wh_create(struct dentry *dentry, aufs_bindex_t bindex,
 
73
                            struct dentry *h_parent, struct au_ndx *ndx);
 
74
 
 
75
/* real rmdir the whiteout-ed dir */
 
76
struct au_whtmp_rmdir_args {
 
77
        struct inode *dir;
 
78
        aufs_bindex_t bindex;
 
79
        struct dentry *wh_dentry;
 
80
        struct au_nhash whlist;
 
81
};
 
82
 
 
83
struct au_nhash;
 
84
int au_whtmp_rmdir(struct inode *dir, aufs_bindex_t bindex,
 
85
                   struct dentry *wh_dentry, struct au_nhash *whlist);
 
86
void au_whtmp_kick_rmdir(struct inode *dir, aufs_bindex_t bindex,
 
87
                         struct dentry *wh_dentry, struct au_nhash *whlist,
 
88
                         struct au_whtmp_rmdir_args *args);
 
89
 
 
90
/* ---------------------------------------------------------------------- */
 
91
 
 
92
static inline
 
93
struct dentry *au_diropq_create(struct dentry *dentry, aufs_bindex_t bindex,
 
94
                                int dlgt)
 
95
{
 
96
        unsigned int flags = AuDiropq_CREATE;
 
97
        if (unlikely(dlgt))
 
98
                au_fset_diropq(flags, DLGT);
 
99
        return au_diropq_sio(dentry, bindex, flags);
 
100
}
 
101
 
 
102
static inline
 
103
int au_diropq_remove(struct dentry *dentry, aufs_bindex_t bindex, int dlgt)
 
104
{
 
105
        unsigned int flags = !AuDiropq_CREATE;
 
106
        if (unlikely(dlgt))
 
107
                au_fset_diropq(flags, DLGT);
 
108
        return PTR_ERR(au_diropq_sio(dentry, bindex, flags));
 
109
}
 
110
 
 
111
/* ---------------------------------------------------------------------- */
 
112
 
 
113
#ifdef CONFIG_AUFS_ROBR
 
114
/* robr.c */
 
115
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
 
116
                    struct qstr *wh_name, int try_sio, struct au_ndx *ndx);
 
117
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name);
 
118
#else
 
119
static inline
 
120
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
 
121
                    struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
 
122
{
 
123
        return au_wh_test(h_parent, wh_name, try_sio, ndx);
 
124
}
 
125
 
 
126
static inline
 
127
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
 
128
{
 
129
        if (unlikely(!au_opt_test(au_mntflags(sb), SHWH)
 
130
                     && !strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
 
131
                return -EPERM;
 
132
        return 0;
 
133
}
 
134
#endif /* CONFIG_AUFS_ROBR */
 
135
 
 
136
#endif /* __KERNEL__ */
 
137
#endif /* __AUFS_WHOUT_H__ */