Serge E. Hallyn | 08ce5f1 | 2008-04-29 01:00:10 -0700 | [diff] [blame] | 1 | #include <linux/module.h> |
| 2 | #include <linux/fs.h> |
| 3 | |
| 4 | #ifdef CONFIG_CGROUP_DEVICE |
Al Viro | 482e0cd | 2011-06-19 13:01:04 -0400 | [diff] [blame] | 5 | extern int __devcgroup_inode_permission(struct inode *inode, int mask); |
Serge E. Hallyn | 08ce5f1 | 2008-04-29 01:00:10 -0700 | [diff] [blame] | 6 | extern int devcgroup_inode_mknod(int mode, dev_t dev); |
Al Viro | 482e0cd | 2011-06-19 13:01:04 -0400 | [diff] [blame] | 7 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) |
| 8 | { |
| 9 | if (likely(!inode->i_rdev)) |
| 10 | return 0; |
| 11 | if (!S_ISBLK(inode->i_mode) && !S_ISCHR(inode->i_mode)) |
| 12 | return 0; |
| 13 | return __devcgroup_inode_permission(inode, mask); |
| 14 | } |
Serge E. Hallyn | 08ce5f1 | 2008-04-29 01:00:10 -0700 | [diff] [blame] | 15 | #else |
| 16 | static inline int devcgroup_inode_permission(struct inode *inode, int mask) |
| 17 | { return 0; } |
| 18 | static inline int devcgroup_inode_mknod(int mode, dev_t dev) |
| 19 | { return 0; } |
| 20 | #endif |