2010-11-05 14:22:13 +00:00
|
|
|
/*
|
2012-12-13 15:31:53 +00:00
|
|
|
* virsysinfo.h: get SMBIOS/sysinfo information from the host
|
2010-11-05 14:22:13 +00:00
|
|
|
*
|
2011-02-07 23:16:04 +00:00
|
|
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
2010-11-05 14:22:13 +00:00
|
|
|
* Copyright (C) 2010 Daniel Veillard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-11-05 14:22:13 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:04 +00:00
|
|
|
#pragma once
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2019-06-18 16:13:04 +00:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virbuffer.h"
|
|
|
|
#include "virenum.h"
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2014-04-27 00:15:22 +00:00
|
|
|
typedef enum {
|
2011-05-27 09:47:30 +00:00
|
|
|
VIR_SYSINFO_SMBIOS,
|
2020-06-04 12:15:40 +00:00
|
|
|
VIR_SYSINFO_FWCFG,
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2011-05-27 09:47:30 +00:00
|
|
|
VIR_SYSINFO_LAST
|
2014-04-27 00:15:22 +00:00
|
|
|
} virSysinfoType;
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2011-06-27 07:39:34 +00:00
|
|
|
typedef struct _virSysinfoProcessorDef virSysinfoProcessorDef;
|
|
|
|
struct _virSysinfoProcessorDef {
|
2011-06-24 05:42:02 +00:00
|
|
|
char *processor_socket_destination;
|
|
|
|
char *processor_type;
|
|
|
|
char *processor_family;
|
|
|
|
char *processor_manufacturer;
|
|
|
|
char *processor_signature;
|
|
|
|
char *processor_version;
|
|
|
|
char *processor_external_clock;
|
|
|
|
char *processor_max_speed;
|
|
|
|
char *processor_status;
|
|
|
|
char *processor_serial_number;
|
|
|
|
char *processor_part_number;
|
|
|
|
};
|
|
|
|
|
2011-06-27 07:39:34 +00:00
|
|
|
typedef struct _virSysinfoMemoryDef virSysinfoMemoryDef;
|
|
|
|
struct _virSysinfoMemoryDef {
|
2011-06-24 06:05:48 +00:00
|
|
|
char *memory_size;
|
|
|
|
char *memory_form_factor;
|
|
|
|
char *memory_locator;
|
|
|
|
char *memory_bank_locator;
|
|
|
|
char *memory_type;
|
|
|
|
char *memory_type_detail;
|
|
|
|
char *memory_speed;
|
|
|
|
char *memory_manufacturer;
|
|
|
|
char *memory_serial_number;
|
|
|
|
char *memory_part_number;
|
|
|
|
};
|
|
|
|
|
2015-05-12 10:02:29 +00:00
|
|
|
typedef struct _virSysinfoBIOSDef virSysinfoBIOSDef;
|
|
|
|
struct _virSysinfoBIOSDef {
|
|
|
|
char *vendor;
|
|
|
|
char *version;
|
|
|
|
char *date;
|
|
|
|
char *release;
|
|
|
|
};
|
|
|
|
|
2015-05-12 12:33:12 +00:00
|
|
|
typedef struct _virSysinfoSystemDef virSysinfoSystemDef;
|
|
|
|
struct _virSysinfoSystemDef {
|
|
|
|
char *manufacturer;
|
|
|
|
char *product;
|
|
|
|
char *version;
|
|
|
|
char *serial;
|
|
|
|
char *uuid;
|
|
|
|
char *sku;
|
|
|
|
char *family;
|
|
|
|
};
|
|
|
|
|
2015-05-12 14:47:49 +00:00
|
|
|
typedef struct _virSysinfoBaseBoardDef virSysinfoBaseBoardDef;
|
|
|
|
struct _virSysinfoBaseBoardDef {
|
|
|
|
char *manufacturer;
|
|
|
|
char *product;
|
|
|
|
char *version;
|
|
|
|
char *serial;
|
|
|
|
char *asset;
|
|
|
|
char *location;
|
|
|
|
/* XXX board type */
|
|
|
|
};
|
|
|
|
|
2018-02-14 09:22:38 +00:00
|
|
|
typedef struct _virSysinfoChassisDef virSysinfoChassisDef;
|
|
|
|
struct _virSysinfoChassisDef {
|
|
|
|
char *manufacturer;
|
|
|
|
char *version;
|
|
|
|
char *serial;
|
|
|
|
char *asset;
|
|
|
|
char *sku;
|
|
|
|
};
|
|
|
|
|
2017-10-28 13:56:51 +00:00
|
|
|
typedef struct _virSysinfoOEMStringsDef virSysinfoOEMStringsDef;
|
|
|
|
struct _virSysinfoOEMStringsDef {
|
|
|
|
size_t nvalues;
|
|
|
|
char **values;
|
|
|
|
};
|
|
|
|
|
2020-06-04 12:15:40 +00:00
|
|
|
typedef struct _virSysinfoFWCfgDef virSysinfoFWCfgDef;
|
|
|
|
struct _virSysinfoFWCfgDef {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
char *file;
|
|
|
|
};
|
|
|
|
|
2010-11-05 14:22:13 +00:00
|
|
|
typedef struct _virSysinfoDef virSysinfoDef;
|
|
|
|
struct _virSysinfoDef {
|
2020-06-04 12:15:40 +00:00
|
|
|
virSysinfoType type;
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2020-06-04 12:15:40 +00:00
|
|
|
/* The following members are valid for type == VIR_SYSINFO_SMBIOS */
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoBIOSDef *bios;
|
|
|
|
virSysinfoSystemDef *system;
|
2011-06-24 05:42:02 +00:00
|
|
|
|
2015-05-12 14:47:49 +00:00
|
|
|
size_t nbaseBoard;
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoBaseBoardDef *baseBoard;
|
2015-05-12 14:47:49 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoChassisDef *chassis;
|
2018-02-14 09:22:38 +00:00
|
|
|
|
2011-06-24 05:42:02 +00:00
|
|
|
size_t nprocessor;
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoProcessorDef *processor;
|
2011-06-24 06:05:48 +00:00
|
|
|
|
|
|
|
size_t nmemory;
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoMemoryDef *memory;
|
2017-10-28 13:56:51 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoOEMStringsDef *oemStrings;
|
2020-06-04 12:15:40 +00:00
|
|
|
|
|
|
|
/* The following members are valid for type == VIR_SYSINFO_FWCFG */
|
|
|
|
size_t nfw_cfgs;
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoFWCfgDef *fw_cfgs;
|
2010-11-05 14:22:13 +00:00
|
|
|
};
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virSysinfoDef *virSysinfoRead(void);
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
void virSysinfoBIOSDefFree(virSysinfoBIOSDef *def);
|
|
|
|
void virSysinfoSystemDefFree(virSysinfoSystemDef *def);
|
|
|
|
void virSysinfoBaseBoardDefClear(virSysinfoBaseBoardDef *def);
|
|
|
|
void virSysinfoChassisDefFree(virSysinfoChassisDef *def);
|
|
|
|
void virSysinfoOEMStringsDefFree(virSysinfoOEMStringsDef *def);
|
|
|
|
void virSysinfoDefFree(virSysinfoDef *def);
|
2010-11-05 14:22:13 +00:00
|
|
|
|
2021-03-11 05:17:07 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoDef, virSysinfoDefFree);
|
2019-12-20 12:43:14 +00:00
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
int virSysinfoFormat(virBuffer *buf, virSysinfoDef *def)
|
2011-02-07 23:16:04 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
bool virSysinfoIsEqual(virSysinfoDef *src,
|
|
|
|
virSysinfoDef *dst);
|
2011-05-27 09:47:30 +00:00
|
|
|
|
2019-01-20 16:04:56 +00:00
|
|
|
VIR_ENUM_DECL(virSysinfo);
|