On 2023/11/30 17:37, Shijie Huang wrote:
>> @@ -104,6 +104,20 @@ static void check_vmcoreinfo(void);
>> static int is_pvops_xen(void);
>> static int get_linux_banner_from_vmlinux(char *, size_t);
>> +/* Return TRUE if we succeed, return FALSE on failure. */
>> +bool
>> +get_value_vmcore(const char *name, ulong *v)
> "get_value_vmcoreinfo" is better to clarify.
What about get_symbol_value_vmcoreinfo()?
Agree, it's better.
We can use "htol" to do the convert for symbol, but htol does not work
for "NUMBER()"..
>
>> +{
>> + char *string = pc->read_vmcoreinfo(name);
>> +
>> + if (!string)
>> + return FALSE;
>> +
>> + *v = htol(string, RETURN_ON_ERROR, NULL);
>> + return TRUE;
>> +}
>> +
>> /*
>> * popuplate the global kernel table (kt) with kernel version
>> * information parsed from UTSNAME/OSRELEASE string
>> @@ -10984,6 +10998,12 @@ hypervisor_init(void)
>> fprintf(fp, "hypervisor: %s\n", kt->hypervisor);
>> }
>> +#define GET_SYM(s,v) \
> How about "GET_SYMBOL" and
no problem.
>> + if (get_value_vmcore((s), &(v))) { \
> adding "SYMBOL(" and ")" here?
it is not easy to add "SYMBOL" here.
I prefer to add to get_symbol_value_vmcoreinfo().
I mean
if (get_symbol_value_vmcoreinfo("SYMBOL(" s ")", &(v))) ...
>
>> + if (CRASHDEBUG(1)) \
>> + fprintf(fp, s ": %lx\n", v); \
like this. possible?
Thanks,
Kazu