[PATCH 7/7] nand-bb: implement lseek in readonly mode
Robert Jarzmik
robert.jarzmik at free.fr
Thu Dec 15 10:51:50 EST 2011
Sascha Hauer <s.hauer at pengutronix.de> writes:
> This one should work like expected:
>
> while (raw_pos < bb->raw_size) {
> off_t now = min(offset, bb->info.erasesize);
>
> ret = cdev_ioctl(bb->cdev_parent, MEMGETBADBLOCK, (void *)raw_pos);
> if (ret < 0)
> return ret;
> if (!ret) {
> offset -= now;
> raw_pos += now;
> } else {
> raw_pos += bb->info.erasesize
> }
> if (!offset) {
> bb->offset = raw_pos;
> return __offset;
> }
> }
Yup, looks good.
If you wish, you can add my :
Reviewed-by: Robert Jarzmik <robert.jarzmik at free.fr>
Cheers.
--
Robert
More information about the barebox
mailing list