ANDROID: sdcardfs: Use pr_[...] instead of printk
authorDaniel Rosenberg <drosen@google.com>
Fri, 17 Mar 2017 00:46:13 +0000 (17:46 -0700)
committerStricted <info@stricted.net>
Thu, 11 Oct 2018 16:03:33 +0000 (18:03 +0200)
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Bug: 35331000
Change-Id: Ibc635ec865750530d32b87067779f681fe58a003

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

index 2da612e39fa62b979bd49757e2096194257ed29f..78f0d2e29c7d33f18c4805ead5b437928513318f 100644 (file)
@@ -311,7 +311,7 @@ inline void update_derived_permission_lock(struct dentry *dentry)
        struct dentry *parent;
 
        if (!dentry || !dentry->d_inode) {
-               printk(KERN_ERR "sdcardfs: %s: invalid dentry\n", __func__);
+               pr_err("sdcardfs: %s: invalid dentry\n", __func__);
                return;
        }
        /* FIXME:
@@ -372,7 +372,7 @@ int is_obbpath_invalid(struct dentry *dent)
                        path_buf = kmalloc(PATH_MAX, GFP_ATOMIC);
                        if (!path_buf) {
                                ret = 1;
-                               printk(KERN_ERR "sdcardfs: fail to allocate path_buf in %s.\n", __func__);
+                               pr_err("sdcardfs: fail to allocate path_buf in %s.\n", __func__);
                        } else {
                                obbpath_s = d_path(&di->lower_path, path_buf, PATH_MAX);
                                if (d_unhashed(di->lower_path.dentry) ||
@@ -444,7 +444,7 @@ int setup_obb_dentry(struct dentry *dentry, struct path *lower_path)
                 * because the sdcard daemon also regards this case as
                 * a lookup fail.
                 */
-               printk(KERN_INFO "sdcardfs: the sbi->obbpath is not available\n");
+               pr_info("sdcardfs: the sbi->obbpath is not available\n");
        }
        return err;
 }
