Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[cascardo/linux.git] / fs / jffs2 / acl.c
index 3675b3c..922f146 100644 (file)
@@ -9,6 +9,8 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/fs.h>
@@ -156,7 +158,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
        return ERR_PTR(-EINVAL);
 }
 
-static struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
+struct posix_acl *jffs2_get_acl(struct inode *inode, int type)
 {
        struct posix_acl *acl;
        char *value = NULL;
@@ -227,7 +229,7 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        case ACL_TYPE_ACCESS:
                xprefix = JFFS2_XPREFIX_ACL_ACCESS;
                if (acl) {
-                       mode_t mode = inode->i_mode;
+                       umode_t mode = inode->i_mode;
                        rc = posix_acl_equiv_mode(acl, &mode);
                        if (rc < 0)
                                return rc;
@@ -259,30 +261,11 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
        return rc;
 }
 
-int jffs2_check_acl(struct inode *inode, int mask)
+int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, umode_t *i_mode)
 {
        struct posix_acl *acl;
        int rc;
 
-       if (mask & MAY_NOT_BLOCK)
-               return -ECHILD;
-
-       acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
-       if (IS_ERR(acl))
-               return PTR_ERR(acl);
-       if (acl) {
-               rc = posix_acl_permission(inode, acl, mask);
-               posix_acl_release(acl);
-               return rc;
-       }
-       return -EAGAIN;
-}
-
-int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
-{
-       struct posix_acl *acl, *clone;
-       int rc;
-
        cache_no_acl(inode);
 
        if (S_ISLNK(*i_mode))
@@ -298,18 +281,13 @@ int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, int *i_mode)
                if (S_ISDIR(*i_mode))
                        set_cached_acl(inode, ACL_TYPE_DEFAULT, acl);
 
-               clone = posix_acl_clone(acl, GFP_KERNEL);
-               if (!clone)
-                       return -ENOMEM;
-               rc = posix_acl_create_masq(clone, (mode_t *)i_mode);
-               if (rc < 0) {
-                       posix_acl_release(clone);
+               rc = posix_acl_create(&acl, GFP_KERNEL, i_mode);
+               if (rc < 0)
                        return rc;
-               }
                if (rc > 0)
-                       set_cached_acl(inode, ACL_TYPE_ACCESS, clone);
+                       set_cached_acl(inode, ACL_TYPE_ACCESS, acl);
 
-               posix_acl_release(clone);
+               posix_acl_release(acl);
        }
        return 0;
 }
@@ -335,7 +313,7 @@ int jffs2_init_acl_post(struct inode *inode)
 
 int jffs2_acl_chmod(struct inode *inode)
 {
-       struct posix_acl *acl, *clone;
+       struct posix_acl *acl;
        int rc;
 
        if (S_ISLNK(inode->i_mode))
@@ -343,14 +321,11 @@ int jffs2_acl_chmod(struct inode *inode)
        acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
        if (IS_ERR(acl) || !acl)
                return PTR_ERR(acl);
-       clone = posix_acl_clone(acl, GFP_KERNEL);
+       rc = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode);
+       if (rc)
+               return rc;
+       rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, acl);
        posix_acl_release(acl);
-       if (!clone)
-               return -ENOMEM;
-       rc = posix_acl_chmod_masq(clone, inode->i_mode);
-       if (!rc)
-               rc = jffs2_set_acl(inode, ACL_TYPE_ACCESS, clone);
-       posix_acl_release(clone);
        return rc;
 }