lazybios 3.0.0
Lightweight SMBIOS/DMI parsing library
Loading...
Searching...
No Matches
Context and Data Loading

Context lifetime, backend selection, and SMBIOS data loading. More...

Data Structures

struct  lazybiosCTX_t
 Top-level lazybios context containing raw and parsed SMBIOS data. More...

Enumerations

enum  lazybiosBackend_t {
  LAZYBIOS_BACKEND_LINUX , LAZYBIOS_BACKEND_WINDOWS , LAZYBIOS_BACKEND_MACOS , LAZYBIOS_BACKEND_OPENBSD ,
  LAZYBIOS_BACKEND_FREEBSD , LAZYBIOS_BACKEND_NETBSD , LAZYBIOS_BACKEND_SUNOS , LAZYBIOS_BACKEND_DRAGONFLY ,
  LAZYBIOS_BACKEND_HAIKU , LAZYBIOS_BACKEND_BEOS , LAZYBIOS_BACKEND_REACTOS , LAZYBIOS_BACKEND_GENERIC ,
  LAZYBIOS_BACKEND_UNKNOWN , LAZYBIOS_BACKEND_QNX , LAZYBIOS_BACKEND_MINIX
}
 Selects the platform backend used to obtain SMBIOS data. More...

Functions

int lazybiosCleanup (lazybiosCTX_t *ctx)
 Releases a context and all SMBIOS data owned by it.
LAZYBIOS_WARN_UNUSED lazybiosCTX_t * lazybiosCTXNew (void)
 Allocates and initializes a lazybios context.
LAZYBIOS_WARN_UNUSED int lazybiosInit (lazybiosCTX_t *ctx, const char *entry_point, const char *DMI_BIN)
 Loads SMBIOS data from the host system or from captured table files.

Detailed Description

Context lifetime, backend selection, and SMBIOS data loading.

Enumeration Type Documentation

◆ lazybiosBackend_t

#include <lazybios.h>

Selects the platform backend used to obtain SMBIOS data.

Enumerator
LAZYBIOS_BACKEND_LINUX 

Linux sysfs or physical-memory backend.

LAZYBIOS_BACKEND_WINDOWS 

Windows firmware-table API backend.

LAZYBIOS_BACKEND_MACOS 

macOS AppleSMBIOS I/O Registry backend.

LAZYBIOS_BACKEND_OPENBSD 

OpenBSD dmesg-assisted physical-memory backend.

LAZYBIOS_BACKEND_FREEBSD 

FreeBSD kenv-assisted physical-memory backend.

LAZYBIOS_BACKEND_NETBSD 

NetBSD sysctl-assisted SMBIOS device backend.

LAZYBIOS_BACKEND_SUNOS 

SunOS (Solaris/illumos) /dev/smbios snapshot with a physical-memory fallback.

LAZYBIOS_BACKEND_DRAGONFLY 

DragonFly BSD kenv-assisted physical-memory backend.

LAZYBIOS_BACKEND_HAIKU 

Haiku legacy physical-memory backend.

LAZYBIOS_BACKEND_BEOS 

BeOS legacy physical-memory backend.

LAZYBIOS_BACKEND_REACTOS 

ReactOS Win32 firmware-table API backend.

LAZYBIOS_BACKEND_GENERIC 

Generic legacy physical-memory backend.

LAZYBIOS_BACKEND_UNKNOWN 

No usable host backend was selected.

LAZYBIOS_BACKEND_QNX 

QNX Neutrino mapped physical-memory backend.

LAZYBIOS_BACKEND_MINIX 

MINIX 3 legacy physical-memory backend.

Definition at line 42 of file lazybios.h.

Function Documentation

◆ lazybiosCleanup()

int lazybiosCleanup ( lazybiosCTX_t * ctx)

#include <lazybios.h>

Releases a context and all SMBIOS data owned by it.

Parameters
ctxContext to release.
Returns
0 on success, or -1 if ctx is NULL.

References lazybiosCleanup().

Referenced by lazybiosCleanup().

◆ lazybiosCTXNew()

LAZYBIOS_WARN_UNUSED lazybiosCTX_t * lazybiosCTXNew ( void )

#include <lazybios.h>

Allocates and initializes a lazybios context.

Returns
Newly allocated context, or NULL if allocation fails.

References LAZYBIOS_WARN_UNUSED, and lazybiosCTXNew().

Referenced by lazybiosCTXNew().

◆ lazybiosInit()

LAZYBIOS_WARN_UNUSED int lazybiosInit ( lazybiosCTX_t * ctx,
const char * entry_point,
const char * DMI_BIN )

#include <lazybios.h>

Loads SMBIOS data from the host system or from captured table files.

The two path arguments select the input mode:

entry_point DMI_BIN Source
NULL NULL the host system, through the context's backend
NULL path one merged file holding the entry point and table
path path separate raw entry-point and DMI-table files

Supplying an entry point without a table is rejected, because the entry point alone describes nothing to parse.

On success the context owns copies of both buffers and its type index is built. A failed load must not be followed by a structure getter; release the context with lazybiosCleanup instead.

Parameters
ctxContext that receives the raw entry point and DMI table data.
entry_pointPath to a raw SMBIOS entry-point file, or NULL.
DMI_BINPath to a raw DMI table or merged dump file, or NULL for the host.
Returns
0 on success, or -1 on failure.

References LAZYBIOS_WARN_UNUSED, and lazybiosInit().

Referenced by lazybiosInit().