This source file includes following definitions.
- ext2_permission
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/errno.h>
16 #include <linux/fs.h>
17 #include <linux/ext2_fs.h>
18 #include <linux/sched.h>
19 #include <linux/stat.h>
20
21
22
23
24
25
26 int ext2_permission (struct inode * inode, int mask)
27 {
28 unsigned short mode = inode->i_mode;
29
30
31
32
33 if ((mask & S_IWOTH) && IS_IMMUTABLE(inode))
34 return -EACCES;
35
36
37
38 if (fsuser())
39 return 0;
40
41
42
43 else if (current->fsuid == inode->i_uid)
44 mode >>= 6;
45 else if (in_group_p (inode->i_gid))
46 mode >>= 3;
47 if (((mode & mask & S_IRWXO) == mask))
48 return 0;
49 else
50 return -EACCES;
51 }