|
From: | wangyanan (Y) |
Subject: | Re: [PATCH 1/2] hw/core/machine: Split out smp_parse as an inline API |
Date: | Mon, 11 Oct 2021 15:54:24 +0800 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 |
Hi Markus, On 2021/10/11 13:26, Markus Armbruster wrote:
Yanan Wang <wangyanan55@huawei.com> writes:Functionally smp_parse() is only called once and in one place i.e. machine_set_smp, the possible second place where it'll be called should be some unit tests if any. Actually we are going to introduce an unit test for the parser. For necessary isolation of the tested code, split smp_parse out into a separate header as an inline API.Why inline?
The motivation of the splitting is to isolate the tested smp_parse from the other unrelated code in machine.c, so that we can solve the build dependency problem for the unit test. I once tried to split smp_parse out into a source file in [1] for the test, but it looks more concise and convenient to make it as an inline function in a header compared to [1]. Given that we only call it in one place, it may not be harmful to keep it an inline. Anyway, I not sure the method in this patch is most appropriate and compliant. If it's just wrong I can change back to [1]. :)[1] https://lore.kernel.org/qemu-devel/20210910073025.16480-16-wangyanan55@huawei.com/#t
Thanks, Yanan
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>.
[Prev in Thread] | Current Thread | [Next in Thread] |