From 34419d9bcfa8ac5202cbe0399b8b20b6c0004c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 15 Feb 2025 19:47:16 +0800 Subject: [PATCH] Revert "Host (Haiku): add debug log" This reverts commit f3e54f33c2efb63bf9feb16bc202c8d8e5389cc8. --- src/util/smbiosHelper.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/util/smbiosHelper.c b/src/util/smbiosHelper.c index 378eda6b..94f99cdb 100644 --- a/src/util/smbiosHelper.c +++ b/src/util/smbiosHelper.c @@ -234,46 +234,42 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable() off_t tableAddress = 0; FF_AUTO_CLOSE_FD int fd = open("/dev/misc/mem", O_RDONLY); if (fd < 0) - {perror("open(mem)");return NULL;} + return NULL; FF_AUTO_FREE uint8_t* smBiosBase = malloc(0x10000); if (pread(fd, smBiosBase, 0x10000, 0xF0000) != 0x10000) - {perror("pread(fd)");return NULL;} - puts("read(mem) ok"); + return NULL; + for (off_t offset = 0; offset <= 0xffe0; offset += 0x10) { FFSmbiosEntryPoint* p = (void*)(smBiosBase + offset); if (memcmp(p, "_SM3_", sizeof(p->Smbios30.AnchorString)) == 0) { - puts("found SM3"); if (p->Smbios30.EntryPointLength != sizeof(p->Smbios30)) - {puts("invalid sm3 entry length"); return NULL;} + return NULL; tableLength = p->Smbios30.StructureTableMaximumSize; tableAddress = (off_t) p->Smbios30.StructureTableAddress; break; } else if (memcmp(p, "_SM_", sizeof(p->Smbios20.AnchorString)) == 0) { - puts("found SM2"); if (p->Smbios20.EntryPointLength != sizeof(p->Smbios20)) - { - puts("invalid sm2 entry length");return NULL;} + return NULL; tableLength = p->Smbios20.StructureTableLength; tableAddress = (off_t) p->Smbios20.StructureTableAddress; break; } } if (tableLength == 0) - {puts("nothing found");return NULL;} - printf("found table length: %d\n", (int)tableLength); + return NULL; + ffStrbufEnsureFixedLengthFree(&buffer, tableLength); if (pread(fd, buffer.chars, tableLength, tableAddress) == tableLength) { - puts("pread(table) done"); buffer.length = tableLength; buffer.chars[buffer.length] = '\0'; } else - {perror("pread(table)");return NULL;} + return NULL; } #endif @@ -293,8 +289,6 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable() } } - puts("Everything is ok"); - return &table; } #elif defined(_WIN32)