
Hi Alex,
On Mon, 27 Sept 2021 at 09:37, Alex G. mr.nuke.me@gmail.com wrote:
On 9/23/21 9:49 PM, Simon Glass wrote:> On Thu, 16 Sept 2021 at 09:43, Alex G. mr.nuke.me@gmail.com wrote:
On 7/29/21 8:08 PM, Chia-Wei Wang wrote:
+enum HASH_ALGO hash_algo_lookup_by_name(const char *name)
string -> hash_lookup_algo() -> ops struct
Is the current way to do things. hash_algo_lookup_by_name() does the roundabout through an enum. That doesn't make sense to me.
Actually I'd like to see an enum to describe these, since looking up a string is less efficient in a bootloader. So some way of doing that seems good to me.
Of course it means we need a global list of this algos in a header file and each driver needs to indicate which one(s) it supports.
Let's assume strcmp() takes a lot of efforts. For a lot of cases, the algo comes in as a string. Think about FIT and image signature verification. So we have to do the strcmp() anyway, making the enum roundabout.
The point is that in most code we can use the enum, thus saving time and space. FIT is an external interface, so using a string makes more sense there. Having said that, we could invent a new version of FIT that has a binding file and uses ints.
Regards, SImon