ANDROID: sdcardfs: Fix formatting
authorDaniel Rosenberg <drosen@google.com>
Fri, 17 Mar 2017 00:42:58 +0000 (17:42 -0700)
committerStricted <info@stricted.net>
Thu, 11 Oct 2018 16:03:32 +0000 (18:03 +0200)
This fixes various spacing and bracket related issues
pointed out by checkpatch.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35331000
Change-Id: I6e248833a7a04e3899f3ae9462d765cfcaa70c96

fs/sdcardfs/dentry.c
fs/sdcardfs/derived_perm.c
fs/sdcardfs/file.c
fs/sdcardfs/inode.c
fs/sdcardfs/lookup.c
fs/sdcardfs/main.c
fs/sdcardfs/multiuser.h
fs/sdcardfs/packagelist.c
fs/sdcardfs/sdcardfs.h
fs/sdcardfs/super.c

index 4e9d2249e129a029a90a90bb891533662216567d..3a213c75420f37cfa1ca04357ccd22f3dbd5b2ef 100644 (file)
@@ -46,7 +46,8 @@ static int sdcardfs_d_revalidate(struct dentry *dentry, unsigned int flags)
        spin_unlock(&dentry->d_lock);
 
        /* check uninitialized obb_dentry and
-        * whether the base obbpath has been changed or not */
+        * whether the base obbpath has been changed or not
+        */
        if (is_obbpath_invalid(dentry)) {
                d_drop(dentry);
                return 0;
@@ -106,12 +107,10 @@ out:
 static void sdcardfs_d_release(struct dentry *dentry)
 {
        /* release and reset the lower paths */
-       if(has_graft_path(dentry)) {
+       if (has_graft_path(dentry))
                sdcardfs_put_reset_orig_path(dentry);
-       }
        sdcardfs_put_reset_lower_path(dentry);
        free_dentry_private_data(dentry);
-       return;
 }
 
 static int sdcardfs_hash_ci(const struct dentry *dentry,
@@ -169,14 +168,16 @@ static int sdcardfs_cmp_ci(const struct dentry *parent,
        return 1;
 }
 
-static void sdcardfs_canonical_path(const struct path *path, struct path *actual_path) {
+static void sdcardfs_canonical_path(const struct path *path,
+                               struct path *actual_path)
+{
        sdcardfs_get_real_lower(path->dentry, actual_path);
 }
 
 const struct dentry_operations sdcardfs_ci_dops = {
        .d_revalidate   = sdcardfs_d_revalidate,
        .d_release      = sdcardfs_d_release,
-       .d_hash         = sdcardfs_hash_ci,
+       .d_hash = sdcardfs_hash_ci,
        .d_compare      = sdcardfs_cmp_ci,
        .d_canonical_path = sdcardfs_canonical_path,
 };
index 1f3eb8b45298051b3ef2c6cfcfcb4c4e3dac7d56..8d5c1fdcdfe31cd6e879639c1bfea8717a48c115 100644 (file)
@@ -37,7 +37,8 @@ static void inherit_derived_state(struct inode *parent, struct inode *child)
 
 /* helper function for derived state */
 void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid,
-                        uid_t uid, bool under_android, struct inode *top)
+                                               uid_t uid, bool under_android,
+                                               struct inode *top)
 {
        struct sdcardfs_inode_info *info = SDCARDFS_I(inode);
 
@@ -50,11 +51,14 @@ void setup_derived_state(struct inode *inode, perm_t perm, userid_t userid,
        set_top(info, top);
 }
 
-/* While renaming, there is a point where we want the path from dentry, but the name from newdentry */
-void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, const struct qstr *name)
+/* While renaming, there is a point where we want the path from dentry,
+ * but the name from newdentry
+ */
+void get_derived_permission_new(struct dentry *parent, struct dentry *dentry,
+                               const struct qstr *name)
 {
        struct sdcardfs_inode_info *info = SDCARDFS_I(dentry->d_inode);
-       struct sdcardfs_inode_info *parent_info= SDCARDFS_I(parent->d_inode);
+       struct sdcardfs_inode_info *parent_info = SDCARDFS_I(parent->d_inode);
        appid_t appid;
        struct qstr q_Android = QSTR_LITERAL("Android");
        struct qstr q_data = QSTR_LITERAL("data");
@@ -77,58 +81,57 @@ void get_derived_permission_new(struct dentry *parent, struct dentry *dentry, co
                return;
        /* Derive custom permissions based on parent and current node */
        switch (parent_info->perm) {
-               case PERM_INHERIT:
-               case PERM_ANDROID_PACKAGE_CACHE:
-                       /* Already inherited above */
-                       break;
-               case PERM_PRE_ROOT:
-                       /* Legacy internal layout places users at top level */
-                       info->perm = PERM_ROOT;
-                       info->userid = simple_strtoul(name->name, NULL, 10);
+       case PERM_INHERIT:
+       case PERM_ANDROID_PACKAGE_CACHE:
+               /* Already inherited above */
+               break;
+       case PERM_PRE_ROOT:
+               /* Legacy internal layout places users at top level */
+               info->perm = PERM_ROOT;
+               info->userid = simple_strtoul(name->name, NULL, 10);
+               set_top(info, &info->vfs_inode);
+               break;
+       case PERM_ROOT:
+               /* Assume masked off by default. */
+               if (qstr_case_eq(name, &q_Android)) {
+                       /* App-specific directories inside; let anyone traverse */
+                       info->perm = PERM_ANDROID;
+                       info->under_android = true;
                        set_top(info, &info->vfs_inode);
-                       break;
-               case PERM_ROOT:
-                       /* Assume masked off by default. */
-                       if (qstr_case_eq(name, &q_Android)) {
-                               /* App-specific directories inside; let anyone traverse */
-                               info->perm = PERM_ANDROID;
-                               info->under_android = true;
-                               set_top(info, &info->vfs_inode);
-                       }
-                       break;
-               case PERM_ANDROID:
-                       if (qstr_case_eq(name, &q_data)) {
-                               /* App-specific directories inside; let anyone traverse */
-                               info->perm = PERM_ANDROID_DATA;
-                               set_top(info, &info->vfs_inode);
-                       } else if (qstr_case_eq(name, &q_obb)) {
-                               /* App-specific directories inside; let anyone traverse */
-                               info->perm = PERM_ANDROID_OBB;
-                               info->under_obb = true;
-                               set_top(info, &info->vfs_inode);
-                               /* Single OBB directory is always shared */
-                       } else if (qstr_case_eq(name, &q_media)) {
-                               /* App-specific directories inside; let anyone traverse */
-                               info->perm = PERM_ANDROID_MEDIA;
-                               set_top(info, &info->vfs_inode);
-                       }
-                       break;
-               case PERM_ANDROID_OBB:
-               case PERM_ANDROID_DATA:
-               case PERM_ANDROID_MEDIA:
-                       info->perm = PERM_ANDROID_PACKAGE;
-                       appid = get_appid(name->name);
-                       if (appid != 0 && !is_excluded(name->name, parent_info->userid)) {
-                               info->d_uid = multiuser_get_uid(parent_info->userid, appid);
-                       }
+               }
+               break;
+       case PERM_ANDROID:
+               if (qstr_case_eq(name, &q_data)) {
+                       /* App-specific directories inside; let anyone traverse */
+                       info->perm = PERM_ANDROID_DATA;
                        set_top(info, &info->vfs_inode);
-                       break;
-               case PERM_ANDROID_PACKAGE:
-                       if (qstr_case_eq(name, &q_cache)) {
-                               info->perm = PERM_ANDROID_PACKAGE_CACHE;
-                               info->under_cache = true;
-                       }
-                       break;
+               } else if (qstr_case_eq(name, &q_obb)) {
+                       /* App-specific directories inside; let anyone traverse */
+                       info->perm = PERM_ANDROID_OBB;
+                       info->under_obb = true;
+                       set_top(info, &info->vfs_inode);
+                       /* Single OBB directory is always shared */
+               } else if (qstr_case_eq(name, &q_media)) {
+                       /* App-specific directories inside; let anyone traverse */
+                       info->perm = PERM_ANDROID_MEDIA;
+                       set_top(info, &info->vfs_inode);
+               }
+               break;
+       case PERM_ANDROID_OBB:
+       case PERM_ANDROID_DATA:
+       case PERM_ANDROID_MEDIA:
+               info->perm = PERM_ANDROID_PACKAGE;
+               appid = get_appid(name->name);
+               if (appid != 0 && !is_excluded(name->name, parent_info->userid))
+                       info->d_uid = multiuser_get_uid(parent_info->userid, appid);
+               set_top(info, &info->vfs_inode);
+               break;
+       case PERM_ANDROID_PACKAGE:
+               if (qstr_case_eq(name, &q_cache)) {
+                       info->perm = PERM_ANDROID_PACKAGE_CACHE;
+                       info->under_cache = true;
+               }
+               break;
        }
 }
 
@@ -137,7 +140,8 @@ void get_derived_permission(struct dentry *parent, struct dentry *dentry)
        get_derived_permission_new(parent, dentry, &dentry->d_name);
 }
 
-static appid_t get_type(const char *name) {
+static appid_t get_type(const char *name)
+{
        const char *ext = strrchr(name, '.');
        appid_t id;
 
@@ -149,7 +153,8 @@ static appid_t get_type(const char *name) {
        return AID_MEDIA_RW;
 }
 
-void fixup_lower_ownership(struct dentry* dentry, const char *name) {
+void fixup_lower_ownership(struct dentry *dentry, const char *name)
+{
        struct path path;
        struct inode *inode;
        int error;
@@ -174,49 +179,49 @@ void fixup_lower_ownership(struct dentry* dentry, const char *name) {
        }
 
        switch (perm) {
-               case PERM_ROOT:
-               case PERM_ANDROID:
-               case PERM_ANDROID_DATA:
-               case PERM_ANDROID_MEDIA:
-               case PERM_ANDROID_PACKAGE:
-               case PERM_ANDROID_PACKAGE_CACHE:
-                       uid = multiuser_get_uid(info->userid, uid);
-                       break;
-               case PERM_ANDROID_OBB:
-                       uid = AID_MEDIA_OBB;
-                       break;
-               case PERM_PRE_ROOT:
-               default:
-                       break;
+       case PERM_ROOT:
+       case PERM_ANDROID:
+       case PERM_ANDROID_DATA:
+       case PERM_ANDROID_MEDIA:
+       case PERM_ANDROID_PACKAGE:
+       case PERM_ANDROID_PACKAGE_CACHE:
+               uid = multiuser_get_uid(info->userid, uid);
+               break;
+       case PERM_ANDROID_OBB:
+               uid = AID_MEDIA_OBB;
+               break;
+       case PERM_PRE_ROOT:
+       default:
+               break;
        }
        switch (perm) {
-               case PERM_ROOT:
-               case PERM_ANDROID:
-               case PERM_ANDROID_DATA:
-               case PERM_ANDROID_MEDIA:
-                       if (S_ISDIR(dentry->d_inode->i_mode))
-                               gid = multiuser_get_uid(info->userid, AID_MEDIA_RW);
-                       else
-                               gid = multiuser_get_uid(info->userid, get_type(name));
-                       break;
-               case PERM_ANDROID_OBB:
-                       gid = AID_MEDIA_OBB;
-                       break;
-               case PERM_ANDROID_PACKAGE:
-                       if (info->d_uid != 0)
-                               gid = multiuser_get_ext_gid(info->d_uid);
-                       else
-                               gid = multiuser_get_uid(info->userid, uid);
-                       break;
-               case PERM_ANDROID_PACKAGE_CACHE:
-                       if (info->d_uid != 0)
-                               gid = multiuser_get_cache_gid(info->d_uid);
-                       else
-                               gid = multiuser_get_uid(info->userid, uid);
-                       break;
-               case PERM_PRE_ROOT:
-               default:
-                       break;
+       case PERM_ROOT:
+       case PERM_ANDROID:
+       case PERM_ANDROID_DATA:
+       case PERM_ANDROID_MEDIA:
+               if (S_ISDIR(dentry->d_inode->i_mode))
+                       gid = multiuser_get_uid(info->userid, AID_MEDIA_RW);
+               else
+                       gid = multiuser_get_uid(info->userid, get_type(name));
+               break;
+       case PERM_ANDROID_OBB:
+               gid = AID_MEDIA_OBB;
+               break;
+       case PERM_ANDROID_PACKAGE:
+               if (info->d_uid != 0)
+                       gid = multiuser_get_ext_gid(info->d_uid);
+               else
+                       gid = multiuser_get_uid(info->userid, uid);
+               break;
+       case PERM_ANDROID_PACKAGE_CACHE:
+               if (info->d_uid != 0)
+                       gid = multiuser_get_cache_gid(info->d_uid);
+               else
+                       gid = multiuser_get_uid(info->userid, uid);
+               break;
+       case PERM_PRE_ROOT:
+       default:
+               break;
        }
 
        sdcardfs_get_lower_path(dentry, &path);
@@ -239,22 +244,25 @@ void fixup_lower_ownership(struct dentry* dentry, const char *name) {
        sdcardfs_put_lower_path(dentry, &path);
 }
 
-static int descendant_may_need_fixup(struct sdcardfs_inode_info *info, struct limit_search *limit) {
+static int descendant_may_need_fixup(struct sdcardfs_inode_info *info, struct limit_search *limit)
+{
        if (info->perm == PERM_ROOT)
-               return (limit->flags & BY_USERID)?info->userid == limit->userid:1;
+               return (limit->flags & BY_USERID) ? info->userid == limit->userid : 1;
        if (info->perm == PERM_PRE_ROOT || info->perm == PERM_ANDROID)
                return 1;
        return 0;
 }
 
-static int needs_fixup(perm_t perm) {
+static int needs_fixup(perm_t perm)
+{
        if (perm == PERM_ANDROID_DATA || perm == PERM_ANDROID_OBB
                        || perm == PERM_ANDROID_MEDIA)
                return 1;
        return 0;
 }
 
-static void __fixup_perms_recursive(struct dentry *dentry, struct limit_search *limit, int depth) {
+static void __fixup_perms_recursive(struct dentry *dentry, struct limit_search *limit, int depth)
+{
        struct dentry *child;
        struct sdcardfs_inode_info *info;
 
@@ -284,15 +292,16 @@ static void __fixup_perms_recursive(struct dentry *dentry, struct limit_search *
                        }
                        spin_unlock(&child->d_lock);
                }
-       } else  if (descendant_may_need_fixup(info, limit)) {
+       } else if (descendant_may_need_fixup(info, limit)) {
                list_for_each_entry(child, &dentry->d_subdirs, d_u.d_child) {
-                               __fixup_perms_recursive(child, limit, depth + 1);
+                       __fixup_perms_recursive(child, limit, depth + 1);
                }
        }
        spin_unlock(&dentry->d_lock);
 }
 
-void fixup_perms_recursive(struct dentry *dentry, struct limit_search *limit) {
+void fixup_perms_recursive(struct dentry *dentry, struct limit_search *limit)
+{
        __fixup_perms_recursive(dentry, limit, 0);
 }
 
@@ -301,7 +310,7 @@ inline void update_derived_permission_lock(struct dentry *dentry)
 {
        struct dentry *parent;
 
-       if(!dentry || !dentry->d_inode) {
+       if (!dentry || !dentry->d_inode) {
                printk(KERN_ERR "sdcardfs: %s: invalid dentry\n", __func__);
                return;
        }
@@ -309,11 +318,11 @@ inline void update_derived_permission_lock(struct dentry *dentry)
         * 1. need to check whether the dentry is updated or not
         * 2. remove the root dentry update
         */
-       if(IS_ROOT(dentry)) {
+       if (IS_ROOT(dentry)) {
                //setup_default_pre_root_state(dentry->d_inode);
        } else {
                parent = dget_parent(dentry);
-               if(parent) {
+               if (parent) {
                        get_derived_permission(parent, dentry);
                        dput(parent);
                }
@@ -325,15 +334,15 @@ int need_graft_path(struct dentry *dentry)
 {
        int ret = 0;
        struct dentry *parent = dget_parent(dentry);
-       struct sdcardfs_inode_info *parent_info= SDCARDFS_I(parent->d_inode);
+       struct sdcardfs_inode_info *parent_info = SDCARDFS_I(parent->d_inode);
        struct sdcardfs_sb_info *sbi = SDCARDFS_SB(dentry->d_sb);
        struct qstr obb = QSTR_LITERAL("obb");
 
-       if(parent_info->perm == PERM_ANDROID &&
+       if (parent_info->perm == PERM_ANDROID &&
                        qstr_case_eq(&dentry->d_name, &obb)) {
 
                /* /Android/obb is the base obbpath of DERIVED_UNIFIED */
-               if(!(sbi->options.multiuser == false
+               if (!(sbi->options.multiuser == false
                                && parent_info->userid == 0)) {
                        ret = 1;
                }
@@ -353,17 +362,18 @@ int is_obbpath_invalid(struct dentry *dent)
 
        /* check the base obbpath has been changed.
         * this routine can check an uninitialized obb dentry as well.
-        * regarding the uninitialized obb, refer to the sdcardfs_mkdir() */
+        * regarding the uninitialized obb, refer to the sdcardfs_mkdir()
+        */
        spin_lock(&di->lock);
-       if(di->orig_path.dentry) {
-               if(!di->lower_path.dentry) {
+       if (di->orig_path.dentry) {
+               if (!di->lower_path.dentry) {
                        ret = 1;
                } else {
                        path_get(&di->lower_path);
                        //lower_parent = lock_parent(lower_path->dentry);
 
                        path_buf = kmalloc(PATH_MAX, GFP_ATOMIC);
-                       if(!path_buf) {
+                       if (!path_buf) {
                                ret = 1;
                                printk(KERN_ERR "sdcardfs: fail to allocate path_buf in %s.\n", __func__);
                        } else {
@@ -390,13 +400,13 @@ int is_base_obbpath(struct dentry *dentry)
 {
        int ret = 0;
        struct dentry *parent = dget_parent(dentry);
-       struct sdcardfs_inode_info *parent_info= SDCARDFS_I(parent->d_inode);
+       struct sdcardfs_inode_info *parent_info = SDCARDFS_I(parent->d_inode);
        struct sdcardfs_sb_info *sbi = SDCARDFS_SB(dentry->d_sb);
        struct qstr q_obb = QSTR_LITERAL("obb");
 
        spin_lock(&SDCARDFS_D(dentry)->lock);
        if (sbi->options.multiuser) {
-               if(parent_info->perm == PERM_PRE_ROOT &&
+               if (parent_info->perm == PERM_PRE_ROOT &&
                                qstr_case_eq(&dentry->d_name, &q_obb)) {
                        ret = 1;
                }
@@ -411,7 +421,8 @@ int is_base_obbpath(struct dentry *dentry)
 /* The lower_path will be stored to the dentry's orig_path
  * and the base obbpath will be copyed to the lower_path variable.
  * if an error returned, there's no change in the lower_path
- * returns: -ERRNO if error (0: no error) */
+ * returns: -ERRNO if error (0: no error)
+ */
 int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
 {
        int err = 0;
@@ -426,7 +437,7 @@ int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
        err = kern_path(sbi->obbpath_s,
                        LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &obbpath);
 
-       if(!err) {
+       if (!err) {
                /* the obbpath base has been found */
                pathcpy(lower_path, &obbpath);
        } else {
@@ -434,7 +445,8 @@ int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
                 * setup the lower_path with its orig_path.
                 * but, the current implementation just returns an error
                 * because the sdcard daemon also regards this case as
-                * a lookup fail. */
+                * a lookup fail.
+                */
                printk(KERN_INFO "sdcardfs: the sbi->obbpath is not available\n");
        }
        return err;
index 28acc77852ae12c1012c9a04b6d42ffd31a06d26..ab78bb854c9f3bae345747cfc50aeaac19a4bd41 100644 (file)
@@ -216,7 +216,7 @@ static int sdcardfs_open(struct inode *inode, struct file *file)
                goto out_err;
        }
 
-       if(!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
+       if (!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
                err = -EACCES;
                goto out_err;
        }
@@ -249,9 +249,8 @@ static int sdcardfs_open(struct inode *inode, struct file *file)
 
        if (err)
                kfree(SDCARDFS_F(file));
-       else {
+       else
                sdcardfs_copy_and_fix_attrs(inode, sdcardfs_lower_inode(inode));
-       }
 
 out_revert_cred:
        REVERT_CRED(saved_cred);
index 42ffc0a6dd30c5ab63d5f73be509bfd8f02588f2..c2f2dd929154094bdc1f429a5ecc271a0291e81a 100644 (file)
 #include <linux/ratelimit.h>
 
 /* Do not directly use this function. Use OVERRIDE_CRED() instead. */
-const struct cred * override_fsids(struct sdcardfs_sb_info* sbi, struct sdcardfs_inode_info *info)
+const struct cred *override_fsids(struct sdcardfs_sb_info *sbi, struct sdcardfs_inode_info *info)
 {
-       struct cred * cred;
-       const struct cred * old_cred;
+       struct cred *cred;
+       const struct cred *old_cred;
        uid_t uid;
 
        cred = prepare_creds();
@@ -46,9 +46,9 @@ const struct cred * override_fsids(struct sdcardfs_sb_info* sbi, struct sdcardfs
 }
 
 /* Do not directly use this function, use REVERT_CRED() instead. */
-void revert_fsids(const struct cred * old_cred)
+void revert_fsids(const struct cred *old_cred)
 {
-       const struct cred * cur_cred;
+       const struct cred *cur_cred;
 
        cur_cred = current->cred;
        revert_creds(old_cred);
@@ -67,7 +67,7 @@ static int sdcardfs_create(struct inode *dir, struct dentry *dentry,
        struct fs_struct *saved_fs;
        struct fs_struct *copied_fs;
 
-       if(!check_caller_access_to_name(dir, &dentry->d_name)) {
+       if (!check_caller_access_to_name(dir, &dentry->d_name)) {
                err = -EACCES;
                goto out_eacces;
        }
@@ -166,7 +166,7 @@ static int sdcardfs_unlink(struct inode *dir, struct dentry *dentry)
        struct path lower_path;
        const struct cred *saved_cred = NULL;
 
-       if(!check_caller_access_to_name(dir, &dentry->d_name)) {
+       if (!check_caller_access_to_name(dir, &dentry->d_name)) {
                err = -EACCES;
                goto out_eacces;
        }
@@ -240,13 +240,14 @@ out:
 }
 #endif
 
-static int touch(char *abs_path, mode_t mode) {
+static int touch(char *abs_path, mode_t mode)
+{
        struct file *filp = filp_open(abs_path, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW, mode);
+
        if (IS_ERR(filp)) {
                if (PTR_ERR(filp) == -EEXIST) {
                        return 0;
-               }
-               else {
+               } else {
                        printk(KERN_ERR "sdcardfs: failed to open(%s): %ld\n",
                                                abs_path, PTR_ERR(filp));
                        return PTR_ERR(filp);
@@ -273,7 +274,7 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
        struct qstr q_obb = QSTR_LITERAL("obb");
        struct qstr q_data = QSTR_LITERAL("data");
 
-       if(!check_caller_access_to_name(dir, &dentry->d_name)) {
+       if (!check_caller_access_to_name(dir, &dentry->d_name)) {
                err = -EACCES;
                goto out_eacces;
        }
@@ -315,19 +316,21 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
        }
 
        /* if it is a local obb dentry, setup it with the base obbpath */
-       if(need_graft_path(dentry)) {
+       if (need_graft_path(dentry)) {
 
                err = setup_obb_dentry(dentry, &lower_path);
-               if(err) {
+               if (err) {
                        /* if the sbi->obbpath is not available, the lower_path won't be
                         * changed by setup_obb_dentry() but the lower path is saved to
                         * its orig_path. this dentry will be revalidated later.
-                        * but now, the lower_path should be NULL */
+                        * but now, the lower_path should be NULL
+                        */
                        sdcardfs_put_reset_lower_path(dentry);
 
                        /* the newly created lower path which saved to its orig_path or
                         * the lower_path is the base obbpath.
-                        * therefore, an additional path_get is required */
+                        * therefore, an additional path_get is required
+                        */
                        path_get(&lower_path);
                } else
                        make_nomedia_in_obb = 1;
@@ -382,7 +385,7 @@ static int sdcardfs_rmdir(struct inode *dir, struct dentry *dentry)
        struct path lower_path;
        const struct cred *saved_cred = NULL;
 
-       if(!check_caller_access_to_name(dir, &dentry->d_name)) {
+       if (!check_caller_access_to_name(dir, &dentry->d_name)) {
                err = -EACCES;
                goto out_eacces;
        }
@@ -391,7 +394,8 @@ static int sdcardfs_rmdir(struct inode *dir, struct dentry *dentry)
        OVERRIDE_CRED(SDCARDFS_SB(dir->i_sb), saved_cred, SDCARDFS_I(dir));
 
        /* sdcardfs_get_real_lower(): in case of remove an user's obb dentry
-        * the dentry on the original path should be deleted. */
+        * the dentry on the original path should be deleted.
+        */
        sdcardfs_get_real_lower(dentry, &lower_path);
 
        lower_dentry = lower_path.dentry;
@@ -467,7 +471,7 @@ static int sdcardfs_rename(struct inode *old_dir, struct dentry *old_dentry,
        struct path lower_old_path, lower_new_path;
        const struct cred *saved_cred = NULL;
 
-       if(!check_caller_access_to_name(old_dir, &old_dentry->d_name) ||
+       if (!check_caller_access_to_name(old_dir, &old_dentry->d_name) ||
                !check_caller_access_to_name(new_dir, &new_dentry->d_name)) {
                err = -EACCES;
                goto out_eacces;
@@ -668,6 +672,7 @@ static int sdcardfs_permission(struct vfsmount *mnt, struct inode *inode, int ma
                 * we check it with AID_MEDIA_RW permission
                 */
                struct inode *lower_inode;
+
                OVERRIDE_CRED(SDCARDFS_SB(inode->sb));
 
                lower_inode = sdcardfs_lower_inode(inode);
@@ -736,14 +741,15 @@ static int sdcardfs_setattr(struct vfsmount *mnt, struct dentry *dentry, struct
        /* prepare our own lower struct iattr (with the lower file) */
        memcpy(&lower_ia, ia, sizeof(lower_ia));
        /* Allow touch updating timestamps. A previous permission check ensures
-        * we have write access. Changes to mode, owner, and group are ignored*/
+        * we have write access. Changes to mode, owner, and group are ignored
+        */
        ia->ia_valid |= ATTR_FORCE;
        err = inode_change_ok(&tmp, ia);
 
        if (!err) {
                /* check the Android group ID */
                parent = dget_parent(dentry);
-               if(!check_caller_access_to_name(parent->d_inode, &dentry->d_name))
+               if (!check_caller_access_to_name(parent->d_inode, &dentry->d_name))
                        err = -EACCES;
                dput(parent);
        }
@@ -822,10 +828,12 @@ out_err:
        return err;
 }
 
-static int sdcardfs_fillattr(struct vfsmount *mnt, struct inode *inode, struct kstat *stat)
+static int sdcardfs_fillattr(struct vfsmount *mnt,
+                               struct inode *inode, struct kstat *stat)
 {
        struct sdcardfs_inode_info *info = SDCARDFS_I(inode);
        struct inode *top = grab_top(info);
+
        if (!top)
                return -EINVAL;
 
@@ -855,7 +863,7 @@ static int sdcardfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        int err;
 
        parent = dget_parent(dentry);
-       if(!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
+       if (!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
                dput(parent);
                return -EACCES;
        }
index c1a11c16fceee303fbc3e6522803f07c2b51e2ef..55dac78c6df33a0aec675eadb7b76c512ea0306b 100644 (file)
@@ -73,6 +73,7 @@ static int sdcardfs_inode_test(struct inode *inode, void *candidate_data/*void *
 {
        struct inode *current_lower_inode = sdcardfs_lower_inode(inode);
        userid_t current_userid = SDCARDFS_I(inode)->userid;
+
        if (current_lower_inode == ((struct inode_data *)candidate_data)->lower_inode &&
                        current_userid == ((struct inode_data *)candidate_data)->id)
                return 1; /* found a match */
@@ -102,7 +103,7 @@ struct inode *sdcardfs_iget(struct super_block *sb, struct inode *lower_inode, u
                              * instead.
                              */
                             lower_inode->i_ino, /* hashval */
-                            sdcardfs_inode_test,       /* inode comparison function */
+                            sdcardfs_inode_test, /* inode comparison function */
                             sdcardfs_inode_set, /* inode init function */
                             &data); /* data passed to test+set fxns */
        if (!inode) {
@@ -303,23 +304,26 @@ put_name:
        if (!err) {
                /* check if the dentry is an obb dentry
                 * if true, the lower_inode must be replaced with
-                * the inode of the graft path */
+                * the inode of the graft path
+                */
 
-               if(need_graft_path(dentry)) {
+               if (need_graft_path(dentry)) {
 
                        /* setup_obb_dentry()
-                        * The lower_path will be stored to the dentry's orig_path
+                        * The lower_path will be stored to the dentry's orig_path
                         * and the base obbpath will be copyed to the lower_path variable.
                         * if an error returned, there's no change in the lower_path
-                        *              returns: -ERRNO if error (0: no error) */
+                        * returns: -ERRNO if error (0: no error)
+                        */
                        err = setup_obb_dentry(dentry, &lower_path);
 
-                       if(err) {
+                       if (err) {
                                /* if the sbi->obbpath is not available, we can optionally
                                 * setup the lower_path with its orig_path.
                                 * but, the current implementation just returns an error
                                 * because the sdcard daemon also regards this case as
-                                * a lookup fail. */
+                                * a lookup fail.
+                                */
                                printk(KERN_INFO "sdcardfs: base obbpath is not available\n");
                                sdcardfs_put_reset_orig_path(dentry);
                                goto out;
@@ -374,9 +378,9 @@ out:
 
 /*
  * On success:
- *     fills dentry object appropriate values and returns NULL.
+ * fills dentry object appropriate values and returns NULL.
  * On fail (== error)
- *     returns error ptr
+ * returns error ptr
  *
  * @dir : Parent inode. It is locked (dir->i_mutex)
  * @dentry : Target dentry to lookup. we should set each of fields.
@@ -393,10 +397,10 @@ struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry,
 
        parent = dget_parent(dentry);
 
-       if(!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
+       if (!check_caller_access_to_name(parent->d_inode, &dentry->d_name)) {
                ret = ERR_PTR(-EACCES);
                goto out_err;
-        }
+       }
 
        /* save current_cred and override it */
        OVERRIDE_CRED_PTR(SDCARDFS_SB(dir->i_sb), saved_cred, SDCARDFS_I(dir));
@@ -412,9 +416,7 @@ struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry,
 
        ret = __sdcardfs_lookup(dentry, flags, &lower_parent_path, SDCARDFS_I(dir)->userid);
        if (IS_ERR(ret))
-       {
                goto out;
-       }
        if (ret)
                dentry = ret;
        if (dentry->d_inode) {
index ae62a994f818e021b05d8cf577373dd270b49e5e..4a04c91ab45652a56e26d7f3b267c3fa61ff88d4 100644 (file)
@@ -72,6 +72,7 @@ static int parse_options(struct super_block *sb, char *options, int silent,
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
+
                if (!*p)
                        continue;
 
@@ -148,6 +149,7 @@ int parse_options_remount(struct super_block *sb, char *options, int silent,
 
        while ((p = strsep(&options, ",")) != NULL) {
                int token;
+
                if (!*p)
                        continue;
 
@@ -223,8 +225,8 @@ static struct dentry *sdcardfs_d_alloc_root(struct super_block *sb)
 #endif
 
 DEFINE_MUTEX(sdcardfs_super_list_lock);
-LIST_HEAD(sdcardfs_super_list);
 EXPORT_SYMBOL_GPL(sdcardfs_super_list_lock);
+LIST_HEAD(sdcardfs_super_list);
 EXPORT_SYMBOL_GPL(sdcardfs_super_list);
 
 /*
@@ -328,14 +330,15 @@ static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb,
        /* setup permission policy */
        sb_info->obbpath_s = kzalloc(PATH_MAX, GFP_KERNEL);
        mutex_lock(&sdcardfs_super_list_lock);
-       if(sb_info->options.multiuser) {
-               setup_derived_state(sb->s_root->d_inode, PERM_PRE_ROOT, sb_info->options.fs_user_id, AID_ROOT, false, sb->s_root->d_inode);
+       if (sb_info->options.multiuser) {
+               setup_derived_state(sb->s_root->d_inode, PERM_PRE_ROOT,
+                                       sb_info->options.fs_user_id, AID_ROOT,
+                                       false, sb->s_root->d_inode);
                snprintf(sb_info->obbpath_s, PATH_MAX, "%s/obb", dev_name);
-               /*err =  prepare_dir(sb_info->obbpath_s,
-                                       sb_info->options.fs_low_uid,
-                                       sb_info->options.fs_low_gid, 00755);*/
        } else {
-               setup_derived_state(sb->s_root->d_inode, PERM_ROOT, sb_info->options.fs_user_id, AID_ROOT, false, sb->s_root->d_inode);
+               setup_derived_state(sb->s_root->d_inode, PERM_ROOT,
+                                       sb_info->options.fs_user_id, AID_ROOT,
+                                       false, sb->s_root->d_inode);
                snprintf(sb_info->obbpath_s, PATH_MAX, "%s/Android/obb", dev_name);
        }
        fixup_tmp_permissions(sb->s_root->d_inode);
@@ -368,8 +371,10 @@ out:
 
 /* A feature which supports mount_nodev() with options */
 static struct dentry *mount_nodev_with_options(struct vfsmount *mnt,
-       struct file_system_type *fs_type, int flags, const char *dev_name, void *data,
-        int (*fill_super)(struct vfsmount *, struct super_block *, const char *, void *, int))
+                       struct file_system_type *fs_type, int flags,
+                       const char *dev_name, void *data,
+                       int (*fill_super)(struct vfsmount *, struct super_block *,
+                                               const char *, void *, int))
 
 {
        int error;
@@ -401,19 +406,22 @@ static struct dentry *sdcardfs_mount(struct vfsmount *mnt,
                                                raw_data, sdcardfs_read_super);
 }
 
-static struct dentry *sdcardfs_mount_wrn(struct file_system_type *fs_type, int flags,
-                   const char *dev_name, void *raw_data)
+static struct dentry *sdcardfs_mount_wrn(struct file_system_type *fs_type,
+                   int flags, const char *dev_name, void *raw_data)
 {
        WARN(1, "sdcardfs does not support mount. Use mount2.\n");
        return ERR_PTR(-EINVAL);
 }
 
-void *sdcardfs_alloc_mnt_data(void) {
+void *sdcardfs_alloc_mnt_data(void)
+{
        return kmalloc(sizeof(struct sdcardfs_vfsmount_options), GFP_KERNEL);
 }
 
-void sdcardfs_kill_sb(struct super_block *sb) {
+void sdcardfs_kill_sb(struct super_block *sb)
+{
        struct sdcardfs_sb_info *sbi;
+
        if (sb->s_magic == SDCARDFS_SUPER_MAGIC) {
                sbi = SDCARDFS_SB(sb);
                mutex_lock(&sdcardfs_super_list_lock);
index 530bfad6b00eaac4b7758eb8ccb13af42ff03ff4..2e89b587231402a459bd86e0623856ead76cf339 100644 (file)
 typedef uid_t userid_t;
 typedef uid_t appid_t;
 
-static inline uid_t multiuser_get_uid(userid_t user_id, appid_t app_id) {
+static inline uid_t multiuser_get_uid(userid_t user_id, appid_t app_id)
+{
        return (user_id * AID_USER_OFFSET) + (app_id % AID_USER_OFFSET);
 }
 
-static inline gid_t multiuser_get_cache_gid(uid_t uid) {
+static inline gid_t multiuser_get_cache_gid(uid_t uid)
+{
        return uid - AID_APP_START + AID_CACHE_GID_START;
 }
 
-static inline gid_t multiuser_get_ext_gid(uid_t uid) {
+static inline gid_t multiuser_get_ext_gid(uid_t uid)
+{
        return uid - AID_APP_START + AID_EXT_GID_START;
 }
index 4fe1538612202906230fd2dce94b4a93ae5f5ea7..e5a56c94e404bd5adb18e15ba3d3e186d1ea8399 100644 (file)
@@ -61,7 +61,8 @@ static inline void qstr_init(struct qstr *q, const char *name)
        q->hash = full_name_case_hash(q->name, q->len);
 }
 
-static inline int qstr_copy(const struct qstr *src, struct qstr *dest) {
+static inline int qstr_copy(const struct qstr *src, struct qstr *dest)
+{
        dest->name = kstrdup(src->name, GFP_KERNEL);
        dest->hash_len = src->hash_len;
        return !!dest->name;
@@ -89,6 +90,7 @@ static appid_t __get_appid(const struct qstr *key)
 appid_t get_appid(const char *key)
 {
        struct qstr q;
+
        qstr_init(&q, key);
        return __get_appid(&q);
 }
@@ -114,6 +116,7 @@ static appid_t __get_ext_gid(const struct qstr *key)
 appid_t get_ext_gid(const char *key)
 {
        struct qstr q;
+
        qstr_init(&q, key);
        return __get_ext_gid(&q);
 }
@@ -138,14 +141,17 @@ static appid_t __is_excluded(const struct qstr *app_name, userid_t user)
 appid_t is_excluded(const char *key, userid_t user)
 {
        struct qstr q;
+
        qstr_init(&q, key);
        return __is_excluded(&q, user);
 }
 
 /* Kernel has already enforced everything we returned through
  * derive_permissions_locked(), so this is used to lock down access
- * even further, such as enforcing that apps hold sdcard_rw. */
-int check_caller_access_to_name(struct inode *parent_node, const struct qstr *name) {
+ * even further, such as enforcing that apps hold sdcard_rw.
+ */
+int check_caller_access_to_name(struct inode *parent_node, const struct qstr *name)
+{
        struct qstr q_autorun = QSTR_LITERAL("autorun.inf");
        struct qstr q__android_secure = QSTR_LITERAL(".android_secure");
        struct qstr q_android_secure = QSTR_LITERAL("android_secure");
@@ -160,26 +166,26 @@ int check_caller_access_to_name(struct inode *parent_node, const struct qstr *na
        }
 
        /* Root always has access; access for any other UIDs should always
-        * be controlled through packages.list. */
-       if (current_fsuid() == 0) {
+        * be controlled through packages.list.
+        */
+       if (current_fsuid() == 0)
                return 1;
-       }
 
        /* No extra permissions to enforce */
        return 1;
 }
 
 /* This function is used when file opening. The open flags must be
- * checked before calling check_caller_access_to_name() */
-int open_flags_to_access_mode(int open_flags) {
-       if((open_flags & O_ACCMODE) == O_RDONLY) {
+ * checked before calling check_caller_access_to_name()
+ */
+int open_flags_to_access_mode(int open_flags)
+{
+       if ((open_flags & O_ACCMODE) == O_RDONLY)
                return 0; /* R_OK */
-       } else if ((open_flags & O_ACCMODE) == O_WRONLY) {
+       if ((open_flags & O_ACCMODE) == O_WRONLY)
                return 1; /* W_OK */
-       } else {
-               /* Probably O_RDRW, but treat as default to be safe */
+       /* Probably O_RDRW, but treat as default to be safe */
                return 1; /* R_OK | W_OK */
-       }
 }
 
 static struct hashtable_entry *alloc_hashtable_entry(const struct qstr *key,
@@ -371,7 +377,6 @@ static void remove_packagelist_entry(const struct qstr *key)
        remove_packagelist_entry_locked(key);
        fixup_all_perms_name(key);
        mutex_unlock(&sdcardfs_super_list_lock);
-       return;
 }
 
 static void remove_ext_gid_entry_locked(const struct qstr *key, gid_t group)
@@ -394,7 +399,6 @@ static void remove_ext_gid_entry(const struct qstr *key, gid_t group)
        mutex_lock(&sdcardfs_super_list_lock);
        remove_ext_gid_entry_locked(key, group);
        mutex_unlock(&sdcardfs_super_list_lock);
-       return;
 }
 
 static void remove_userid_all_entry_locked(userid_t userid)
@@ -422,7 +426,6 @@ static void remove_userid_all_entry(userid_t userid)
        remove_userid_all_entry_locked(userid);
        fixup_all_perms_userid(userid);
        mutex_unlock(&sdcardfs_super_list_lock);
-       return;
 }
 
 static void remove_userid_exclude_entry_locked(const struct qstr *key, userid_t userid)
@@ -447,7 +450,6 @@ static void remove_userid_exclude_entry(const struct qstr *key, userid_t userid)
        remove_userid_exclude_entry_locked(key, userid);
        fixup_all_perms_name_userid(key, userid);
        mutex_unlock(&sdcardfs_super_list_lock);
-       return;
 }
 
 static void packagelist_destroy(void)
@@ -456,6 +458,7 @@ static void packagelist_destroy(void)
        struct hlist_node *h_t;
        HLIST_HEAD(free_list);
        int i;
+
        mutex_lock(&sdcardfs_super_list_lock);
        hash_for_each_rcu(package_to_appid, i, hash_cur, hlist) {
                hash_del_rcu(&hash_cur->hlist);
@@ -644,6 +647,7 @@ static struct config_item *extension_details_make_item(struct config_group *grou
        struct extension_details *extension_details = kzalloc(sizeof(struct extension_details), GFP_KERNEL);
        const char *tmp;
        int ret;
+
        if (!extension_details)
                return ERR_PTR(-ENOMEM);
 
@@ -698,6 +702,7 @@ static struct config_group *extensions_make_group(struct config_group *group, co
 static void extensions_drop_group(struct config_group *group, struct config_item *item)
 {
        struct extensions_value *value = to_extensions_value(item);
+
        printk(KERN_INFO "sdcardfs: No longer mapping any files to gid %d\n", value->num);
        kfree(value);
 }
@@ -851,6 +856,7 @@ static int configfs_sdcardfs_init(void)
 {
        int ret, i;
        struct configfs_subsystem *subsys = &sdcardfs_packages.subsystem;
+
        for (i = 0; sd_default_groups[i]; i++) {
                config_group_init(sd_default_groups[i]);
        }
@@ -881,7 +887,7 @@ int packagelist_init(void)
        }
 
        configfs_sdcardfs_init();
-        return 0;
+       return 0;
 }
 
 void packagelist_exit(void)
index 2caee49aa8ec9f66c42f7ac6bf1352f05f2a80e2..b09584cb9a9cec84be2f1b3573b324818a7885bc 100644 (file)
        } while (0)
 
 /* OVERRIDE_CRED() and REVERT_CRED()
- *     OVERRID_CRED()
- *             backup original task->cred
- *             and modifies task->cred->fsuid/fsgid to specified value.
+ *     OVERRIDE_CRED()
+ *             backup original task->cred
+ *             and modifies task->cred->fsuid/fsgid to specified value.
  *     REVERT_CRED()
- *             restore original task->cred->fsuid/fsgid.
+ *             restore original task->cred->fsuid/fsgid.
  * These two macro should be used in pair, and OVERRIDE_CRED() should be
  * placed at the beginning of a function, right after variable declaration.
  */
 /* Android 5.0 support */
 
 /* Permission mode for a specific node. Controls how file permissions
- * are derived for children nodes. */
+ * are derived for children nodes.
+ */
 typedef enum {
-    /* Nothing special; this node should just inherit from its parent. */
-    PERM_INHERIT,
-    /* This node is one level above a normal root; used for legacy layouts
-     * which use the first level to represent user_id. */
-    PERM_PRE_ROOT,
-    /* This node is "/" */
-    PERM_ROOT,
-    /* This node is "/Android" */
-    PERM_ANDROID,
-    /* This node is "/Android/data" */
-    PERM_ANDROID_DATA,
-    /* This node is "/Android/obb" */
-    PERM_ANDROID_OBB,
-    /* This node is "/Android/media" */
-    PERM_ANDROID_MEDIA,
-    /* This node is "/Android/[data|media|obb]/[package]" */
-    PERM_ANDROID_PACKAGE,
-    /* This node is "/Android/[data|media|obb]/[package]/cache" */
-    PERM_ANDROID_PACKAGE_CACHE,
+       /* Nothing special; this node should just inherit from its parent. */
+       PERM_INHERIT,
+       /* This node is one level above a normal root; used for legacy layouts
+        * which use the first level to represent user_id.
+        */
+       PERM_PRE_ROOT,
+       /* This node is "/" */
+       PERM_ROOT,
+       /* This node is "/Android" */
+       PERM_ANDROID,
+       /* This node is "/Android/data" */
+       PERM_ANDROID_DATA,
+       /* This node is "/Android/obb" */
+       PERM_ANDROID_OBB,
+       /* This node is "/Android/media" */
+       PERM_ANDROID_MEDIA,
+       /* This node is "/Android/[data|media|obb]/[package]" */
+       PERM_ANDROID_PACKAGE,
+       /* This node is "/Android/[data|media|obb]/[package]/cache" */
+       PERM_ANDROID_PACKAGE_CACHE,
 } perm_t;
 
 struct sdcardfs_sb_info;
@@ -142,9 +144,9 @@ struct sdcardfs_mount_options;
 struct sdcardfs_inode_info;
 
 /* Do not directly use this function. Use OVERRIDE_CRED() instead. */
-const struct cred * override_fsids(struct sdcardfs_sb_info* sbi, struct sdcardfs_inode_info *info);
+const struct cred *override_fsids(struct sdcardfs_sb_info *sbi, struct sdcardfs_inode_info *info);
 /* Do not directly use this function, use REVERT_CRED() instead. */
-void revert_fsids(const struct cred * old_cred);
+void revert_fsids(const struct cred *old_cred);
 
 /* operations vectors defined in specific files */
 extern const struct file_operations sdcardfs_main_fops;
@@ -221,7 +223,8 @@ struct sdcardfs_sb_info {
        struct super_block *sb;
        struct super_block *lower_sb;
        /* derived perm policy : some of options have been added
-        * to sdcardfs_mount_options (Android 4.4 support) */
+        * to sdcardfs_mount_options (Android 4.4 support)
+        */
        struct sdcardfs_mount_options options;
        spinlock_t lock;        /* protects obbpath */
        char *obbpath_s;
@@ -332,7 +335,7 @@ static inline void sdcardfs_put_reset_##pname(const struct dentry *dent) \
 { \
        struct path pname; \
        spin_lock(&SDCARDFS_D(dent)->lock); \
-       if(SDCARDFS_D(dent)->pname.dentry) { \
+       if (SDCARDFS_D(dent)->pname.dentry) { \
                pathcpy(&pname, &SDCARDFS_D(dent)->pname); \
                SDCARDFS_D(dent)->pname.dentry = NULL; \
                SDCARDFS_D(dent)->pname.mnt = NULL; \
@@ -348,17 +351,17 @@ SDCARDFS_DENT_FUNC(orig_path)
 
 static inline bool sbinfo_has_sdcard_magic(struct sdcardfs_sb_info *sbinfo)
 {
-  return sbinfo && sbinfo->sb && sbinfo->sb->s_magic == SDCARDFS_SUPER_MAGIC;
+       return sbinfo && sbinfo->sb && sbinfo->sb->s_magic == SDCARDFS_SUPER_MAGIC;
 }
 
 /* grab a refererence if we aren't linking to ourself */
 static inline void set_top(struct sdcardfs_inode_info *info, struct inode *top)
 {
        struct inode *old_top = NULL;
+
        BUG_ON(IS_ERR_OR_NULL(top));
-       if (info->top && info->top != &info->vfs_inode) {
+       if (info->top && info->top != &info->vfs_inode)
                old_top = info->top;
-       }
        if (top != &info->vfs_inode)
                igrab(top);
        info->top = top;
@@ -368,11 +371,11 @@ static inline void set_top(struct sdcardfs_inode_info *info, struct inode *top)
 static inline struct inode *grab_top(struct sdcardfs_inode_info *info)
 {
        struct inode *top = info->top;
-       if (top) {
+
+       if (top)
                return igrab(top);
-       } else {
+       else
                return NULL;
-       }
 }
 
 static inline void release_top(struct sdcardfs_inode_info *info)
@@ -380,21 +383,24 @@ static inline void release_top(struct sdcardfs_inode_info *info)
        iput(info->top);
 }
 
-static inline int get_gid(struct vfsmount *mnt, struct sdcardfs_inode_info *info) {
+static inline int get_gid(struct vfsmount *mnt, struct sdcardfs_inode_info *info)
+{
        struct sdcardfs_vfsmount_options *opts = mnt->data;
 
-       if (opts->gid == AID_SDCARD_RW) {
+       if (opts->gid == AID_SDCARD_RW)
                /* As an optimization, certain trusted system components only run
                 * as owner but operate across all users. Since we're now handing
                 * out the sdcard_rw GID only to trusted apps, we're okay relaxing
                 * the user boundary enforcement for the default view. The UIDs
-                * assigned to app directories are still multiuser aware. */
+                * assigned to app directories are still multiuser aware.
+                */
                return AID_SDCARD_RW;
-       } else {
+       else
                return multiuser_get_uid(info->userid, opts->gid);
-       }
 }
-static inline int get_mode(struct vfsmount *mnt, struct sdcardfs_inode_info *info) {
+
+static inline int get_mode(struct vfsmount *mnt, struct sdcardfs_inode_info *info)
+{
        int owner_mode;
        int filtered_mode;
        struct sdcardfs_vfsmount_options *opts = mnt->data;
@@ -403,17 +409,18 @@ static inline int get_mode(struct vfsmount *mnt, struct sdcardfs_inode_info *inf
 
        if (info->perm == PERM_PRE_ROOT) {
                /* Top of multi-user view should always be visible to ensure
-               * secondary users can traverse inside. */
+               * secondary users can traverse inside.
+               */
                visible_mode = 0711;
        } else if (info->under_android) {
                /* Block "other" access to Android directories, since only apps
                * belonging to a specific user should be in there; we still
-               * leave +x open for the default view. */
-               if (opts->gid == AID_SDCARD_RW) {
+               * leave +x open for the default view.
+               */
+               if (opts->gid == AID_SDCARD_RW)
                        visible_mode = visible_mode & ~0006;
-               } else {
+               else
                        visible_mode = visible_mode & ~0007;
-               }
        }
        owner_mode = info->lower_inode->i_mode & 0700;
        filtered_mode = visible_mode & (owner_mode | (owner_mode >> 3) | (owner_mode >> 6));
@@ -438,7 +445,7 @@ static inline void sdcardfs_get_real_lower(const struct dentry *dent,
        /* in case of a local obb dentry
         * the orig_path should be returned
         */
-       if(has_graft_path(dent))
+       if (has_graft_path(dent))
                sdcardfs_get_orig_path(dent, real_lower);
        else
                sdcardfs_get_lower_path(dent, real_lower);
@@ -447,7 +454,7 @@ static inline void sdcardfs_get_real_lower(const struct dentry *dent,
 static inline void sdcardfs_put_real_lower(const struct dentry *dent,
                                                struct path *real_lower)
 {
-       if(has_graft_path(dent))
+       if (has_graft_path(dent))
                sdcardfs_put_orig_path(dent, real_lower);
        else
                sdcardfs_put_lower_path(dent, real_lower);
@@ -460,7 +467,7 @@ extern struct list_head sdcardfs_super_list;
 extern appid_t get_appid(const char *app_name);
 extern appid_t get_ext_gid(const char *app_name);
 extern appid_t is_excluded(const char *app_name, userid_t userid);
-extern int check_caller_access_to_name(struct inode *parent_node, const struct qstrname);
+extern int check_caller_access_to_name(struct inode *parent_node, const struct qstr *name);
 extern int open_flags_to_access_mode(int open_flags);
 extern int packagelist_init(void);
 extern void packagelist_exit(void);
@@ -481,7 +488,7 @@ extern void get_derived_permission_new(struct dentry *parent, struct dentry *den
 extern void fixup_perms_recursive(struct dentry *dentry, struct limit_search *limit);
 
 extern void update_derived_permission_lock(struct dentry *dentry);
-void fixup_lower_ownership(struct dentrydentry, const char *name);
+void fixup_lower_ownership(struct dentry *dentry, const char *name);
 extern int need_graft_path(struct dentry *dentry);
 extern int is_base_obbpath(struct dentry *dentry);
 extern int is_obbpath_invalid(struct dentry *dentry);
@@ -491,6 +498,7 @@ extern int setup_obb_dentry(struct dentry *dentry, struct path *lower_path);
 static inline struct dentry *lock_parent(struct dentry *dentry)
 {
        struct dentry *dir = dget_parent(dentry);
+
        mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
        return dir;
 }
@@ -610,7 +618,8 @@ static inline bool str_case_eq(const char *s1, const char *s2)
        return !strcasecmp(s1, s2);
 }
 
-static inline bool str_n_case_eq(const char *s1, const char *s2, size_t len) {
+static inline bool str_n_case_eq(const char *s1, const char *s2, size_t len)
+{
        return !strncasecmp(s1, s2, len);
 }
 
index edda32b68dc08d5f48213f0c20d75aac4b3fd07b..a4629f20812e66121e6762c847092b8ed23cd60b 100644 (file)
@@ -36,7 +36,7 @@ static void sdcardfs_put_super(struct super_block *sb)
        if (!spd)
                return;
 
-       if(spd->obbpath_s) {
+       if (spd->obbpath_s) {
                kfree(spd->obbpath_s);
                path_put(&spd->obbpath);
        }
@@ -125,29 +125,33 @@ static int sdcardfs_remount_fs2(struct vfsmount *mnt, struct super_block *sb,
         * SILENT, but anything else left over is an error.
         */
        if ((*flags & ~(MS_RDONLY | MS_MANDLOCK | MS_SILENT | MS_REMOUNT)) != 0) {
-               printk(KERN_ERR
-                      "sdcardfs: remount flags 0x%x unsupported\n", *flags);
+               pr_err("sdcardfs: remount flags 0x%x unsupported\n", *flags);
                err = -EINVAL;
        }
-       printk(KERN_INFO "Remount options were %s for vfsmnt %p.\n", options, mnt);
+       pr_info("Remount options were %s for vfsmnt %p.\n", options, mnt);
        err = parse_options_remount(sb, options, *flags & ~MS_SILENT, mnt->data);
 
 
        return err;
 }
 
-static void* sdcardfs_clone_mnt_data(void *data) {
-       struct sdcardfs_vfsmount_options* opt = kmalloc(sizeof(struct sdcardfs_vfsmount_options), GFP_KERNEL);
-       struct sdcardfs_vfsmount_options* old = data;
-       if(!opt) return NULL;
+static void *sdcardfs_clone_mnt_data(void *data)
+{
+       struct sdcardfs_vfsmount_options *opt = kmalloc(sizeof(struct sdcardfs_vfsmount_options), GFP_KERNEL);
+       struct sdcardfs_vfsmount_options *old = data;
+
+       if (!opt)
+               return NULL;
        opt->gid = old->gid;
        opt->mask = old->mask;
        return opt;
 }
 
-static void sdcardfs_copy_mnt_data(void *data, void *newdata) {
-       struct sdcardfs_vfsmount_options* old = data;
-       struct sdcardfs_vfsmount_options* new = newdata;
+static void sdcardfs_copy_mnt_data(void *data, void *newdata)
+{
+       struct sdcardfs_vfsmount_options *old = data;
+       struct sdcardfs_vfsmount_options *new = newdata;
+
        old->gid = new->gid;
        old->mask = new->mask;
 }
@@ -235,7 +239,8 @@ static void sdcardfs_umount_begin(struct super_block *sb)
                lower_sb->s_op->umount_begin(lower_sb);
 }
 
-static int sdcardfs_show_options(struct vfsmount *mnt, struct seq_file *m, struct dentry *root)
+static int sdcardfs_show_options(struct vfsmount *mnt, struct seq_file *m,
+                       struct dentry *root)
 {
        struct sdcardfs_sb_info *sbi = SDCARDFS_SB(root->d_sb);
        struct sdcardfs_mount_options *opts = &sbi->options;