From e97c38db42733c2115822e42d6aa9446574e2bcc Mon Sep 17 00:00:00 2001 From: Burt P Date: Mon, 10 Jul 2017 00:26:04 -0500 Subject: The rest of processor.c using cpu_util. Those currently not using topology or cpufreq, but could in the future. Signed-off-by: Burt P --- modules/devices/alpha/processor.c | 17 +++-------------- modules/devices/ia64/processor.c | 13 +------------ modules/devices/m68k/processor.c | 13 +------------ modules/devices/mips/processor.c | 13 +------------ modules/devices/parisc/processor.c | 13 +------------ modules/devices/s390/processor.c | 13 +------------ modules/devices/sh/processor.c | 19 +++---------------- modules/devices/sparc/processor.c | 23 ++++++----------------- 8 files changed, 17 insertions(+), 107 deletions(-) (limited to 'modules') diff --git a/modules/devices/alpha/processor.c b/modules/devices/alpha/processor.c index 79852017..07905f96 100644 --- a/modules/devices/alpha/processor.c +++ b/modules/devices/alpha/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) @@ -60,6 +49,8 @@ processor_scan(void) g_strfreev(tmp); } + fclose(cpuinfo); + gchar *tmp = g_strconcat("Alpha ", processor->model_name, NULL); g_free(processor->model_name); processor->model_name = tmp; @@ -71,8 +62,6 @@ processor_scan(void) } else processor->cpu_mhz = 0.0f; - fclose(cpuinfo); - return g_slist_append(NULL, processor); } diff --git a/modules/devices/ia64/processor.c b/modules/devices/ia64/processor.c index 6076fed8..7c311c0a 100644 --- a/modules/devices/ia64/processor.c +++ b/modules/devices/ia64/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) diff --git a/modules/devices/m68k/processor.c b/modules/devices/m68k/processor.c index 0dd4c62f..de24ada8 100644 --- a/modules/devices/m68k/processor.c +++ b/modules/devices/m68k/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) diff --git a/modules/devices/mips/processor.c b/modules/devices/mips/processor.c index 2bf0e44e..8cb82807 100644 --- a/modules/devices/mips/processor.c +++ b/modules/devices/mips/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) diff --git a/modules/devices/parisc/processor.c b/modules/devices/parisc/processor.c index 23cc9ba0..fdb8cd54 100644 --- a/modules/devices/parisc/processor.c +++ b/modules/devices/parisc/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) diff --git a/modules/devices/s390/processor.c b/modules/devices/s390/processor.c index 8d9cbe05..8a80b7af 100644 --- a/modules/devices/s390/processor.c +++ b/modules/devices/s390/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) diff --git a/modules/devices/sh/processor.c b/modules/devices/sh/processor.c index 92b96f73..b1f0e5d6 100644 --- a/modules/devices/sh/processor.c +++ b/modules/devices/sh/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) @@ -63,10 +52,8 @@ processor_scan(void) fclose(cpuinfo); - if (!processor->model_name) - processor->model_name = _("SuperH Processor"); - if (!processor->vendor_id) - processor->vendor_id = _("(Unknown)"); + STRIFNULL(model_name, _("SuperH Processor")); + UNKIFNULL(vendor_id); return g_slist_append(NULL, processor); } diff --git a/modules/devices/sparc/processor.c b/modules/devices/sparc/processor.c index 05103a2b..32450f6f 100644 --- a/modules/devices/sparc/processor.c +++ b/modules/devices/sparc/processor.c @@ -18,18 +18,7 @@ #include "hardinfo.h" #include "devices.h" - -gchar *byte_order_str() { -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - return _("Little Endian"); -#else - return _("Big Endian"); -#endif -} - -#ifndef PROC_CPUINFO -#define PROC_CPUINFO "/proc/cpuinfo" -#endif +#include "cpu_util.h" GSList * processor_scan(void) @@ -70,13 +59,13 @@ processor_get_info(GSList *processors) Processor *processor = (Processor *)processors->data; return g_strdup_printf("[%s]\n" - "CPU=%s\n" - "FPU=%s\n" + "%s=%s\n" /* cpu */ + "%s=%s\n" /* fpu */ "%s=%s\n" /* byte order */ - "%s=%s\n", + "%s=%s\n", /* caps */ _("Processor"), - processor->model_name, - processor->has_fpu, + _("CPU"), processor->model_name, + _("FPU"), processor->has_fpu, _("Byte Order"), byte_order_str(), _("Capabilities"), processor->cpucaps ); -- cgit v1.2.3