All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: hujianyang <hujianyang@huawei.com>
Cc: Richard Weinberger <richard.weinberger@gmail.com>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Bill Pringlemeir <bpringlemeir@nbsps.com>
Subject: Re: [PATCH RFC v2] UBI: New ioctl() to support ubidump
Date: Fri, 01 Aug 2014 10:30:39 +0300	[thread overview]
Message-ID: <1406878239.20616.65.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <53DB0081.1040905@huawei.com>

On Fri, 2014-08-01 at 10:50 +0800, hujianyang wrote:
> On 2014/7/31 21:24, Artem Bityutskiy wrote:
> > 
> > Hujianyang, AFAIU, right now you need an ability to dump UBIFS stuff.
> 
> Yes, but not all of what I want. I need this utility dumping UBI-level
> stuff too. The ability, not only to dump UBIFS stuff but also to dump
> UBI stuff will make it a useful tool.

OK.

> > You do not really need to know PEB number. So ubidump may
> > analyze /dev/ubiX_Y without knowing the PEB number, right? It can just
> > read from /dev/ubiX_Y directly. And print you all the UBIFS nodes.
> > 
> 
> Last version I sent to this maillist was reading data from UBI driver
> directly. But our .read() function in UBI driver jump over UBI stuff, so
> I read UBI stuff from an ioctl(). This isn't a common way as you said.

There are 2 layers involved: MTD and UBI.

On the MTD level, the entire flash contents is available (/dev/mtdX)
On the UBI level, only UBI volumes are available (/dev/ubiX_Y)

If I give you an UBI volume dump (cp /dev/ubiX_Y ubi.img), you will only
see the contents of the UBI volume. If there was UBIFS file-system, you
will see UBIFS nodes in the "ubi.img" file. You will not see UBI headers
there.

The ideal design would be treating /dev/ubiX_Y the same way as
'ubi.img'. IOW:

ubidump ubi.img
and
ubidump /dev/ubiX_Y

should give the same results.

If I give you an MTD image (nanddump -o mtd.img /dev/mtdX), you should
be able to see both UBIFS and UBI stuff in 'mtd.img'. You may see the
same information in /dev/mtdX. To get the LEB<->PEB mapping, you need to
do scanning, etc. So

ubidump mtd.img
and
ubidump /dev/mtdX

should be the same.

This is the basic picture.

Now what you want is to add an exception to this scheme. Namely, for the
'ubidump /dev/ubiX_Y' case: you want to get help from the driver, using
the ioctl you introduced.

Frankly, I am not 100% sure this is a good idea, would be nice to hear
from other people. I'd need to think a bit on this.

So what I suggested is the you do not submit this exception so far. Just
teach ubidump to handle UBI volumes. I.e., make it work with

ubidump ubi.img
ubidump /dev/ubiX_Y

yes, these 2 will dump only ubifs stuff. Limited functionality.

> 1) No UBI stuff and read UBIFS stuff from UBI-driver
> This is a easiest way and we don't need any ioctl either. We can't get
> UBI-level stuff right now but we can put this into our design of dumping
> an image file.

Yes. That's a good first step.

> 2) Read data from MTD-driver and find a way to get pnum
> This way is basing on my v2 work. We can put an ioctl() to kernel and
> if kernel don't support this ioctl(), this tool will do a full-scan on
> MTD device. It's transparent to user. But we should take some time to
> consider how to do this full-scan.

I guess, I'd need to think some more about the ioctl(), and may be
someone else suggests something.

> 3) Re-design this tool about dropping UBI driver based dumping.
> This way is like the exist ubiformat utility. We don't use UBI driver
> and just do read/write(maybe we can do some repairing later) with MTD
> device or image files. It's not small.

Probably, we'll think about this when we are done with 1) and may be 2).

-- 
Best Regards,
Artem Bityutskiy

  reply	other threads:[~2014-08-01  7:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29  9:20 [PATCH RFC v2] ubi-utils: Introduce a utility ubidump hujianyang
2014-07-29  9:26 ` [PATCH RFC v2] UBI: New ioctl() to support ubidump hujianyang
2014-07-29 14:48   ` Bill Pringlemeir
2014-07-30  2:01     ` hujianyang
2014-07-30 15:53       ` Bill Pringlemeir
2014-07-31  3:01         ` hujianyang
2014-07-31 13:24           ` Artem Bityutskiy
2014-08-01  2:50             ` hujianyang
2014-08-01  7:30               ` Artem Bityutskiy [this message]
2014-08-01 10:10                 ` hujianyang
2014-08-01 15:35                 ` Bill Pringlemeir
2014-08-04  3:54                   ` hujianyang
2014-08-05 21:10                     ` Bill Pringlemeir
2014-07-31 13:25         ` Artem Bityutskiy
2014-07-29 16:37   ` Richard Weinberger
2014-07-30  2:19     ` hujianyang
2014-07-29  9:31 ` [PATCH 1/5] ubi-utils: Add libdump files hujianyang
2014-07-29  9:35 ` [PATCH 2/5] ubi-utils: Enable lnum2pnum ioctl in userspace hujianyang
2014-07-29  9:41 ` [PATCH 3/5] ubi-utils: Introduce ubidump hujianyang
2014-07-29  9:43 ` [PATCH 4/5] ubi-utils: Add ubifs-media.h hujianyang
2014-07-29  9:45 ` [PATCH 5/5] ubi-utils: Modified Makefile hujianyang

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=1406878239.20616.65.camel@sauron.fi.intel.com \
    --to=dedekind1@gmail.com \
    --cc=bpringlemeir@nbsps.com \
    --cc=hujianyang@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard.weinberger@gmail.com \
    /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.