On 11/16/2026 1:40 PM, Daniel P. Berrangé wrote:
> On Mon, Nov 16, 2026 at 12:48:47PM -0800, Pierrick Bouvier wrote:
>> On 11/12/2026 5:30 AM, Daniel P. Berrangé wrote:
>>> Make the TYPE_MACHINE class implement the TYPE_ALIASED
>>> interface which will replace use of the 'alias' parameter
>>> in MachineClass. The current 'alias' records the user
>>> facing machine name, while 'aliases' in TYPE_ALIASED
>>> will report an internal type name alias.
>>>
>>> Signed-off-by: Daniel P. Berrangé <[email protected]>
>>> ---
>>>  hw/core/machine.c | 4 ++++
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/hw/core/machine.c b/hw/core/machine.c
>>> index ed9bf8f5008..f7406537aa7 100644
>>> --- a/hw/core/machine.c
>>> +++ b/hw/core/machine.c
>>> @@ -1802,6 +1802,10 @@ static const TypeInfo machine_info = {
>>>      .instance_size = sizeof(MachineState),
>>>      .instance_init = machine_initfn,
>>>      .instance_finalize = machine_finalize,
>>> +    .interfaces = (const InterfaceInfo[]) {
>>> +        { TYPE_ALIASED },
>>> +        { }
>>> +    }
>>>  };
>>>  
>>>  static void machine_register_types(void)
>>
>> Since very few machines require this alias mechanism, would that be
>> better to be add it where it's needed?
> 
> Unconditionally adding it is a simplication for other code in
> the series. By doing this we can use the normal QOM cast
> "ALIASED_CLASS(mc)" from the machine to the interface which
> asserts on failure.
> 
> If we only did add the interface for a subset of machines, we have
> to remember to use (AliasedClass*)object_class_dynamic_cast(OBJECT(mc))
> and check the return value for NULL, which is both more verbose
> and error prone.
> 
> So I thought the overhead of adding the interface to the Machine base
> class was probably a reasonable tradeoff.
>

After reviewing the whole series, it's acceptable indeed.

>>
>> Not a strong opinion though:
>> Reviewed-by: Pierrick Bouvier <[email protected]>
>>
>> Regards,
>> Pierrick
>>
> 
> With regards,
> Daniel


Reply via email to