2
* Copyright (C) 2005-2008 Junjiro Okajima
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.
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.
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
20
* lower (branch filesystem) inode and setting inotify
22
* $Id: hinode.h,v 1.3 2008/04/28 03:08:37 sfjro Exp $
25
#ifndef __AUFS_HINODE_H__
26
#define __AUFS_HINODE_H__
31
#include <linux/inotify.h>
32
#include <linux/aufs_type.h>
38
/* ---------------------------------------------------------------------- */
41
#ifdef CONFIG_AUFS_HINOTIFY
42
struct inotify_watch hin_watch;
43
struct inode *hin_aufs_inode; /* no get/put */
45
/* an array of atomic_t X au_hin_nignore */
46
atomic_t hin_ignore[0];
51
struct inode *hi_inode;
53
#ifdef CONFIG_AUFS_HINOTIFY
54
struct au_hinotify *hi_notify;
57
/* reference to the copied-up whiteout with get/put */
58
struct dentry *hi_whdentry;
61
struct au_hin_ignore {
62
#ifdef CONFIG_AUFS_HINOTIFY
64
struct au_hinode *ign_hinode;
68
/* ---------------------------------------------------------------------- */
70
#ifdef CONFIG_AUFS_HINOTIFY
72
void au_hin_init(struct au_hinode *hinode, struct au_hinotify *val)
74
hinode->hi_notify = val;
78
int au_hin_alloc(struct au_hinode *hinode, struct inode *inode,
79
struct inode *h_inode);
80
void au_hin_free(struct au_hinode *hinode);
81
void au_do_hdir_lock(struct inode *h_dir, struct inode *dir,
82
aufs_bindex_t bindex, unsigned int lsc);
83
void au_hdir_unlock(struct inode *h_dir, struct inode *dir,
84
aufs_bindex_t bindex);
85
struct dentry *au_hdir_lock_rename(struct dentry **h_parents,
86
struct inode **dirs, aufs_bindex_t bindex,
88
void au_hdir_unlock_rename(struct dentry **h_parents, struct inode **dirs,
89
aufs_bindex_t bindex, int issamedir);
90
void au_reset_hinotify(struct inode *inode, unsigned int flags);
92
void au_hin_ignore(struct au_hinode *hinode, __u32 events);
93
void au_hin_unignore(struct au_hinode *hinode, __u32 events);
95
int __init au_inotify_init(void);
96
void au_inotify_fin(void);
101
void au_hin_init(struct au_hinode *hinode, struct au_hinotify *val)
107
int au_hin_alloc(struct au_hinode *hinode, struct inode *inode,
108
struct inode *h_inode)
113
static inline void au_hin_free(struct au_hinode *hinode)
119
void au_do_hdir_lock(struct inode *h_dir, struct inode *dir,
120
aufs_bindex_t bindex, unsigned int lsc)
122
mutex_lock_nested(&h_dir->i_mutex, lsc);
126
void au_hdir_unlock(struct inode *h_dir, struct inode *dir,
127
aufs_bindex_t bindex)
129
mutex_unlock(&h_dir->i_mutex);
133
struct dentry *au_hdir_lock_rename(struct dentry **h_parents,
134
struct inode **dirs, aufs_bindex_t bindex,
137
return vfsub_lock_rename(h_parents[0], h_parents[1]);
141
void au_hdir_unlock_rename(struct dentry **h_parents, struct inode **dirs,
142
aufs_bindex_t bindex, int issamedir)
144
vfsub_unlock_rename(h_parents[0], h_parents[1]);
147
static inline void au_reset_hinotify(struct inode *inode, unsigned int flags)
152
static inline void au_hin_ignore(struct au_hinotify *hinotify, __u32 events)
157
static inline void au_hin_unignore(struct au_hinotify *hinotify, __u32 events)
162
static inline int au_inotify_init(void)
167
#define au_inotify_fin() do {} while (0)
168
#endif /* CONFIG_AUFS_HINOTIFY */
170
/* ---------------------------------------------------------------------- */
173
* au_hdir_lock, au_hdir2_lock
175
#define AuLockFunc(name, lsc) \
177
void name##_lock(struct inode *h_dir, struct inode *dir, aufs_bindex_t bindex) \
178
{ au_do_hdir_lock(h_dir, dir, bindex, AuLsc_I_##lsc); }
180
AuLockFunc(au_hdir, PARENT);
181
AuLockFunc(au_hdir2, PARENT2);
185
/* ---------------------------------------------------------------------- */
187
#endif /* __KERNEL__ */
188
#endif /* __AUFS_HINODE_H__ */