]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/udf/super.c
udf: Convert printks to pr_<level>
[mirror_ubuntu-artful-kernel.git] / fs / udf / super.c
index 7b27b063ff6d673423ecd0902d0076f1c0ea3ccf..39e3f351c7a60401809da2f2a9642e56ed90e64d 100644 (file)
@@ -92,8 +92,6 @@ static void udf_close_lvid(struct super_block *);
 static unsigned int udf_count_free(struct super_block *);
 static int udf_statfs(struct dentry *, struct kstatfs *);
 static int udf_show_options(struct seq_file *, struct vfsmount *);
-static void udf_error(struct super_block *sb, const char *function,
-                     const char *fmt, ...);
 
 struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct udf_sb_info *sbi)
 {
@@ -244,9 +242,8 @@ static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count)
        sbi->s_partmaps = kcalloc(count, sizeof(struct udf_part_map),
                                  GFP_KERNEL);
        if (!sbi->s_partmaps) {
-               udf_error(sb, __func__,
-                         "Unable to allocate space for %d partition maps",
-                         count);
+               udf_err(sb, "Unable to allocate space for %d partition maps\n",
+                       count);
                sbi->s_partitions = 0;
                return -ENOMEM;
        }
@@ -550,8 +547,7 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
                        uopt->dmode = option & 0777;
                        break;
                default:
-                       printk(KERN_ERR "udf: bad mount option \"%s\" "
-                              "or missing value\n", p);
+                       pr_err("bad mount option \"%s\" or missing value\n", p);
                        return 0;
                }
        }
@@ -858,13 +854,11 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
        mdata->s_metadata_fe = udf_iget(sb, &addr);
 
        if (mdata->s_metadata_fe == NULL) {
-               udf_warning(sb, __func__, "metadata inode efe not found, "
-                               "will try mirror inode.");
+               udf_warn(sb, "metadata inode efe not found, will try mirror inode\n");
                fe_error = 1;
        } else if (UDF_I(mdata->s_metadata_fe)->i_alloc_type !=
                 ICBTAG_FLAG_AD_SHORT) {
-               udf_warning(sb, __func__, "metadata inode efe does not have "
-                       "short allocation descriptors!");
+               udf_warn(sb, "metadata inode efe does not have short allocation descriptors!\n");
                fe_error = 1;
                iput(mdata->s_metadata_fe);
                mdata->s_metadata_fe = NULL;
@@ -881,16 +875,13 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
 
        if (mdata->s_mirror_fe == NULL) {
                if (fe_error) {
-                       udf_error(sb, __func__, "mirror inode efe not found "
-                       "and metadata inode is missing too, exiting...");
+                       udf_err(sb, "mirror inode efe not found and metadata inode is missing too, exiting...\n");
                        goto error_exit;
                } else
-                       udf_warning(sb, __func__, "mirror inode efe not found,"
-                                       " but metadata inode is OK");
+                       udf_warn(sb, "mirror inode efe not found, but metadata inode is OK\n");
        } else if (UDF_I(mdata->s_mirror_fe)->i_alloc_type !=
                 ICBTAG_FLAG_AD_SHORT) {
-               udf_warning(sb, __func__, "mirror inode efe does not have "
-                       "short allocation descriptors!");
+               udf_warn(sb, "mirror inode efe does not have short allocation descriptors!\n");
                iput(mdata->s_mirror_fe);
                mdata->s_mirror_fe = NULL;
                if (fe_error)
@@ -913,12 +904,9 @@ static int udf_load_metadata_files(struct super_block *sb, int partition)
 
                if (mdata->s_bitmap_fe == NULL) {
                        if (sb->s_flags & MS_RDONLY)
-                               udf_warning(sb, __func__, "bitmap inode efe "
-                                       "not found but it's ok since the disc"
-                                       " is mounted read-only");
+                               udf_warn(sb, "bitmap inode efe not found but it's ok since the disc is mounted read-only\n");
                        else {
-                               udf_error(sb, __func__, "bitmap inode efe not "
-                                       "found and attempted read-write mount");
+                               udf_err(sb, "bitmap inode efe not found and attempted read-write mount\n");
                                goto error_exit;
                        }
                }
@@ -971,9 +959,8 @@ static struct udf_bitmap *udf_sb_alloc_bitmap(struct super_block *sb, u32 index)
                bitmap = vzalloc(size); /* TODO: get rid of vzalloc */
 
        if (bitmap == NULL) {
-               udf_error(sb, __func__,
-                         "Unable to allocate space for bitmap "
-                         "and %d buffer_head pointers", nr_groups);
+               udf_err(sb, "Unable to allocate space for bitmap and %d buffer_head pointers\n",
+                       nr_groups);
                return NULL;
        }
 
@@ -1118,11 +1105,9 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
        udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block);
        if (!sbi->s_vat_inode &&
            sbi->s_last_block != blocks - 1) {
-               printk(KERN_NOTICE "UDF-fs: Failed to read VAT inode from the"
-                      " last recorded block (%lu), retrying with the last "
-                      "block of the device (%lu).\n",
-                      (unsigned long)sbi->s_last_block,
-                      (unsigned long)blocks - 1);
+               pr_notice("Failed to read VAT inode from the last recorded block (%lu), retrying with the last block of the device (%lu).\n",
+                         (unsigned long)sbi->s_last_block,
+                         (unsigned long)blocks - 1);
                udf_find_vat_block(sb, p_index, type1_index, blocks - 1);
        }
        if (!sbi->s_vat_inode)
@@ -1220,8 +1205,8 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
        if (map->s_partition_type == UDF_METADATA_MAP25) {
                ret = udf_load_metadata_files(sb, i);
                if (ret) {
-                       printk(KERN_ERR "UDF-fs: error loading MetaData "
-                       "partition map %d\n", i);
+                       udf_err(sb, "error loading MetaData partition map %d\n",
+                               i);
                        goto out_bh;
                }
        } else {
@@ -1234,9 +1219,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
                 * overwrite blocks instead of relocating them).
                 */
                sb->s_flags |= MS_RDONLY;
-               printk(KERN_NOTICE "UDF-fs: Filesystem marked read-only "
-                       "because writing to pseudooverwrite partition is "
-                       "not implemented.\n");
+               pr_notice("Filesystem marked read-only because writing to pseudooverwrite partition is not implemented\n");
        }
 out_bh:
        /* In case loading failed, we handle cleanup in udf_fill_super */
