From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Brian Foster <brian.foster@maxim-ic.com>,
Brian Norris <computersforpeace@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 2/2] ubinfo: fix `--all' for non-consecutive device numbers
Date: Wed, 25 Jan 2012 23:31:50 -0800 [thread overview]
Message-ID: <1327563110-23966-2-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1327563110-23966-1-git-send-email-computersforpeace@gmail.com>
When we have assigned non-consecutive device numbers to our UBI devices,
then we run `ubinfo --all', we get errors once ubinfo tries to process the
devices in the "hole". For instance, suppose there are two UBI devices,
/dev/ubi0 and /dev/ubi10; then, ubinfo will fail trying to open /dev/ubi1
with:
ubinfo: error!: cannot get information about UBI device 1
error 2 (No such file or directory)
This patch adds a check to first see if device is present, then continue
to the next ID if it doesn't exist.
Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
ubi-utils/ubinfo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ubi-utils/ubinfo.c b/ubi-utils/ubinfo.c
index 7aa4aa4..cb88f53 100644
--- a/ubi-utils/ubinfo.c
+++ b/ubi-utils/ubinfo.c
@@ -362,6 +362,8 @@ static int print_general_info(libubi_t libubi, int all)
for (i = ubi_info.lowest_dev_num;
i <= ubi_info.highest_dev_num; i++) {
+ if (!ubi_dev_present(libubi, i))
+ continue;
if(!first)
printf("\n===================================\n\n");
first = 0;
--
1.7.5.4
next prev parent reply other threads:[~2012-01-26 7:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 7:31 [PATCH 1/2] libubi: make `ubi_dev_present()' a library function Brian Norris
2012-01-26 7:31 ` Brian Norris [this message]
2012-01-26 8:53 ` [PATCH 2/2] ubinfo: fix `--all' for non-consecutive device numbers Brian Foster
2012-01-27 18:28 ` Brian Norris
2012-01-30 8:32 ` Brian Foster
2012-01-27 14:51 ` [PATCH 1/2] libubi: make `ubi_dev_present()' a library function 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=1327563110-23966-2-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=brian.foster@maxim-ic.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox