diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index e8e2cbe..075b258 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -257,12 +257,12 @@ } if (c->di.ro_mode) { - ubifs_msg("read-only UBI device"); + dbg_msg("read-only UBI device"); c->ro_media = 1; } if (c->vi.vol_type == UBI_STATIC_VOLUME) { - ubifs_msg("static UBI volume - read-only mode"); + dbg_msg("static UBI volume - read-only mode"); c->ro_media = 1; } @@ -540,6 +540,7 @@ int err, mounted_read_only = ubifs_readonly(c); long long x; size_t sz; + char str[128]; err = init_constants_early(c); if (err) @@ -676,18 +677,19 @@ ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"", c->vi.ubi_num, c->vi.vol_id, c->vi.name); if (mounted_read_only) - ubifs_msg("mounted read-only"); + dbg_msg("mounted read-only"); x = (long long)c->main_lebs * c->leb_size; - ubifs_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d " + c->fs_size_mb = x >> 20; + dbg_msg("file system size: %lld bytes (%lld KiB, %lld MiB, %d " "LEBs)", x, x >> 10, x >> 20, c->main_lebs); x = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; - ubifs_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d " + dbg_msg("journal size: %lld bytes (%lld KiB, %lld MiB, %d " "LEBs)", x, x >> 10, x >> 20, c->log_lebs + c->max_bud_cnt); - ubifs_msg("media format: w%d/r%d (latest is w%d/r%d)", + dbg_msg("media format: w%d/r%d (latest is w%d/r%d)", c->fmt_version, c->ro_compat_version, UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); - ubifs_msg("default compressor: %s", ubifs_compr_name(c->default_compr)); - ubifs_msg("reserved for root: %llu bytes (%llu KiB)", + dbg_msg("default compressor: %s", ubifs_compr_name(c->default_compr)); + dbg_msg("reserved for root: %llu bytes (%llu KiB)", c->report_rp_size, c->report_rp_size >> 10); dbg_msg("compiled on: " __DATE__ " at " __TIME__); @@ -696,6 +698,14 @@ c->leb_size, c->leb_size >> 10); dbg_msg("data journal heads: %d", c->jhead_cnt - NONDATA_JHEADS_CNT); + + dev_add_param_int_ro(c->dev, "filesystem_size_mb", c->fs_size_mb, "%d"); + dev_add_param_fixed(c->dev, "default_compressor", ubifs_compr_name(c->default_compr)); + sprintf(str, "w%d/r%d", c->fmt_version, c->ro_compat_version); + dev_add_param_fixed(c->dev, "media_format", str); + sprintf(str, "w%d/r%d", UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); + dev_add_param_fixed(c->dev, "media_format_latest", str); + dbg_msg("UUID: %02X%02X%02X%02X-%02X%02X" "-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", c->uuid[0], c->uuid[1], c->uuid[2], c->uuid[3], @@ -804,7 +814,7 @@ ubifs_debugging_exit(c); } -struct super_block *ubifs_get_super(struct ubi_volume_desc *ubi, int silent) +struct super_block *ubifs_get_super(struct device_d *dev, struct ubi_volume_desc *ubi, int silent) { struct super_block *sb; struct ubifs_info *c; @@ -814,6 +824,8 @@ sb = xzalloc(sizeof(*sb)); c = xzalloc(sizeof(struct ubifs_info)); + c->dev = dev; + spin_lock_init(&c->cnt_lock); spin_lock_init(&c->cs_lock); spin_lock_init(&c->buds_lock); diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 44a9e97..35923a9 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -610,7 +610,7 @@ goto err_free; } - priv->sb = ubifs_get_super(priv->ubi, 0); + priv->sb = ubifs_get_super(dev, priv->ubi, 0); if (IS_ERR(priv->sb)) { ret = PTR_ERR(priv->sb); goto err; diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index fea1584..b4a9d76 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -470,12 +470,8 @@ #define UBIFS_VERSION 1 /* Normal UBIFS messages */ -#ifdef CONFIG_UBIFS_SILENCE_MSG -#define ubifs_msg(fmt, ...) -#else #define ubifs_msg(fmt, ...) \ - pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) -#endif + pr_info("UBIFS: " fmt "\n", ##__VA_ARGS__) /* UBIFS error messages */ #define ubifs_err(fmt, ...) \ pr_err("UBIFS error (pid %d): %s: " fmt "\n", 0, \ @@ -1824,6 +1820,9 @@ int always_chk_crc; struct ubifs_mount_opts mount_opts; + unsigned int fs_size_mb; + struct device_d *dev; + #ifdef CONFIG_UBIFS_FS_DEBUG struct ubifs_debug_info *dbg; #endif @@ -2140,7 +2139,7 @@ #include "misc.h" #include "key.h" -struct super_block *ubifs_get_super(struct ubi_volume_desc *ubi, int silent); +struct super_block *ubifs_get_super(struct device_d *dev, struct ubi_volume_desc *ubi, int silent); void ubifs_umount(struct ubifs_info *); static inline int ubifs_readonly(struct ubifs_info *c)