hfsplus: integrate POSIX ACLs support into driver
Subsystems (2)
Vyacheslav Dubeyko
maintainerPATCH 3/3 hfsplus: integrate POSIX ACLs support into driver
From: Vyacheslav Dubeyko <[email protected]>
Subject: [PATCH 3/3] hfsplus: integrate POSIX ACLs support into driver
This patch integrates implemented POSIX ACLs support into hfsplus driver.
Signed-off-by Vyacheslav Dubeyko <[email protected]>
CC Al Viro <[email protected]>
CC Christoph Hellwig <[email protected]>
CC Hin-Tak Leung <[email protected]>
--- fs/hfsplus/Makefile | 2 ++ fs/hfsplus/dir.c | 4 +++ fs/hfsplus/inode.c | 11 ++++++++ fs/hfsplus/xattr.c | 62 ++++++++++++++++++++++++++++++++++++++----- fs/hfsplus/xattr.h | 33 +++++++++-------------- fs/hfsplus/xattr_security.c | 13 +++++++++ 6 files changed, 99 insertions(+), 26 deletions(-)
fs/hfsplus/Makefile +2 -0
@@ -7,3 +7,5 @@ obj-$(CONFIG_HFSPLUS_FS) += hfsplus.o hfsplus-objs := super.o options.o inode.o ioctl.o extents.o catalog.o dir.o btree.o \ bnode.o brec.o bfind.o tables.o unicode.o wrapper.o bitmap.o part_tbl.o \ attributes.o xattr.o xattr_user.o xattr_security.o xattr_trusted.o + +hfsplus-$(CONFIG_HFSPLUS_FS_POSIX_ACL) += posix_acl.o
fs/hfsplus/dir.c +4 -0
@@ -16,6 +16,7 @@#include "hfsplus_fs.h" #include "hfsplus_raw.h" #include "xattr.h" +#include "acl.h" static inline void hfsplus_instantiate (struct dentry *dentry,struct inode *inode,u32 cnid)
@@ -533,6 +534,9 @@ const struct inode_operations hfsplus_dir_inode_operations = { .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr, .removexattr = hfsplus_removexattr, +#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL + .get_acl = hfsplus_get_posix_acl, +#endif };const struct file_operations hfsplus_dir_operations = {
fs/hfsplus/inode.c +11 -0
@@ -19,6 +19,7 @@#include "hfsplus_fs.h" #include "hfsplus_raw.h" #include "xattr.h" +#include "acl.h" static int hfsplus_readpage (struct file *file,struct page *page) {
@@ -316,6 +317,13 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)setattr_copy (inode, attr);mark_inode_dirty (inode); + +if (attr->ia_valid &ATTR_MODE ) { + error =hfsplus_posix_acl_chmod (inode); +if (unlikely (error)) +return error; + } +return 0 ; }
@@ -383,6 +391,9 @@ static const struct inode_operations hfsplus_file_inode_operations = { .getxattr = generic_getxattr, .listxattr = hfsplus_listxattr, .removexattr = hfsplus_removexattr, +#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL + .get_acl = hfsplus_get_posix_acl, +#endif };static const struct file_operations hfsplus_file_operations = {
fs/hfsplus/xattr.c +56 -6
106 lines not on this page · raw message
fs/hfsplus/xattr.h +13 -20
@@ -14,8 +14,8 @@extern const struct xattr_handler hfsplus_xattr_osx_handler;extern const struct xattr_handler hfsplus_xattr_user_handler;extern const struct xattr_handler hfsplus_xattr_trusted_handler; -/*extern const struct xattr_handler hfsplus_xattr_acl_access_handler;*/ -/*extern const struct xattr_handler hfsplus_xattr_acl_default_handler;*/ +extern const struct xattr_handler hfsplus_xattr_acl_access_handler; +extern const struct xattr_handler hfsplus_xattr_acl_default_handler;extern const struct xattr_handler hfsplus_xattr_security_handler;extern const struct xattr_handler *hfsplus_xattr_handlers[];
@@ -29,9 +29,17 @@ static inline int hfsplus_setxattr(struct dentry *dentry, const char *name,return __hfsplus_setxattr (dentry->d_inode, name, value, size, flags); } -ssize_t hfsplus_getxattr (struct dentry *dentry,const char *name, +ssize_t __hfsplus_getxattr (struct inode *inode,const char *name,void *value,size_t size); +static inline ssize_t hfsplus_getxattr (struct dentry *dentry, +const char *name, +void *value, +size_t size) +{ +return __hfsplus_getxattr (dentry->d_inode, name, value, size); +} +ssize_t hfsplus_listxattr (struct dentry *dentry,char *buffer,size_t size);int hfsplus_removexattr (struct dentry *dentry,const char *name);
@@ -39,22 +47,7 @@ int hfsplus_removexattr(struct dentry *dentry, const char *name);int hfsplus_init_security (struct inode *inode,struct inode *dir,const struct qstr *qstr); -static inline int hfsplus_init_acl (struct inode *inode,struct inode *dir) -{ -/*TODO: implement*/ -return 0 ; -} - -static inline int hfsplus_init_inode_security (struct inode *inode, -struct inode *dir, -const struct qstr *qstr) -{ -int err; - - err =hfsplus_init_acl (inode, dir); -if (!err) - err =hfsplus_init_security (inode, dir, qstr); -return err; -} +int hfsplus_init_inode_security (struct inode *inode,struct inode *dir, +const struct qstr *qstr);#endif
fs/hfsplus/xattr_security.c +13 -0
@@ -9,6 +9,7 @@#include <linux/security.h> #include "hfsplus_fs.h" #include "xattr.h" +#include "acl.h" static int hfsplus_security_getxattr (struct dentry *dentry,const char *name,void *buffer,size_t size,int type)
@@ -96,6 +97,18 @@ int hfsplus_init_security(struct inode *inode, struct inode *dir, &hfsplus_initxattrs, NULL); } +int hfsplus_init_inode_security (struct inode *inode, +struct inode *dir, +const struct qstr *qstr) +{ +int err; + + err =hfsplus_init_posix_acl (inode, dir); +if (!err) + err =hfsplus_init_security (inode, dir, qstr); +return err; +} +const struct xattr_handler hfsplus_xattr_security_handler = { .prefix =XATTR_SECURITY_PREFIX , .list = hfsplus_security_listxattr,
Signature · 1 line
1.7.9.5