All of lore.kernel.org
 help / color / mirror / Atom feed
* template replacement
@ 2019-08-12 16:10 Patrick Venture
  2019-08-12 23:57 ` Ed Tanous
  2019-08-13 22:51 ` James Feist
  0 siblings, 2 replies; 5+ messages in thread
From: Patrick Venture @ 2019-08-12 16:10 UTC (permalink / raw)
  To: James Feist; +Cc: OpenBMC Maillist

I've run into an issue and before I submitted a patch to solve my
specific problem, I wanted to get a sense of what was intended:

I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
It finds the $bus match but then fails on the split.
If I add a " " it then fails as well.

It seems to be that if a template is at the end of the field, it works
fine, otherwise it assumes there must be some operation to perform.

Did you already have a fix in mind?

Patrick

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: template replacement
  2019-08-12 16:10 template replacement Patrick Venture
@ 2019-08-12 23:57 ` Ed Tanous
  2019-08-13  0:00   ` Patrick Venture
  2019-08-13 22:51 ` James Feist
  1 sibling, 1 reply; 5+ messages in thread
From: Ed Tanous @ 2019-08-12 23:57 UTC (permalink / raw)
  To: openbmc

On 8/12/19 9:10 AM, Patrick Venture wrote:
> I've run into an issue and before I submitted a patch to solve my
> specific problem, I wanted to get a sense of what was intended:
> 
> I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
> It finds the $bus match but then fails on the split.
> If I add a " " it then fails as well.
> 

Probably just a bug.  A quick scan of $bus in the configurations shows
that we've only ever used it in cases where it was the complete string
(ie "$bus") and even then, only used to populate numeric interfaces with
the bus number to be used programmatically by downstream sensors.

Some of the intent was to largely remove the bus number from the device
naming convention, as outside the system the bus topology is largely
irrelevant.  With that said, I could see how that might be desired for
some setups.


> It seems to be that if a template is at the end of the field, it works
> fine, otherwise it assumes there must be some operation to perform.
> 
> Did you already have a fix in mind?

James is out the next few days, so his answer might differ from mine
when he gets back, but I don't think we knew about this issue previously.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: template replacement
  2019-08-12 23:57 ` Ed Tanous
@ 2019-08-13  0:00   ` Patrick Venture
  2019-08-13  0:04     ` Patrick Venture
  0 siblings, 1 reply; 5+ messages in thread
From: Patrick Venture @ 2019-08-13  0:00 UTC (permalink / raw)
  To: Ed Tanous; +Cc: OpenBMC Maillist

On Mon, Aug 12, 2019 at 4:58 PM Ed Tanous <ed.tanous@intel.com> wrote:
>
> On 8/12/19 9:10 AM, Patrick Venture wrote:
> > I've run into an issue and before I submitted a patch to solve my
> > specific problem, I wanted to get a sense of what was intended:
> >
> > I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
> > It finds the $bus match but then fails on the split.
> > If I add a " " it then fails as well.
> >
>
> Probably just a bug.  A quick scan of $bus in the configurations shows
> that we've only ever used it in cases where it was the complete string
> (ie "$bus") and even then, only used to populate numeric interfaces with
> the bus number to be used programmatically by downstream sensors.
>
> Some of the intent was to largely remove the bus number from the device
> naming convention, as outside the system the bus topology is largely
> irrelevant.  With that said, I could see how that might be desired for
> some setups.

Yeah, I figured out it -- there's an assumption that a field has at
least two other words other than $bus.

So like "$bus card temp" will work -> "26_card_temp"

But "$bus temp" will not -> "$bus_temp"

If the field ends with "$bus" it'll just end up being that value as an
int and lose the rest:

"this that $bus" -> 26

I haven't tried to debug the last case yet, and the names I'm using
happen to be two extra words, so I can hold off on fixing that more
generally -- i have a patch that should handle it, but haven't had a
cycle to test it.