@@ -1478,9 +1461,9 @@ static noinline int udf_process_sequence(struct super_block *sb, long block,
 
                bh = udf_read_tagged(sb, block, block, &ident);
                if (!bh) {
-                       printk(KERN_ERR "udf: Block %Lu of volume descriptor "
-                              "sequence is corrupted or we could not read "
-                              "it.\n", (unsigned long long)block);
+                       udf_err(sb,
+                               "Block %llu of volume descriptor sequence is corrupted or we could not read it\n",
+                               (unsigned long long)block);
                        return 1;
                }
 
@@ -1553,7 +1536,7 @@ static noinline int udf_process_sequence(struct super_block *sb, long block,
         * in a suitable order
         */
        if (!vds[VDS_POS_PRIMARY_VOL_DESC].block) {
-               printk(KERN_ERR "udf: Primary Volume Descriptor not found!\n");
+               udf_err(sb, "Primary Volume Descriptor not found!\n");
                return 1;
        }
        if (udf_load_pvoldesc(sb, vds[VDS_POS_PRIMARY_VOL_DESC].block))
@@ -1740,7 +1723,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
 
        if (!sb_set_blocksize(sb, uopt->blocksize)) {
                if (!silent)
-                       printk(KERN_WARNING "UDF-fs: Bad block size\n");
+                       udf_warn(sb, "Bad block size\n");
                return 0;
        }
        sbi->s_last_block = uopt->lastblock;
@@ -1749,7 +1732,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
                nsr_off = udf_check_vsd(sb);
                if (!nsr_off) {
                        if (!silent)
-                               printk(KERN_WARNING "UDF-fs: No VRS found\n");
+                               udf_warn(sb, "No VRS found\n");
                        return 0;
                }
                if (nsr_off == -1)
@@ -1765,7 +1748,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt,
        sbi->s_anchor = uopt->anchor;
        if (!udf_find_anchor(sb, fileset)) {
                if (!silent)
-                       printk(KERN_WARNING "UDF-fs: No anchor found\n");
+                       udf_warn(sb, "No anchor found\n");
                return 0;
        }
        return 1;
@@ -1937,8 +1920,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 
        if (uopt.flags & (1 << UDF_FLAG_UTF8) &&
            uopt.flags & (1 << UDF_FLAG_NLS_MAP)) {
-               udf_error(sb, "udf_read_super",
-                         "utf8 cannot be combined with iocharset\n");
+               udf_err(sb, "utf8 cannot be combined with iocharset\n");
                goto error_out;
        }
 #ifdef CONFIG_UDF_NLS
@@ -1987,15 +1969,14 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
                ret = udf_load_vrs(sb, &uopt, silent, &fileset);
                if (!ret && uopt.blocksize != UDF_DEFAULT_BLOCKSIZE) {
                        if (!silent)
-                               printk(KERN_NOTICE
-                                      "UDF-fs: Rescanning with blocksize "
-                                      "%d\n", UDF_DEFAULT_BLOCKSIZE);
+                               pr_notice("Rescanning with blocksize %d\n",
+                                         UDF_DEFAULT_BLOCKSIZE);
                        uopt.blocksize = UDF_DEFAULT_BLOCKSIZE;
                        ret = udf_load_vrs(sb, &uopt, silent, &fileset);
                }
        }
        if (!ret) {
-               printk(KERN_WARNING "UDF-fs: No partition found (1)\n");
+               udf_warn(sb, "No partition found (1)\n");
                goto error_out;
        }
 
@@ -2010,10 +1991,9 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
                                le16_to_cpu(lvidiu->maxUDFWriteRev); */
 
                if (minUDFReadRev > UDF_MAX_READ_VERSION) {
-                       printk(KERN_ERR "UDF-fs: minUDFReadRev=%x "
-                                       "(max is %x)\n",
-                              le16_to_cpu(lvidiu->minUDFReadRev),
-                              UDF_MAX_READ_VERSION);
+                       udf_err(sb, "minUDFReadRev=%x (max is %x)\n",
+                               le16_to_cpu(lvidiu->minUDFReadRev),
+                               UDF_MAX_READ_VERSION);
                        goto error_out;
                } else if (minUDFWriteRev > UDF_MAX_WRITE_VERSION)
                        sb->s_flags |= MS_RDONLY;
@@ -2027,28 +2007,27 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        }
 
        if (!sbi->s_partitions) {
-               printk(KERN_WARNING "UDF-fs: No partition found (2)\n");
+               udf_warn(sb, "No partition found (2)\n");
                goto error_out;
        }
 
        if (sbi->s_partmaps[sbi->s_partition].s_partition_flags &
                        UDF_PART_FLAG_READ_ONLY) {
-               printk(KERN_NOTICE "UDF-fs: Partition marked readonly; "
-                                  "forcing readonly mount\n");
+               pr_notice("Partition marked readonly; forcing readonly mount\n");
                sb->s_flags |= MS_RDONLY;
        }
 
        if (udf_find_fileset(sb, &fileset, &rootdir)) {
-               printk(KERN_WARNING "UDF-fs: No fileset found\n");
+               udf_warn(sb, "No fileset found\n");
                goto error_out;
        }
 
        if (!silent) {
                struct timestamp ts;
                udf_time_to_disk_stamp(&ts, sbi->s_record_time);
-               udf_info("UDF: Mounting volume '%s', "
-                        "timestamp %04u/%02u/%02u %02u:%02u (%x)\n",
-                        sbi->s_volume_ident, le16_to_cpu(ts.year), ts.month, ts.day,
+               udf_info("Mounting volume '%s', timestamp %04u/%02u/%02u %02u:%02u (%x)\n",
+                        sbi->s_volume_ident,
+                        le16_to_cpu(ts.year), ts.month, ts.day,
                         ts.hour, ts.minute, le16_to_cpu(ts.typeAndTimezone));
        }
        if (!(sb->s_flags & MS_RDONLY))
@@ -2059,8 +2038,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        /* perhaps it's not extensible enough, but for now ... */
        inode = udf_iget(sb, &rootdir);
        if (!inode) {
-               printk(KERN_ERR "UDF-fs: Error in udf_iget, block=%d, "
-                               "partition=%d\n",
+               udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n",
                       rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
                goto error_out;
        }
@@ -2068,7 +2046,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
        /* Allocate a dentry for the root inode */
        sb->s_root = d_alloc_root(inode);
        if (!sb->s_root) {
-               printk(KERN_ERR "UDF-fs: Couldn't allocate root dentry\n");
+               udf_err(sb, "Couldn't allocate root dentry\n");
                iput(inode);
                goto error_out;
        }
@@ -2096,8 +2074,8 @@ error_out:
        return -EINVAL;
 }
 
-static void udf_error(struct super_block *sb, const char *function,
-                     const char *fmt, ...)
+void _udf_err(struct super_block *sb, const char *function,
+             const char *fmt, ...)
 {
        va_list args;
 
@@ -2108,19 +2086,19 @@ static void udf_error(struct super_block *sb, const char *function,
        va_start(args, fmt);
        vsnprintf(error_buf, sizeof(error_buf), fmt, args);
        va_end(args);
-       printk(KERN_CRIT "UDF-fs error (device %s): %s: %s\n",
-               sb->s_id, function, error_buf);
+       pr_crit("error (device %s): %s: %s",
+              sb->s_id, function, error_buf);
 }
 
-void udf_warning(struct super_block *sb, const char *function,
-                const char *fmt, ...)
+void _udf_warn(struct super_block *sb, const char *function,
+              const char *fmt, ...)
 {
        va_list args;
 
        va_start(args, fmt);
        vsnprintf(error_buf, sizeof(error_buf), fmt, args);
        va_end(args);
-       printk(KERN_WARNING "UDF-fs warning (device %s): %s: %s\n",
+       pr_warn("warning (device %s): %s: %s",
               sb->s_id, function, error_buf);
 }
 
@@ -2213,11 +2191,11 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb,
        bh = udf_read_ptagged(sb, &loc, 0, &ident);
 
        if (!bh) {
-               printk(KERN_ERR "udf: udf_count_free failed\n");
+               udf_err(sb, "udf_count_free failed\n");
                goto out;
        } else if (ident != TAG_IDENT_SBD) {
                brelse(bh);
-               printk(KERN_ERR "udf: udf_count_free failed\n");
+               udf_err(sb, "udf_count_free failed\n");
                goto out;
        }