From: Artem Bityutskiy <dedekind1@gmail.com>
To: Mike Frysinger <vapier@gentoo.org>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 5/6] mtdinfo: add regioninfo/sectormap display
Date: Wed, 08 Jun 2011 16:41:29 +0300 [thread overview]
Message-ID: <1307540489.31223.87.camel@localhost> (raw)
In-Reply-To: <BANLkTimY1DwxBBi=peQzqwoLktgVna-0KA@mail.gmail.com>
I've just pushed this little patch to make sure the code is more
readable when you add your changes. Otherwise this "out:" label looks
ugly.
>From bc1f5c0902ce4e10f062d6e37f3f8773506e6915 Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Date: Wed, 8 Jun 2011 16:21:40 +0300
Subject: [PATCH] mtdinfo: separate out ubi information printing
We are going to add some more code which prints eraseblocks map, so we need to
make 'print_dev_info()' a bit smaller to keep the code readable.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
---
ubi-utils/src/mtdinfo.c | 41 +++++++++++++++++++++++------------------
1 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/ubi-utils/src/mtdinfo.c b/ubi-utils/src/mtdinfo.c
index 666d739..ca0ad71 100644
--- a/ubi-utils/src/mtdinfo.c
+++ b/ubi-utils/src/mtdinfo.c
@@ -160,6 +160,27 @@ static int translate_dev(libmtd_t libmtd, const char *node)
return 0;
}
+static void print_ubi_info(const struct mtd_info *mtd_info,
+ const struct mtd_dev_info *mtd)
+{
+ struct ubigen_info ui;
+
+ if (!mtd_info->sysfs_supported) {
+ errmsg("cannot provide UBI info, becasue sub-page size is "
+ "not known");
+ return;
+ }
+
+ ubigen_info_init(&ui, mtd->eb_size, mtd->min_io_size, mtd->subpage_size,
+ 0, 1, 0);
+ printf("Default UBI VID header offset: %d\n", ui.vid_hdr_offs);
+ printf("Default UBI data offset: %d\n", ui.data_offs);
+ printf("Default UBI LEB size: ");
+ ubiutils_print_bytes(ui.leb_size, 0);
+ printf("\n");
+ printf("Maximum UBI volumes count: %d\n", ui.max_volumes);
+}
+
static int print_dev_info(libmtd_t libmtd, const struct mtd_info *mtd_info, int mtdn)
{
int err;
@@ -206,25 +227,9 @@ static int print_dev_info(libmtd_t libmtd, const struct mtd_info *mtd_info, int
printf("Device is writable: %s\n",
mtd.writable ? "true" : "false");
- if (!args.ubinfo)
- goto out;
-
- if (!mtd_info->sysfs_supported) {
- errmsg("cannot provide UBI info, becasue sub-page size is "
- "not known");
- goto out;
- }
-
- ubigen_info_init(&ui, mtd.eb_size, mtd.min_io_size, mtd.subpage_size,
- 0, 1, 0);
- printf("Default UBI VID header offset: %d\n", ui.vid_hdr_offs);
- printf("Default UBI data offset: %d\n", ui.data_offs);
- printf("Default UBI LEB size: ");
- ubiutils_print_bytes(ui.leb_size, 0);
- printf("\n");
- printf("Maximum UBI volumes count: %d\n", ui.max_volumes);
+ if (args.ubinfo)
+ print_ubi_info(mtd_info, &mtd);
-out:
printf("\n");
return 0;
}
--
1.7.2.3
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
next prev parent reply other threads:[~2011-06-08 13:45 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-07 6:19 [PATCH 1/6] jffs2: make lzo optional at build time Mike Frysinger
2011-06-07 6:19 ` [PATCH 2/6] mtdinfo: send help/version info to stdout Mike Frysinger
2011-06-07 6:36 ` Artem Bityutskiy
2011-06-07 15:00 ` Mike Frysinger
2011-06-08 11:10 ` Artem Bityutskiy
2011-06-07 8:40 ` Florian Fainelli
2011-06-07 15:02 ` [PATCH v2] ubi-utils: " Mike Frysinger
2011-06-08 11:13 ` Artem Bityutskiy
2011-06-07 6:19 ` [PATCH 3/6] libmtd: use O_CLOEXEC Mike Frysinger
2011-06-07 6:45 ` Artem Bityutskiy
2011-06-07 6:19 ` [PATCH 4/6] libmtd: add helper funcs for getting fds, regioninfo, and locked info Mike Frysinger
2011-06-07 6:50 ` Artem Bityutskiy
2011-06-07 6:56 ` Artem Bityutskiy
2011-06-07 7:04 ` Mike Frysinger
2011-06-07 7:30 ` Artem Bityutskiy
2011-06-07 15:28 ` [PATCH v2] libmtd: add helper funcs for getting regioninfo " Mike Frysinger
2011-06-07 15:52 ` [PATCH v3] " Mike Frysinger
2011-06-08 11:47 ` Artem Bityutskiy
2011-06-08 18:10 ` Mike Frysinger
2011-06-08 11:52 ` [PATCH v2] " Artem Bityutskiy
2011-06-08 12:27 ` Artem Bityutskiy
2011-06-08 18:12 ` Mike Frysinger
2011-06-07 6:19 ` [PATCH 5/6] mtdinfo: add regioninfo/sectormap display Mike Frysinger
2011-06-07 7:41 ` Artem Bityutskiy
2011-06-07 15:31 ` Mike Frysinger
2011-06-08 13:41 ` Artem Bityutskiy [this message]
2011-06-08 18:14 ` Mike Frysinger
2011-06-07 15:53 ` [PATCH v2] mtdinfo: add regioninfo/eraseblock map display Mike Frysinger
2011-06-08 13:35 ` Artem Bityutskiy
2011-06-08 18:26 ` Mike Frysinger
2011-06-08 19:02 ` [PATCH v3] " Mike Frysinger
2011-06-08 19:11 ` [PATCH v4] " Mike Frysinger
2011-06-09 6:25 ` Artem Bityutskiy
2011-06-07 6:19 ` [PATCH 6/6] flash_info: punt in favor of mtdinfo Mike Frysinger
2011-06-07 7:43 ` Artem Bityutskiy
2011-06-07 15:11 ` [PATCH v2] flash_info: deprecate Mike Frysinger
2011-06-08 11:15 ` Artem Bityutskiy
2011-06-07 6:34 ` [PATCH 1/6] jffs2: make lzo optional at build time Artem Bityutskiy
2011-06-07 6:59 ` Mike Frysinger
2011-06-07 7:20 ` Artem Bityutskiy
2011-06-07 7:16 ` Artem Bityutskiy
2011-06-07 15:16 ` Mike Frysinger
2011-06-08 11:28 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1307540489.31223.87.camel@localhost \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.