[flashrom] [PATCH] Clean up action parameter handling

Nate Case ncase at xes-inc.com
Wed Jul 30 17:55:10 CEST 2014


> We (mostly Carl-Daniel and myself) have (individually) thought about
> this (obvious and prominently documented) problem but have not discussed
> this with each other or in public.
> 
> My opinion is that it would make sense to add a new field to struct
> flashctx that holds various flashrom-wide options (like the action(s)
> to take or the force switch, but also other things). That would get rid
> of some other global variables as well. I am not sure about using an
> integer flag for that though... I'd probably rather use a new struct
> with bitfields instead.
>
> (I should use less parentheses.) Anyway, before investing any time into
> this matter, I would like to hear what Carl-Daniel has to say about it
> (and anybody else too of course! Damnit, parentheses again).


Hi Stefan,

For what it's worth as someone new to this project, my initial thought
was to stuff the action parameters into struct flashctx as well.  However,
after glancing at the existing fields within that structure it didn't seem
appropriate (that is, everything else there seems to be describing the
flash chip or programmer).  On the other hand, even though it's arguably
abusing the struct, it's still clearly better than the existing solution.

A new struct like you described instead of the integer flag seems perfectly
reasonable to me also.  Ultimately I'm just hoping for *something* resembling
this to get merged so that I can base future patches on it.  Specifically,
I have a patch to add a new "read/write/verify_it"-like parameter, which
will of course depend on the resolution of this problem.

(and don't feel bad;  I've also been guilty of parentheses abuse)

Thanks,

Nate





More information about the flashrom mailing list