2008-04-29 16:00:10 +08:00
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/fs.h>
|
|
|
|
|
|
|
|
#ifdef CONFIG_CGROUP_DEVICE
|
2011-06-20 01:01:04 +08:00
|
|
|
extern int __devcgroup_inode_permission(struct inode *inode, int mask);
|
2008-04-29 16:00:10 +08:00
|
|
|
extern int devcgroup_inode_mknod(int mode, dev_t dev);
|
2011-06-20 01:01:04 +08:00
|
|
|
static inline int devcgroup_inode_permission(struct inode *inode, int mask)
|
|
|
|
{
|
|
|
|
if (likely(!inode->i_rdev))
|
|
|
|
return 0;
|
|
|
|
if (!S_ISBLK(inode->i_mode) && !S_ISCHR(inode->i_mode))
|
|
|
|
return 0;
|
|
|
|
return __devcgroup_inode_permission(inode, mask);
|
|
|
|
}
|
2008-04-29 16:00:10 +08:00
|
|
|
#else
|
|
|
|
static inline int devcgroup_inode_permission(struct inode *inode, int mask)
|
|
|
|
{ return 0; }
|
|
|
|
static inline int devcgroup_inode_mknod(int mode, dev_t dev)
|
|
|
|
{ return 0; }
|
|
|
|
#endif
|