static void arm_decode(struct lscpu_cxt *cxt, struct lscpu_cputype *ct)
{
- if (!cxt->noalive && access(_PATH_SYS_DMI, R_OK) == 0)
+ if (is_live(cxt) && access(_PATH_SYS_DMI, R_OK) == 0)
dmi_decode_cputype(ct);
arm_ids_decode(ct);
arm_rXpY_decode(ct);
- if (!cxt->noalive && cxt->is_cluster)
+ if (is_live(cxt) && cxt->is_cluster)
ct->nr_socket_on_cluster = get_number_of_physical_sockets_from_dmi();
}
{
struct stat st;
- if (!cxt->noalive
+ if (is_live(cxt)
&& strcmp(cxt->arch->name, "aarch64") == 0
&& stat(_PATH_ACPI_PPTT, &st) < 0 && cxt->ncputypes == 1)
return 1;
ar = xcalloc(1, sizeof(*cxt->arch));
ar->name = xstrdup(utsbuf.machine);
- if (cxt->noalive)
+ if (is_dump(cxt))
/* reading info from any /{sys,proc} dump, don't mix it with
* information about our real CPU */
;
ar->bit64 = 1;
}
- if (ar->name && !cxt->noalive) {
+ if (ar->name && is_live(cxt)) {
if (strcmp(ar->name, "ppc64") == 0)
ar->bit32 = 1, ar->bit64 = 1;
else if (strcmp(ar->name, "ppc") == 0)
/* note that kernel_max is maximum index [NR_CPUS-1] */
cxt->maxcpus += 1;
- else if (!cxt->noalive)
+ else if (is_live(cxt))
/* the root is '/' so we are working with data from the current kernel */
cxt->maxcpus = get_max_number_of_cpus();
#if defined(HAVE_LIBRTAS)
/* Get PowerPC specific info */
- if (!cxt->noalive) {
+ if (is_live(cxt)) {
int rc, len, ntypes;
ct->physsockets = ct->physchips = ct->physcoresperchip = 0;
goto done;
}
- if (!cxt->noalive) {
+ if (is_live(cxt)) {
virt->vendor = read_hypervisor_cpuid();
if (!virt->vendor)
virt->vendor = read_hypervisor_dmi();
int is_cluster; /* For aarch64 if the machine doesn't have ACPI PPTT */
};
+#define is_live(_cxt) (!(_cxt)->noalive)
+#define is_dump(_cxt) ((_cxt)->noalive)
+
#define is_cpu_online(_cxt, _cpu) \
((_cxt) && (_cpu) && (_cxt)->online && \
CPU_ISSET_S((_cpu)->logical_id, (_cxt)->setsize, (_cxt)->online))