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

« back to all changes in this revision

Viewing changes to fs/aufs/hinode.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:
 
1
/*
 
2
 * Copyright (C) 2005, 2006, 2007 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
/* $Id: hinode.h,v 1.7 2007/10/22 02:15:35 sfjro Exp $ */
 
20
 
 
21
#ifndef __AUFS_HINODE_H__
 
22
#define __AUFS_HINODE_H__
 
23
 
 
24
#ifdef __KERNEL__
 
25
 
 
26
#include <linux/fs.h>
 
27
#include <linux/inotify.h>
 
28
#include <linux/version.h>
 
29
#include <linux/aufs_type.h>
 
30
//#include "branch.h"
 
31
#include "inode.h"
 
32
//#include "vfsub.h"
 
33
 
 
34
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
 
35
#else
 
36
struct inotify_watch {
 
37
        /* empty */
 
38
};
 
39
#endif
 
40
 
 
41
/* ---------------------------------------------------------------------- */
 
42
 
 
43
struct aufs_hinotify {
 
44
#ifdef CONFIG_AUFS_HINOTIFY
 
45
        struct inotify_watch    hin_watch;
 
46
        struct inode            *hin_aufs_inode;        /* no get/put */
 
47
 
 
48
        /* an array of atomic_t X au_hin_nignore */
 
49
        atomic_t                hin_ignore[0];
 
50
#endif
 
51
};
 
52
 
 
53
struct aufs_hinode {
 
54
        struct inode            *hi_inode;
 
55
        aufs_bindex_t           hi_id;
 
56
#ifdef CONFIG_AUFS_HINOTIFY
 
57
        struct aufs_hinotify    *hi_notify;
 
58
#endif
 
59
 
 
60
        /* reference to the copied-up whiteout with get/put */
 
61
        struct dentry           *hi_whdentry;
 
62
};
 
63
 
 
64
struct aufs_hin_ignore {
 
65
#ifdef CONFIG_AUFS_HINOTIFY
 
66
        __u32                   ign_events;
 
67
        struct aufs_hinode      *ign_hinode;
 
68
#endif
 
69
};
 
70
 
 
71
/* ---------------------------------------------------------------------- */
 
72
 
 
73
#ifdef CONFIG_AUFS_HINOTIFY
 
74
static inline
 
75
void au_hin_init(struct aufs_hinode *hinode, struct aufs_hinotify *val)
 
76
{
 
77
        hinode->hi_notify = val;
 
78
}
 
79
 
 
80
/* hinotify.c */
 
81
 
 
82
int au_hin_alloc(struct aufs_hinode *hinode, struct inode *inode,
 
83
                   struct inode *h_inode);
 
84
void au_hin_free(struct aufs_hinode *hinode);
 
85
void au_do_hdir_lock(struct inode *h_dir, struct inode *dir,
 
86
                     aufs_bindex_t bindex, unsigned int lsc);
 
87
void hdir_unlock(struct inode *h_dir, struct inode *dir, aufs_bindex_t bindex);
 
88
void hdir_lock_rename(struct dentry **h_parents, struct inode **dirs,
 
89
                      aufs_bindex_t bindex, int issamedir);
 
90
void hdir_unlock_rename(struct dentry **h_parents, struct inode **dirs,
 
91
                        aufs_bindex_t bindex, int issamedir);
 
92
void au_reset_hinotify(struct inode *inode, unsigned int flags);
 
93
 
 
94
void au_hin_ignore(struct aufs_hinode *hinode, __u32 events);
 
95
void au_hin_unignore(struct aufs_hinode *hinode, __u32 events);
 
96
 
 
97
int __init au_inotify_init(void);
 
98
void au_inotify_fin(void);
 
99
#else
 
100
static inline
 
101
void au_hin_init(struct aufs_hinode *hinode, struct aufs_hinotify *val)
 
102
{
 
103
        /* empty */
 
104
}
 
105
 
 
106
static inline
 
107
int au_hin_alloc(struct aufs_hinode *hinode, struct inode *inode,
 
108
                   struct inode *h_inode)
 
109
{
 
110
        return -EOPNOTSUPP;
 
111
}
 
112
 
 
113
static inline void au_hin_free(struct aufs_hinode *hinode)
 
114
{
 
115
        /* nothing */
 
116
}
 
117
 
 
118
static inline void au_do_hdir_lock(struct inode *h_dir, struct inode *dir,
 
119
                                   aufs_bindex_t bindex, unsigned int lsc)
 
120
{
 
121
        vfsub_i_lock_nested(h_dir, lsc);
 
122
}
 
123
 
 
124
static inline
 
125
void hdir_unlock(struct inode *h_dir, struct inode *dir, aufs_bindex_t bindex)
 
126
{
 
127
        vfsub_i_unlock(h_dir);
 
128
}
 
129
 
 
130
static inline
 
131
void hdir_lock_rename(struct dentry **h_parents, struct inode **dirs,
 
132
                      aufs_bindex_t bindex, int issamedir)
 
133
{
 
134
        vfsub_lock_rename(h_parents[0], h_parents[1]);
 
135
}
 
136
 
 
137
static inline
 
138
void hdir_unlock_rename(struct dentry **h_parents, struct inode **dirs,
 
139
                        aufs_bindex_t bindex, int issamedir)
 
140
{
 
141
        vfsub_unlock_rename(h_parents[0], h_parents[1]);
 
142
}
 
143
 
 
144
static inline void au_reset_hinotify(struct inode *inode, unsigned int flags)
 
145
{
 
146
        /* nothing */
 
147
}
 
148
 
 
149
static inline __u32 au_notify_change_events(struct iattr *ia)
 
150
{
 
151
        return 0;
 
152
}
 
153
 
 
154
static inline void au_hin_ignore(struct aufs_hinotify *hinotify, __u32 events)
 
155
{
 
156
        /* nothing */
 
157
}
 
158
 
 
159
static inline void au_hin_unignore(struct aufs_hinotify *hinotify, __u32 events)
 
160
{
 
161
        /* nothing */
 
162
}
 
163
 
 
164
#define au_inotify_init()       0
 
165
#define au_inotify_fin()        do {} while (0)
 
166
#endif /* CONFIG_AUFS_HINOTIFY */
 
167
 
 
168
/* ---------------------------------------------------------------------- */
 
169
 
 
170
/*
 
171
 * hgdir_lock, hdir_lock, hdir2_lock
 
172
 */
 
173
#define LockFunc(name, lsc) \
 
174
static inline \
 
175
void name##_lock(struct inode *h_dir, struct inode *dir, aufs_bindex_t bindex) \
 
176
{ au_do_hdir_lock(h_dir, dir, bindex, AuLsc_I_##lsc); }
 
177
 
 
178
LockFunc(hdir, PARENT);
 
179
LockFunc(hdir2, PARENT2);
 
180
 
 
181
#undef LockFunc
 
182
 
 
183
/* ---------------------------------------------------------------------- */
 
184
 
 
185
#endif /* __KERNEL__ */
 
186
#endif /* __AUFS_HINODE_H__ */