index ab78bb854c9f3bae345747cfc50aeaac19a4bd41..42f66f2425bec88c65e596661646cf5e10464e51 100644 (file)
@@ -65,7 +65,7 @@ static ssize_t sdcardfs_write(struct file *file, const char __user *buf,
 
        /* check disk space */
        if (!check_min_free_space(dentry, count, 0)) {
-               printk(KERN_INFO "No minimum free space.\n");
+               pr_err("No minimum free space.\n");
                return -ENOSPC;
        }
 
@@ -160,8 +160,7 @@ static int sdcardfs_mmap(struct file *file, struct vm_area_struct *vma)
        lower_file = sdcardfs_lower_file(file);
        if (willwrite && !lower_file->f_mapping->a_ops->writepage) {
                err = -EINVAL;
-               printk(KERN_ERR "sdcardfs: lower file system does not "
-                      "support writeable mmap\n");
+               pr_err("sdcardfs: lower file system does not support writeable mmap\n");
                goto out;
        }
 
@@ -173,14 +172,14 @@ static int sdcardfs_mmap(struct file *file, struct vm_area_struct *vma)
        if (!SDCARDFS_F(file)->lower_vm_ops) {
                err = lower_file->f_op->mmap(lower_file, vma);
                if (err) {
-                       printk(KERN_ERR "sdcardfs: lower mmap failed %d\n", err);
+                       pr_err("sdcardfs: lower mmap failed %d\n", err);
                        goto out;
                }
                saved_vm_ops = vma->vm_ops; /* save: came from lower ->mmap */
                err = do_munmap(current->mm, vma->vm_start,
                                vma->vm_end - vma->vm_start);
                if (err) {
-                       printk(KERN_ERR "sdcardfs: do_munmap failed %d\n", err);
+                       pr_err("sdcardfs: do_munmap failed %d\n", err);
                        goto out;
                }
        }
index c2f2dd929154094bdc1f429a5ecc271a0291e81a..71694c0e9f1454bb8c720ca6ad9bb396199b5e70 100644 (file)
@@ -248,7 +248,7 @@ static int touch(char *abs_path, mode_t mode)
                if (PTR_ERR(filp) == -EEXIST) {
                        return 0;
                } else {
-                       printk(KERN_ERR "sdcardfs: failed to open(%s): %ld\n",
+                       pr_err("sdcardfs: failed to open(%s): %ld\n",
                                                abs_path, PTR_ERR(filp));
                        return PTR_ERR(filp);
                }
@@ -284,7 +284,7 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
 
        /* check disk space */
        if (!check_min_free_space(dentry, 0, 1)) {
-               printk(KERN_INFO "sdcardfs: No minimum free space.\n");
+               pr_err("sdcardfs: No minimum free space.\n");
                err = -ENOSPC;
                goto out_revert;
        }
@@ -360,7 +360,7 @@ static int sdcardfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
                set_fs_pwd(current->fs, &lower_path);
                touch_err = touch(".nomedia", 0664);
                if (touch_err) {
-                       printk(KERN_ERR "sdcardfs: failed to create .nomedia in %s: %d\n",
+                       pr_err("sdcardfs: failed to create .nomedia in %s: %d\n",
                                                        lower_path.dentry->d_name.name, touch_err);
                        goto out;
                }
@@ -654,7 +654,7 @@ static int sdcardfs_permission(struct vfsmount *mnt, struct inode *inode, int ma
        release_top(SDCARDFS_I(inode));
        tmp.i_sb = inode->i_sb;
        if (IS_POSIXACL(inode))
-               printk(KERN_WARNING "%s: This may be undefined behavior... \n", __func__);
+               pr_warn("%s: This may be undefined behavior...\n", __func__);
        err = generic_permission(&tmp, mask);
        /* XXX
         * Original sdcardfs code calls inode_permission(lower_inode,.. )
index 0a442e4db675e1f459b4407bcc04a8083d56cdc7..c2f29d95f06f3dc0bb16d96b18e6ff4133d9a326 100644 (file)
@@ -323,7 +323,7 @@ put_name:
                                 * because the sdcard daemon also regards this case as
                                 * a lookup fail.
                                 */
-                               printk(KERN_INFO "sdcardfs: base obbpath is not available\n");
+                               pr_info("sdcardfs: base obbpath is not available\n");
                                sdcardfs_put_reset_orig_path(dentry);
                                goto out;
                        }
index c2159accc4e9506981872d1f84e1c05b3259bb45..fe5eb9397a6fd00b9b521b3ec8b9eef697f5f7b0 100644 (file)
@@ -117,19 +117,17 @@ static int parse_options(struct super_block *sb, char *options, int silent,
                        break;
                /* unknown option */
                default:
-                       if (!silent) {
-                               printk( KERN_ERR "Unrecognized mount option \"%s\" "
-                                               "or missing value", p);
-                       }
+                       if (!silent)
+                               pr_err("Unrecognized mount option \"%s\" or missing value", p);
                        return -EINVAL;
                }
        }
 
        if (*debug) {
-               printk( KERN_INFO "sdcardfs : options - debug:%d\n", *debug);
-               printk( KERN_INFO "sdcardfs : options - uid:%d\n",
+               pr_info("sdcardfs : options - debug:%d\n", *debug);
+               pr_info("sdcardfs : options - uid:%d\n",
                                                        opts->fs_low_uid);
-               printk( KERN_INFO "sdcardfs : options - gid:%d\n",
+               pr_info("sdcardfs : options - gid:%d\n",
                                                        opts->fs_low_gid);
        }
 
@@ -175,22 +173,20 @@ int parse_options_remount(struct super_block *sb, char *options, int silent,
                case Opt_fsuid:
                case Opt_fsgid:
                case Opt_reserved_mb:
-                       printk( KERN_WARNING "Option \"%s\" can't be changed during remount\n", p);
+                       pr_warn("Option \"%s\" can't be changed during remount\n", p);
                        break;
                /* unknown option */
                default:
-                       if (!silent) {
-                               printk( KERN_ERR "Unrecognized mount option \"%s\" "
-                                               "or missing value", p);
-                       }
+                       if (!silent)
+                               pr_err("Unrecognized mount option \"%s\" or missing value", p);
                        return -EINVAL;
                }
        }
 
        if (debug) {
-               printk( KERN_INFO "sdcardfs : options - debug:%d\n", debug);
-               printk( KERN_INFO "sdcardfs : options - gid:%d\n", vfsopts->gid);
-               printk( KERN_INFO "sdcardfs : options - mask:%d\n", vfsopts->mask);
+               pr_info("sdcardfs : options - debug:%d\n", debug);
+               pr_info("sdcardfs : options - gid:%d\n", vfsopts->gid);
+               pr_info("sdcardfs : options - mask:%d\n", vfsopts->mask);
        }
 
        return 0;
@@ -244,31 +240,30 @@ static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb,
        struct sdcardfs_vfsmount_options *mnt_opt = mnt->data;
        struct inode *inode;
 
-       printk(KERN_INFO "sdcardfs version 2.0\n");
+       pr_info("sdcardfs version 2.0\n");
 
        if (!dev_name) {
-               printk(KERN_ERR
-                      "sdcardfs: read_super: missing dev_name argument\n");
+               pr_err("sdcardfs: read_super: missing dev_name argument\n");
                err = -EINVAL;
                goto out;
        }
 
-       printk(KERN_INFO "sdcardfs: dev_name -> %s\n", dev_name);
-       printk(KERN_INFO "sdcardfs: options -> %s\n", (char *)raw_data);
-       printk(KERN_INFO "sdcardfs: mnt -> %p\n", mnt);
+       pr_info("sdcardfs: dev_name -> %s\n", dev_name);
+       pr_info("sdcardfs: options -> %s\n", (char *)raw_data);
+       pr_info("sdcardfs: mnt -> %p\n", mnt);
 
        /* parse lower path */
        err = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY,
                        &lower_path);
        if (err) {
-               printk(KERN_ERR "sdcardfs: error accessing lower directory '%s'\n", dev_name);
+               pr_err("sdcardfs: error accessing lower directory '%s'\n", dev_name);
                goto out;
        }
 
        /* allocate superblock private data */
        sb->s_fs_info = kzalloc(sizeof(struct sdcardfs_sb_info), GFP_KERNEL);
        if (!SDCARDFS_SB(sb)) {
-               printk(KERN_CRIT "sdcardfs: read_super: out of memory\n");
+               pr_crit("sdcardfs: read_super: out of memory\n");
                err = -ENOMEM;
                goto out_free;
        }
@@ -277,7 +272,7 @@ static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb,
        /* parse options */
        err = parse_options(sb, raw_data, silent, &debug, mnt_opt, &sb_info->options);
        if (err) {
-               printk(KERN_ERR "sdcardfs: invalid options\n");
+               pr_err("sdcardfs: invalid options\n");
                goto out_freesbi;
        }
 
@@ -347,7 +342,7 @@ static int sdcardfs_read_super(struct vfsmount *mnt, struct super_block *sb,
        mutex_unlock(&sdcardfs_super_list_lock);
 
        if (!silent)
-               printk(KERN_INFO "sdcardfs: mounted on top of %s type %s\n",
+               pr_info("sdcardfs: mounted on top of %s type %s\n",
                                dev_name, lower_sb->s_type->name);
        goto out; /* all is well */
 
index a3fd6967daafff220199f78c0205c9c36b182e6f..7f8c9e247f213c71fb1d9c4a9377481f99458348 100644 (file)
@@ -472,7 +472,7 @@ static void packagelist_destroy(void)
        hlist_for_each_entry_safe(hash_cur, h_t, &free_list, dlist)
                free_hashtable_entry(hash_cur);
        mutex_unlock(&sdcardfs_super_list_lock);
-       printk(KERN_INFO "sdcardfs: destroyed packagelist pkgld\n");
+       pr_info("sdcardfs: destroyed packagelist pkgld\n");
 }
 
 struct package_details {
@@ -568,7 +568,8 @@ static ssize_t package_details_clear_userid_store(struct package_details *packag
 static void package_details_release(struct config_item *item)
 {
        struct package_details *package_details = to_package_details(item);
-       printk(KERN_INFO "sdcardfs: removing %s\n", package_details->name.name);
+
+       pr_info("sdcardfs: removing %s\n", package_details->name.name);
        remove_packagelist_entry(&package_details->name);
        kfree(package_details->name.name);
        kfree(package_details);
@@ -625,7 +626,7 @@ static void extension_details_release(struct config_item *item)
 {
        struct extension_details *extension_details = to_extension_details(item);
 
-       printk(KERN_INFO "sdcardfs: No longer mapping %s files to gid %d\n",
+       pr_info("sdcardfs: No longer mapping %s files to gid %d\n",
                        extension_details->name.name, extension_details->num);
        remove_ext_gid_entry(&extension_details->name, extension_details->num);
        kfree(extension_details->name.name);
@@ -703,7 +704,7 @@ static void extensions_drop_group(struct config_group *group, struct config_item
 {
        struct extensions_value *value = to_extensions_value(item);
 
-       printk(KERN_INFO "sdcardfs: No longer mapping any files to gid %d\n", value->num);
+       pr_info("sdcardfs: No longer mapping any files to gid %d\n", value->num);
        kfree(value);
 }
 
@@ -857,14 +858,13 @@ static int configfs_sdcardfs_init(void)
        int ret, i;
        struct configfs_subsystem *subsys = &sdcardfs_packages.subsystem;
 
-       for (i = 0; sd_default_groups[i]; i++) {
+       for (i = 0; sd_default_groups[i]; i++)
                config_group_init(sd_default_groups[i]);
-       }
        config_group_init(&subsys->su_group);
        mutex_init(&subsys->su_mutex);
        ret = configfs_register_subsystem(subsys);
        if (ret) {
-               printk(KERN_ERR "Error %d while registering subsystem %s\n",
+               pr_err("Error %d while registering subsystem %s\n",
                       ret,
                       subsys->su_group.cg_item.ci_namebuf);
        }
@@ -882,7 +882,7 @@ int packagelist_init(void)
                kmem_cache_create("packagelist_hashtable_entry",
                                        sizeof(struct hashtable_entry), 0, 0, NULL);
        if (!hashtable_entry_cachep) {
-               printk(KERN_ERR "sdcardfs: failed creating pkgl_hashtable entry slab cache\n");
+               pr_err("sdcardfs: failed creating pkgl_hashtable entry slab cache\n");
                return -ENOMEM;
        }
 
index b09584cb9a9cec84be2f1b3573b324818a7885bc..53fcd23f467fbccc61a9170f9ec18856ec67dc7b 100644 (file)
@@ -53,7 +53,7 @@
 #define SDCARDFS_ROOT_INO     1
 
 /* useful for tracking code reachability */
-#define UDBG printk(KERN_DEFAULT "DBG:%s:%s:%d\n", __FILE__, __func__, __LINE__)
+#define UDBG pr_default("DBG:%s:%s:%d\n", __FILE__, __func__, __LINE__)
 
 #define SDCARDFS_DIRENT_SIZE 256
 
index 7d3c331379f59c68779ed9207a1afe479b25faf1..67b4ae24337ac57f380d5b59e495ce8e8cd2daa3 100644 (file)
@@ -64,7 +64,7 @@ static int sdcardfs_statfs(struct dentry *dentry, struct kstatfs *buf)
        if (sbi->options.reserved_mb) {
                /* Invalid statfs informations. */
                if (buf->f_bsize == 0) {
-                       printk(KERN_ERR "Returned block size is zero.\n");
+                       pr_err("Returned block size is zero.\n");
                        return -EINVAL;
                }
 
@@ -100,8 +100,7 @@ static int sdcardfs_remount_fs(struct super_block *sb, int *flags, char *options
         * SILENT, but anything else left over is an error.
         */
        if ((*flags & ~(MS_RDONLY | MS_MANDLOCK | MS_SILENT)) != 0) {
-               printk(KERN_ERR
-                      "sdcardfs: remount flags 0x%x unsupported\n", *flags);
+               pr_err("sdcardfs: remount flags 0x%x unsupported\n", *flags);
                err = -EINVAL;
        }