diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-06-19 13:01:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-06-20 10:46:04 -0400 |
commit | 482e0cd3dbaa70f2a2bead4b5f2c0d203ef654ba (patch) | |
tree | 68d885682da34a08c29908d012a356344882a487 /include/linux/device_cgroup.h | |
parent | 8e833fd2e1f0107ee7a4b6bc4de3c9f0e9b0ed41 (diff) |
devcgroup_inode_permission: take "is it a device node" checks to inlined wrapper
inode_permission() calls devcgroup_inode_permission() and almost all such
calls are _not_ for device nodes; let's at least keep the common path
straight...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/device_cgroup.h')
-rw-r--r-- | include/linux/device_cgroup.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h index 0b0d9c39ed6..7aad1f44086 100644 --- a/include/linux/device_cgroup.h +++ b/include/linux/device_cgroup.h @@ -2,8 +2,16 @@ #include <linux/fs.h> #ifdef CONFIG_CGROUP_DEVICE -extern int devcgroup_inode_permission(struct inode *inode, int mask); +extern int __devcgroup_inode_permission(struct inode *inode, int mask); extern int devcgroup_inode_mknod(int mode, dev_t dev); +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); +} #else static inline int devcgroup_inode_permission(struct inode *inode, int mask) { return 0; } |