From: Boris Brezillon <boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: xiaolei li <xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Cc: linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
David Oberhollenzer
<david.oberhollenzer-S6VGOU4v5edDinCvNWH78Q@public.gmane.org>,
srv_heupstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH 1/2] libmtd: Add support to access OOB available size
Date: Mon, 9 Apr 2018 09:35:48 +0200 [thread overview]
Message-ID: <20180409093548.40b20d1b@bbrezillon> (raw)
In-Reply-To: <1523258739.14673.7.camel@mhfsdcap03>
On Mon, 9 Apr 2018 15:25:39 +0800
xiaolei li <xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org> wrote:
> Hi David,
>
> On Mon, 2018-04-09 at 08:58 +0200, David Oberhollenzer wrote:
> > Hi,
> >
> > On 04/09/2018 05:10 AM, Xiaolei Li wrote:
> > > @@ -769,6 +774,8 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd)
> > > return -1;
> > > if (dev_read_pos_int(lib->mtd_oob_size, mtd_num, &mtd->oob_size))
> > > return -1;
> > > + if (dev_read_pos_int(lib->mtd_oobavail, mtd_num, &mtd->oobavail))
> > > + return -1;
> > > if (dev_read_pos_int(lib->mtd_region_cnt, mtd_num, &mtd->region_cnt))
> > > return -1;
> > > if (dev_read_hex_int(lib->mtd_flags, mtd_num, &ret))
> >
> > I'm not sure if it is a good idea to do a hard fail here, since this
> > depends on a recent change to the kernel.
> >
> > It might be preferable to catch and handle ENOENT, otherwise the next
> > release of mtd-utils will only work on the next kernel release onward.
> >
> Yes, it is. The hard fail return here seems not good.
>
> > Maybe mtd_oobavail could to be set to some reasonable default that
> > retains the current behaviour on "older" kernels?
> >
> What about setting 0 as default?
I didn't look closely at the code yet, but shouldn't we do something
like:
1/ search for oobavail file in sysfs
2/ if it's not there use the GETOOBSEL or GETECCLAYOUT ioctl to get
this information
3/ if none of #1 and #2 are working, set oobavail to 0
Of course, all of this only makes sense if oobsize > 0. When that's not
the case, you can directly set oobavail to 0.
next prev parent reply other threads:[~2018-04-09 7:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-09 3:10 [PATCH 0/2] Fix Jffs2 type flash erase problem Xiaolei Li
[not found] ` <1523243410-65424-1-git-send-email-xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2018-04-09 3:10 ` [PATCH 1/2] libmtd: Add support to access OOB available size Xiaolei Li
[not found] ` <1523243410-65424-2-git-send-email-xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2018-04-09 6:58 ` David Oberhollenzer
[not found] ` <99d17022-0b07-a999-b6ac-05b51df7d18d-S6VGOU4v5edDinCvNWH78Q@public.gmane.org>
2018-04-09 7:25 ` xiaolei li
2018-04-09 7:35 ` Boris Brezillon [this message]
2018-04-09 8:33 ` xiaolei li
2018-04-09 8:37 ` Boris Brezillon
2018-04-09 8:45 ` xiaolei li
2018-04-09 8:53 ` David Oberhollenzer
[not found] ` <bec14308-33e1-d158-37d2-4f59047f0016-S6VGOU4v5edDinCvNWH78Q@public.gmane.org>
2018-04-09 9:01 ` xiaolei li
2018-04-09 3:10 ` [PATCH 2/2] misc-utils: flash_erase: Fix Jffs2 type flash erase problem Xiaolei Li
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=20180409093548.40b20d1b@bbrezillon \
--to=boris.brezillon-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
--cc=david.oberhollenzer-S6VGOU4v5edDinCvNWH78Q@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=srv_heupstream-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.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