[pve-devel] [PATCH common 1/1] tools: Add is_native sub to compare the CPU architecture
Fiona Ebner
f.ebner at proxmox.com
Mon Feb 19 15:46:56 CET 2024
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