Reading from UBI volume character device did not work.

Richard Weinberger richard.weinberger at gmail.com
Wed Jul 8 12:29:39 PDT 2015


Hi Carsten,

On Wed, Jul 8, 2015 at 8:27 PM, Stelling Carsten
<Carsten.Stelling at goerlitz.com> wrote:
> Hello,
>
> I'm trying to read from a UBI volume using the character device /dev/ubi2,
> but read always returns 0. My kernel version is 3.14.31 (no ubiblock).
>
> fd = open("/dev/ubi2", O_RDONLY);
> read(fd, buffer, count);
>
> I set count to different values, especially to min_io_size = 2048, but without success.
> Reading from the underlying MTD device "/dev/mtd8" succeeds.
> What did I miss?

read() should return -1 with errno = EINVAL as you cannot read from /dev/ubi2.
read/write access is only implemented for volume devices like /dev/ubi2_X.

> My task is, as suggested by the UBIFS documentation, to write a userspace daemon
> on top of UBI, that reads all LEBs and associated PEBs in the background, to let UBI
> handle rarely accessed pages with accumulated bit-flips.

Please note that this check is not perfect.
You'll miss all pages which contain UBI meta data like EC/VID headers.

This reminds me that I should carry on with my bitrot patch set. B-)

-- 
Thanks,
//richard



More information about the linux-mtd mailing list