From 5d4c1d348c12ea0b6a80e16ae9d7684218f8280d Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sun, 19 Nov 2023 01:22:09 +1100 Subject: [PATCH] [all] refactor cpuInfo function names --- client/src/main.c | 4 ++-- common/include/common/cpuinfo.h | 5 +++-- common/src/cpuinfo.c | 4 ++-- common/src/platform/linux/cpuinfo.c | 2 +- common/src/platform/windows/cpuinfo.c | 2 +- host/src/app.c | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/src/main.c b/client/src/main.c index d2d0984a..de629489 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -1632,7 +1632,7 @@ restart: int procs; int cores; int sockets; - if (lgCPUInfo(model, sizeof model, &procs, &cores, &sockets) && + if (cpuInfo_get(model, sizeof model, &procs, &cores, &sockets) && procs > cores) hostHasSMP = true; @@ -1858,7 +1858,7 @@ int main(int argc, char * argv[]) DEBUG_INFO("Looking Glass (%s)", BUILD_VERSION); DEBUG_INFO("Locking Method: " LG_LOCK_MODE); - lgDebugCPU(); + cpuInfo_log(); if (!installCrashHandler("/proc/self/exe")) DEBUG_WARN("Failed to install the crash handler"); diff --git a/common/include/common/cpuinfo.h b/common/include/common/cpuinfo.h index 4d021305..e0a00c83 100644 --- a/common/include/common/cpuinfo.h +++ b/common/include/common/cpuinfo.h @@ -24,8 +24,9 @@ #include #include -bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores, +bool cpuInfo_get(char * model, size_t modelSize, int * procs, int * cores, int * sockets); -void lgDebugCPU(void); + +void cpuInfo_log(void); #endif diff --git a/common/src/cpuinfo.c b/common/src/cpuinfo.c index 38a5eff9..10f75f06 100644 --- a/common/src/cpuinfo.c +++ b/common/src/cpuinfo.c @@ -21,14 +21,14 @@ #include "common/cpuinfo.h" #include "common/debug.h" -void lgDebugCPU(void) +void cpuInfo_log(void) { char model[1024]; int procs; int cores; int sockets; - if (!lgCPUInfo(model, sizeof model, &procs, &cores, &sockets)) + if (!cpuInfo_get(model, sizeof model, &procs, &cores, &sockets)) { DEBUG_WARN("Failed to get CPU information"); return; diff --git a/common/src/platform/linux/cpuinfo.c b/common/src/platform/linux/cpuinfo.c index c4c99a3d..8b03d4ea 100644 --- a/common/src/platform/linux/cpuinfo.c +++ b/common/src/platform/linux/cpuinfo.c @@ -27,7 +27,7 @@ #include #include -bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores, +bool cpuInfo_get(char * model, size_t modelSize, int * procs, int * cores, int * sockets) { FILE * cpuinfo = fopen("/proc/cpuinfo", "r"); diff --git a/common/src/platform/windows/cpuinfo.c b/common/src/platform/windows/cpuinfo.c index f5a2a56c..0b7d557b 100644 --- a/common/src/platform/windows/cpuinfo.c +++ b/common/src/platform/windows/cpuinfo.c @@ -108,7 +108,7 @@ static bool getCoreCount(int * cores, int * procs, int * sockets) return true; } -bool lgCPUInfo(char * model, size_t modelSize, int * procs, int * cores, +bool cpuInfo_get(char * model, size_t modelSize, int * procs, int * cores, int * sockets) { return getCPUModel(model, modelSize) && getCoreCount(cores, procs, sockets); diff --git a/host/src/app.c b/host/src/app.c index 0cb2df46..3076aa8c 100644 --- a/host/src/app.c +++ b/host/src/app.c @@ -618,7 +618,7 @@ static bool newKVMFRData(KVMFRUserData * dst) { int cpus, cores, sockets; char model[1024]; - if (!lgCPUInfo(model, sizeof(model), &cpus, &cores, &sockets)) + if (!cpuInfo_get(model, sizeof(model), &cpus, &cores, &sockets)) return false; KVMFRRecord_VMInfo vmInfo = @@ -807,7 +807,7 @@ int app_main(int argc, char * argv[]) return LG_HOST_EXIT_FATAL; DEBUG_INFO("Looking Glass Host (%s)", BUILD_VERSION); - lgDebugCPU(); + cpuInfo_log(); struct IVSHMEM shmDev = { 0 }; if (!ivshmemInit(&shmDev))