@@ -151,12 +151,8 @@ static bool parseSmbiosTable(const uint8_t* data, uint32_t length) {
151151# include "common/properties.h"
152152# elif defined(__FreeBSD__ )
153153# include "common/settings.h"
154- # define loff_t off_t
155- # elif defined(__sun ) || defined(__OpenBSD__ )
156- # define loff_t off_t
157154# elif defined(__NetBSD__ )
158155# include "common/sysctl.h"
159- # define loff_t off_t
160156# endif
161157
162158# ifdef __linux__
@@ -192,7 +188,7 @@ bool ffGetSmbiosValue(const char* devicesPath, const char* classPath, FFstrbuf*
192188}
193189# endif
194190
195- static bool readPhysicalMemory (int fd , loff_t address , size_t length , void * buffer ) {
191+ static bool readPhysicalMemory (int fd , off_t address , size_t length , void * buffer ) {
196192# if !defined(__FreeBSD__ ) // Either causes kernel panic or returns EFAULT
197193 // -1: unknown, 0: failed before (stop trying), 1: succeeded before
198194 static int preadState = -1 ;
@@ -214,7 +210,7 @@ static bool readPhysicalMemory(int fd, loff_t address, size_t length, void* buff
214210 }
215211# endif
216212
217- loff_t alignedAddress = address & ~((loff_t ) instance .state .platform .sysinfo .pageSize - 1 );
213+ off_t alignedAddress = address & ~((off_t ) instance .state .platform .sysinfo .pageSize - 1 );
218214 size_t pageOffset = (size_t ) (address - alignedAddress );
219215 size_t mapLength = pageOffset + length ;
220216
@@ -383,7 +379,7 @@ static bool fillTableBufferOpenBSD(FFstrbuf* buffer) {
383379 return false;
384380 }
385381
386- loff_t tableAddress = (loff_t ) parsedAddress ;
382+ off_t tableAddress = (off_t ) parsedAddress ;
387383 FF_DEBUG ("Parsed OpenBSD SMBIOS table address: 0x%llx" , parsedAddress );
388384
389385 FF_AUTO_CLOSE_FD int fd = open ("/dev/mem" , O_RDONLY | O_CLOEXEC );
@@ -494,7 +490,7 @@ static bool fillTableBufferFallback(FFstrbuf* buffer) {
494490 ffStrbufClear (buffer );
495491 ffStrbufEnsureFixedLengthFree (buffer , tableLength );
496492 FF_DEBUG ("Attempting to read SMBIOS table data: %u bytes at 0x%lx" , tableLength , (unsigned long ) tableAddress );
497- if (readPhysicalMemory (fd , (loff_t ) tableAddress , tableLength , buffer -> chars )) {
493+ if (readPhysicalMemory (fd , (off_t ) tableAddress , tableLength , buffer -> chars )) {
498494 buffer -> length = tableLength ;
499495 buffer -> chars [buffer -> length ] = '\0' ;
500496 FF_DEBUG ("Successfully read SMBIOS table data: %u bytes" , tableLength );
@@ -543,7 +539,7 @@ static bool fillTableBufferFast(FFstrbuf* buffer) {
543539 }
544540# endif
545541
546- loff_t entryAddress = (loff_t ) strtol (strEntryAddress .chars , NULL , 16 );
542+ off_t entryAddress = (off_t ) strtol (strEntryAddress .chars , NULL , 16 );
547543 if (entryAddress == 0 ) {
548544 FF_DEBUG ("Invalid SMBIOS entry address: 0" );
549545 return false;
@@ -607,7 +603,7 @@ static bool fillTableBufferFast(FFstrbuf* buffer) {
607603# endif
608604
609605 uint32_t tableLength = 0 ;
610- loff_t tableAddress = 0 ;
606+ off_t tableAddress = 0 ;
611607 if (memcmp (entryPoint .Smbios20 .AnchorString , "_SM_" , sizeof (entryPoint .Smbios20 .AnchorString )) == 0 ) {
612608 FF_DEBUG ("Found SMBIOS 2.0 entry point" );
613609 if (entryPoint .Smbios20 .EntryPointLength != sizeof (entryPoint .Smbios20 )) {
@@ -617,7 +613,7 @@ static bool fillTableBufferFast(FFstrbuf* buffer) {
617613 return false;
618614 }
619615 tableLength = entryPoint .Smbios20 .StructureTableLength ;
620- tableAddress = (loff_t ) entryPoint .Smbios20 .StructureTableAddress ;
616+ tableAddress = (off_t ) entryPoint .Smbios20 .StructureTableAddress ;
621617 FF_DEBUG ("SMBIOS 2.0: tableLength=0x%x, tableAddress=0x%lx, version=%u.%u" ,
622618 tableLength ,
623619 (unsigned long ) tableAddress ,
@@ -632,7 +628,7 @@ static bool fillTableBufferFast(FFstrbuf* buffer) {
632628 return false;
633629 }
634630 tableLength = entryPoint .Smbios30 .StructureTableMaximumSize ;
635- tableAddress = (loff_t ) entryPoint .Smbios30 .StructureTableAddress ;
631+ tableAddress = (off_t ) entryPoint .Smbios30 .StructureTableAddress ;
636632 FF_DEBUG ("SMBIOS 3.0: tableLength=0x%x, tableAddress=0x%lx, version=%u.%u.%u" ,
637633 tableLength ,
638634 (unsigned long ) tableAddress ,
0 commit comments