On 6/29/21 2:11 AM, Philippe Mathieu-Daudé wrote: > On 6/29/21 7:56 AM, Dov Murik wrote: >> On 29/06/2021 1:03, Tom Lendacky wrote: >>> On 6/22/21 7:58 AM, Dov Murik wrote: >>
>> (a) add a 'static bool ovmf_table_parsed' which will be set to true at >> the beginning of pc_system_parse_ovmf_flash(). Then, at the beginning of >> pc_system_ovmf_table_find add: assert(ovmf_table_parsed). >> >> (b) (ab)use our existing ovmf_table_len static variable: initialize it >> to -1 (meaning that we haven't parsed the OVMF flash yet). When looking >> for the table set it to 0 (meaning that OVMF table doesn't exist or is >> invalid). When a proper table is found and copied to ovmf_table, then >> set it to the real length (>= 0). At the beginning of >> pc_system_ovmf_table_find add: assert(ovmf_table_len != -1). (this -1 >> can be #define OVMF_FLASH_NOT_PARSED -1). >> >> >> Phil, Tom, James: which do you prefer? other options? Rust enum? ;-) > > Since we are discussing code that should not be called, I don't have > strong preference as long as we keep the code easy to review :) > > With that in mind, (a) seems simpler. Yes, to me (a) seems simpler, too. Thanks, Tom > > Regards, > > Phil. >