diff options
author | Christoph Hellwig <hch@infradead.org> | 2013-12-20 05:16:54 -0800 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-01-26 08:26:40 -0500 |
commit | feda821e76f3bbbba4bd54d30b4d4005a7848aa5 (patch) | |
tree | ebd9b6935393c4764dd8ac2f55251380ee9c9319 /fs/posix_acl.c | |
parent | 013cdf1088d7235da9477a2375654921d9b9ba9f (diff) | |
download | lwn-feda821e76f3bbbba4bd54d30b4d4005a7848aa5.tar.gz lwn-feda821e76f3bbbba4bd54d30b4d4005a7848aa5.zip |
fs: remove generic_acl
And instead convert tmpfs to use the new generic ACL code, with two stub
methods provided for in-memory filesystems.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/posix_acl.c')
-rw-r--r-- | fs/posix_acl.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 8f245ab20143..f40df9b665fb 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -786,3 +786,39 @@ const struct xattr_handler posix_acl_default_xattr_handler = { .set = posix_acl_xattr_set, }; EXPORT_SYMBOL_GPL(posix_acl_default_xattr_handler); + +int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type) +{ + int error; + + if (type == ACL_TYPE_ACCESS) { + error = posix_acl_equiv_mode(acl, &inode->i_mode); + if (error < 0) + return 0; + if (error == 0) + acl = NULL; + } + + inode->i_ctime = CURRENT_TIME; + set_cached_acl(inode, type, acl); + return 0; +} + +int simple_acl_create(struct inode *dir, struct inode *inode) +{ + struct posix_acl *default_acl, *acl; + int error; + + error = posix_acl_create(dir, &inode->i_mode, &default_acl, &acl); + if (error) + return error; + + set_cached_acl(inode, ACL_TYPE_DEFAULT, default_acl); + set_cached_acl(inode, ACL_TYPE_ACCESS, acl); + + if (default_acl) + posix_acl_release(default_acl); + if (acl) + posix_acl_release(acl); + return 0; +} |