>
>
> > It seems to be that if a template is at the end of the field, it works
> > fine, otherwise it assumes there must be some operation to perform.
> >
> > Did you already have a fix in mind?
>
> James is out the next few days, so his answer might differ from mine
> when he gets back, but I don't think we knew about this issue previously.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: template replacement
  2019-08-13  0:00   ` Patrick Venture
@ 2019-08-13  0:04     ` Patrick Venture
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick Venture @ 2019-08-13  0:04 UTC (permalink / raw)
  To: Ed Tanous; +Cc: OpenBMC Maillist

On Mon, Aug 12, 2019 at 5:00 PM Patrick Venture <venture@google.com> wrote:
>
> On Mon, Aug 12, 2019 at 4:58 PM Ed Tanous <ed.tanous@intel.com> wrote:
> >
> > On 8/12/19 9:10 AM, Patrick Venture wrote:
> > > I've run into an issue and before I submitted a patch to solve my
> > > specific problem, I wanted to get a sense of what was intended:
> > >
> > > I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
> > > It finds the $bus match but then fails on the split.
> > > If I add a " " it then fails as well.
> > >
> >
> > Probably just a bug.  A quick scan of $bus in the configurations shows
> > that we've only ever used it in cases where it was the complete string
> > (ie "$bus") and even then, only used to populate numeric interfaces with
> > the bus number to be used programmatically by downstream sensors.
> >
> > Some of the intent was to largely remove the bus number from the device
> > naming convention, as outside the system the bus topology is largely
> > irrelevant.  With that said, I could see how that might be desired for
> > some setups.

To expand on this, I'm going to add a new template option "$slot"
that'll read the pcie-slot information from the device-tree and
convert the bus to the slot information, since that's semantically
more interesting.

>
> Yeah, I figured out it -- there's an assumption that a field has at
> least two other words other than $bus.
>
> So like "$bus card temp" will work -> "26_card_temp"
>
> But "$bus temp" will not -> "$bus_temp"
>
> If the field ends with "$bus" it'll just end up being that value as an
> int and lose the rest:
>
> "this that $bus" -> 26
>
> I haven't tried to debug the last case yet, and the names I'm using
> happen to be two extra words, so I can hold off on fixing that more
> generally -- i have a patch that should handle it, but haven't had a
> cycle to test it.
>
> >
> >
> > > It seems to be that if a template is at the end of the field, it works
> > > fine, otherwise it assumes there must be some operation to perform.
> > >
> > > Did you already have a fix in mind?
> >
> > James is out the next few days, so his answer might differ from mine
> > when he gets back, but I don't think we knew about this issue previously.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: template replacement
  2019-08-12 16:10 template replacement Patrick Venture
  2019-08-12 23:57 ` Ed Tanous
@ 2019-08-13 22:51 ` James Feist
  1 sibling, 0 replies; 5+ messages in thread
From: James Feist @ 2019-08-13 22:51 UTC (permalink / raw)
  To: Patrick Venture; +Cc: OpenBMC Maillist

On 8/12/19 9:10 AM, Patrick Venture wrote:
> I've run into an issue and before I submitted a patch to solve my
> specific problem, I wanted to get a sense of what was intended:
> 
> I have a field "name" that I want to set dynamically to "$bus_v2345_0_local"
> It finds the $bus match but then fails on the split.
> If I add a " " it then fails as well.
> 
> It seems to be that if a template is at the end of the field, it works
> fine, otherwise it assumes there must be some operation to perform.
> 
> Did you already have a fix in mind?

I pushed a patch to add unit tests to this function so we can work apart 
the issues we're seeing. I think this specific issue was fixed in my patch.

-James

> 
> Patrick
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-13 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-12 16:10 template replacement Patrick Venture
2019-08-12 23:57 ` Ed Tanous
2019-08-13  0:00   ` Patrick Venture
2019-08-13  0:04     ` Patrick Venture
2019-08-13 22:51 ` James Feist

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.