[pve-devel] [PATCH common 1/1] tools: Add is_native sub to compare the CPU architecture

Filip Schauer f.schauer at proxmox.com
Wed Feb 21 15:37:08 CET 2024


Patch v8 available:

https://lists.proxmox.com/pipermail/pve-devel/2024-February/061899.html

On 19/02/2024 15:46, Fiona Ebner wrote:
> Am 19.12.23 um 10:40 schrieb Filip Schauer:
>> Add an is_native($arch) subroutine to compare a CPU architecture to the
>> host CPU architecture. This is brought in from PVE::QemuServer.
>>
>> Signed-off-by: Filip Schauer <f.schauer at proxmox.com>
>> ---
>>   src/PVE/Tools.pm | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
>> index 766c809..7bb1809 100644
>> --- a/src/PVE/Tools.pm
>> +++ b/src/PVE/Tools.pm
>> @@ -52,6 +52,7 @@ extract_param
>>   extract_sensitive_params
>>   file_copy
>>   get_host_arch
>> +is_native
>>   O_PATH
>>   O_TMPFILE
>>   AT_EMPTY_PATH
>> @@ -1841,6 +1842,11 @@ sub get_host_arch {
>>       return $host_arch;
>>   }
>>   
>> +sub is_native($) {
> This is a too generic name to put in such a generic module like Tools.
> Admittedly, it's also a too generic name in QemuServer IMHO ;) Maybe
> arch_is_native() or is_native_arch()?
>
> I'm not fully convinced the move is worth it, but it does belong to
> get_host_arch() semantically, so fine by me.
>
>> +    my ($arch) = @_;
>> +    return get_host_arch() eq $arch;
>> +}
>> +
>>   # Devices are: [ (12 bits minor) (12 bits major) (8 bits minor) ]
>>   sub dev_t_major($) {
>>       my ($dev_t) = @_;




More information about the pve-devel mailing list