blob: 7aad1f440867e796ed6f5d2c811771e700e7ad15 [file] [log] [blame]
Serge E. Hallyn08ce5f12008-04-29 01:00:10 -07001#include <linux/module.h>
2#include <linux/fs.h>
3
4#ifdef CONFIG_CGROUP_DEVICE
Al Viro482e0cd2011-06-19 13:01:04 -04005extern int __devcgroup_inode_permission(struct inode *inode, int mask);
Serge E. Hallyn08ce5f12008-04-29 01:00:10 -07006extern int devcgroup_inode_mknod(int mode, dev_t dev);
Al Viro482e0cd2011-06-19 13:01:04 -04007static 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. Hallyn08ce5f12008-04-29 01:00:10 -070015#else
16static inline int devcgroup_inode_permission(struct inode *inode, int mask)
17{ return 0; }
18static inline int devcgroup_inode_mknod(int mode, dev_t dev)
19{ return 0; }
20#endif