Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
util-linux.3352
util-linux-lscpu-read_hypervisor_powerpc.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-lscpu-read_hypervisor_powerpc.patch of Package util-linux.3352
From e03b613e8d65d8e705ce5850ed05b3a156097e75 Mon Sep 17 00:00:00 2001 From: Karel Zak <kzak@redhat.com> Date: Tue, 1 Sep 2015 12:37:18 +0200 Subject: [PATCH] lscpu: fix read_hypervisor_powerpc() logic We care about /proc/device-tree/compatible content... The patch also removes unnecessary path_exist(), it seems good enough to call open() rather than access() + open(). Addresses: https://github.com/karelzak/util-linux/issues/218 Signed-off-by: Karel Zak <kzak@redhat.com> --- sys-utils/lscpu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 1f8f5f1..47f690d 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -603,9 +603,8 @@ read_hypervisor_cpuid(struct lscpu_desc *desc __attribute__((__unused__))) static int is_compatible(const char *path, const char *str) { - FILE *fd; + FILE *fd = path_fopen("r", 0, "%s", path); - fd = path_fopen("r", 0, "%s", path); if (fd) { char buf[256]; size_t i, len; @@ -636,11 +635,9 @@ read_hypervisor_powerpc(struct lscpu_desc *desc) desc->virtype = VIRT_PARA; /* PowerNV (POWER Non-Virtualized, bare-metal) */ - } else if (path_exist(_PATH_PROC_DEVICETREE "/compatible")) { - if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "ibm,powernv")) { - desc->hyper = HYPER_NONE; - desc->virtype = VIRT_NONE; - } + } else if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "ibm,powernv")) { + desc->hyper = HYPER_NONE; + desc->virtype = VIRT_NONE; /* PowerVM (IBM's proprietary hypervisor, aka pHyp) */ } else if (path_exist(_PATH_PROC_DEVICETREE "/ibm,partition-name") @@ -658,11 +655,9 @@ read_hypervisor_powerpc(struct lscpu_desc *desc) } /* Qemu */ - } else if (path_exist(_PATH_PROC_DEVICETREE "/compatible")) { - if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "qemu,pseries")) { - desc->hyper = HYPER_KVM; - desc->virtype = VIRT_PARA; - } + } else if (is_compatible(_PATH_PROC_DEVICETREE "/compatible", "qemu,pseries")) { + desc->hyper = HYPER_KVM; + desc->virtype = VIRT_PARA; } return desc->hyper; } -- 2.8.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor