[RFC] mtd-utils: integck: add support for volume specific power-cut test

Artem Bityutskiy dedekind1 at gmail.com
Tue Aug 20 08:23:04 EDT 2013


On Mon, 2013-08-19 at 15:37 +0000, Mats Kärrman wrote:
> On Mon, 2013-08-19 at 15:16 +0000, Artem Bityutskiy wrote:
> > OK, but there is also an "fstype" field, could you use and do the trick
> > only for UBIFS?
> 
> I guess so, but there is also an alternative mounting syntax:
> 
> # mount -t ubifs ubi0:integ_chk /mnt/ubifs
> 
> resulting in a /proc/mounts line of:
> 
> ubi0:integ_chk /mnt/ubifs ubifs rw,relatime 0 0

OK, you are right. Here are all the possible ways to refer an UBI
volume, from comments in the 'open_ubi()' function:

 * o ubiX_Y    - mount UBI device number X, volume Y;
 * o ubiY      - mount UBI device number 0, volume Y;
 * o ubiX:NAME - mount UBI device X, volume with name NAME;
 * o ubi:NAME  - mount UBI device 0, volume with name NAME.

> Do you see an easy way to resolve this into ubi0_0 or should this case
> also be ignored?

Not sure about the easy part, but, there is libubi in mtd-utils, and
integck actually already uses it.

In libubi there are many useful helper functions which parse the ubi
sysfs directory and fetch various kind of info from it.

And you can use libubi for finding X_Y by NAME.

And it is actually easy now, when I think about this. First, you find
out the UBI device number, it is either X or 0 (let's call it 'ubinum').

Then if you have name instead of the volume number (Y), you use libubi
and resolve it like this:

libubi_t libubi; 
struct ubi_vol_info vol_info;

libubi = libubi_open();
if (!libubi) { blah-blah }

err = ubi_get_vol_info1_nm(libubi, ubinum,  name, &vol_info);
if (err) { blah-blah }

And now you have volume ID (Y) in "vol_info.vol_id".

And you construct the debugfs path.

Hmm?

> Personally I have never seen the use of multiple ubi volumes inside of
> one mtd partition so "0" could be assumed but someone else might
> disagree.

Well... I'd be happier to see something like I proposed above, if you
can submit such a patch.

-- 
Best Regards,
Artem Bityutskiy




More information about the linux-mtd mailing list