2
* Copyright (C) 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
* 'robr', aufs as readonly branch of another aufs
22
* $Id: robr.c,v 1.2 2008/04/13 23:44:36 sfjro Exp $
27
/* ---------------------------------------------------------------------- */
29
int au_test_robr_wh(struct qstr *name, struct dentry *h_parent,
30
struct qstr *wh_name, int try_sio, struct au_ndx *ndx)
32
if (strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN))
33
return au_wh_test(h_parent, wh_name, try_sio, ndx);
37
int au_test_robr_shwh(struct super_block *sb, const struct qstr *name)
42
/* ---------------------------------------------------------------------- */
45
struct list_head list;
46
struct vm_area_struct *vma;
49
struct file *au_robr_safe_file(struct vm_area_struct *vma)
51
struct file *file = vma->vm_file;
52
struct super_block *sb = file->f_dentry->d_sb;
53
struct au_robr_lvma *lvma, *entry;
54
struct au_sbinfo *sbinfo;
58
AuDebugOn(!au_test_aufs(sb));
63
spin_lock(&sbinfo->si_lvma_lock);
64
list_for_each_entry(entry, &sbinfo->si_lvma, list) {
65
found = (entry->vma == vma);
70
lvma = kmalloc(sizeof(*lvma), GFP_ATOMIC);
73
list_add(&lvma->list, &sbinfo->si_lvma);
80
spin_unlock(&sbinfo->si_lvma_lock);
83
AuWarn1("no memory for lvma\n");
87
void au_robr_reset_file(struct vm_area_struct *vma, struct file *file)
89
struct super_block *sb = file->f_dentry->d_sb;
90
struct au_robr_lvma *entry, *found;
91
struct au_sbinfo *sbinfo;
94
AuDebugOn(!au_test_aufs(sb));
100
spin_lock(&sbinfo->si_lvma_lock);
101
list_for_each_entry(entry, &sbinfo->si_lvma, list)
102
if (entry->vma == vma) {
107
list_del(&found->list);
108
spin_unlock(&sbinfo->si_lvma_lock);