2
* Copyright (C) 2005-2009 Junjiro R. 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
* support for loopback block device as a branch
23
#include <linux/loop.h>
27
* test if two lower dentries have overlapping branches.
29
int au_test_loopback_overlap(struct super_block *sb, struct dentry *h_d1,
32
struct inode *h_inode;
33
struct loop_device *l;
35
h_inode = h_d1->d_inode;
36
if (MAJOR(h_inode->i_sb->s_dev) != LOOP_MAJOR)
39
l = h_inode->i_sb->s_bdev->bd_disk->private_data;
40
h_d1 = l->lo_backing_file->f_dentry;
41
/* h_d1 can be local NFS. in this case aufs cannot detect the loop */
42
if (unlikely(h_d1->d_sb == sb))
44
return !!au_test_subdir(h_d1, h_d2);
47
/* true if a kernel thread named 'loop[0-9].*' accesses a file */
48
int au_test_loopback_kthread(void)
50
const char c = current->comm[4];
52
return current->mm == NULL
53
&& '0' <= c && c <= '9'
54
&& strncmp(current->comm, "loop", 4) == 0;