Re: [PATCH 1/1] mtd/intel-spi: Support cmdline-based partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I did try the \ thing but found it a bit tricky to work with, with
lots of potential for simple errors.

It would require cmdlines like this
mtdparts=0000\:00\:0.1f:etcetc

A lot of these mtdparts definitions are produced by scripts and
Makefiles and there are many, many places where \\ have a way of
vanishing.

We talked here about an option where the name would be in parens or brackets:
mtdparts=(00:00:0.0):etcetc

which I think looks a lot nicer but and leaves room for growth, where
in a few years some other strange name comes along that might break
our rules. () anyone?

Another problem is, the name matching is a strcmp. There's no
semantics in the names. So where, technically, these  PCI addresses
are the same:
1f.3 and 0:1f.3 and  0:0:1f.3 and  0000:00:1f.3
the strcmp would fail between 1f.3 and 0000:00:1f.3 -- but they're the same.

This means that the PCI names must be strongly structured: they must
follow the rules such that the : and . occur in a fixed place in the
string, meaning determining that a string is a PCI TBDF is relatively
simple.

So I keep coming back to the simple "name matches pattern ****:**:*.*
(where * means any char) -- it's a PCI address" as maybe the easiest
thing to do.
But possibly the () are the best future-proofing. I really am not a fan of \.

ron

On Fri, Mar 27, 2020 at 9:52 AM Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
>
> Hi Mika,
>
> Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> wrote on Fri, 27 Mar
> 2020 18:48:02 +0200:
>
> > On Fri, Mar 27, 2020 at 05:19:07PM +0100, Miquel Raynal wrote:
> > > Hi Mika,
> > >
> > > Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> wrote on Fri, 27 Mar
> > > 2020 17:56:08 +0200:
> > >
> > > > Hi,
> > > >
> > > > I don't think it is good idea to change PCI device name like that.
> > > >
> > > > Instead the MTD cmdline parser should be teach to handle names like this
> > > > properly.
> > >
> > > It is a bit more complicated than that since parsers have been using
> > > this syntax for a long time and, more importantly, it means
> > > potentially updating all bootloaders.
> > >
> > > I am not against updating the parser, but the s/:/|/ solution proposed
> > > before is rather undescriptive and it is hard to find an alternative
> > > character that would have a meaning here.
> >
> > I'm completely unfamiliar with these but would escape char work here? I
> > mean if you want ":" to be parsed literally then you pass "\:" in the
> > command line. That should work with the existing and also allow
> > supporting SPI NOR controllers on PCI bus.
>
> We would still have to update bootloaders code but that would be easy
> to handle. The logic being "search for the next ':', when you have one
> check if there is a '\' in front of it. If yes, search again". Why
> not... This also means reconstructing the name by dropping manually the
> additional '\' in Linux.
>
> Thanks,
> Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux