2010-11-05 15:22:13 +01:00
|
|
|
/*
|
2012-12-13 15:31:53 +00:00
|
|
|
* virsysinfo.h: get SMBIOS/sysinfo information from the host
|
2010-11-05 15:22:13 +01:00
|
|
|
*
|
2011-02-07 16:16:04 -07:00
|
|
|
* Copyright (C) 2010-2011 Red Hat, Inc.
|
2010-11-05 15:22:13 +01: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 16:30:55 -06:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 18:06:23 +08:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-11-05 15:22:13 +01:00
|
|
|
*/
|
|
|
|
|
2019-06-18 11:13:04 -05:00
|
|
|
#pragma once
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2019-06-18 11:13:04 -05:00
|
|
|
#include "internal.h"
|
|
|
|
#include "virbuffer.h"
|
|
|
|
#include "virenum.h"
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2014-04-26 21:15:22 -03:00
|
|
|
typedef enum {
|
2011-05-27 10:47:30 +01:00
|
|
|
VIR_SYSINFO_SMBIOS,
|
2020-06-04 14:15:40 +02:00
|
|
|
VIR_SYSINFO_FWCFG,
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2011-05-27 10:47:30 +01:00
|
|
|
VIR_SYSINFO_LAST
|
2014-04-26 21:15:22 -03:00
|
|
|
} virSysinfoType;
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2011-06-27 16:39:34 +09:00
|
|
|
typedef struct _virSysinfoProcessorDef virSysinfoProcessorDef;
|
|
|
|
struct _virSysinfoProcessorDef {
|
2011-06-24 13:42:02 +08: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 16:39:34 +09:00
|
|
|
typedef struct _virSysinfoMemoryDef virSysinfoMemoryDef;
|
|
|
|
struct _virSysinfoMemoryDef {
|
2011-06-24 14:05:48 +08: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 12:02:29 +02:00
|
|
|
typedef struct _virSysinfoBIOSDef virSysinfoBIOSDef;
|
|
|
|
struct _virSysinfoBIOSDef {
|
|
|
|
char *vendor;
|
|
|
|
char *version;
|
|
|
|
char *date;
|
|
|
|
char *release;
|
|
|
|
};
|
|
|
|
|
2015-05-12 14:33:12 +02:00
|
|
|
typedef struct _virSysinfoSystemDef virSysinfoSystemDef;
|
|
|
|
struct _virSysinfoSystemDef {
|
|
|
|
char *manufacturer;
|
|
|
|
char *product;
|
|
|
|
char *version;
|
|
|
|
char *serial;
|
|
|
|
char *uuid;
|
|
|
|
char *sku;
|
|
|
|
char *family;
|
|
|
|
};
|
|
|
|
|
2015-05-12 16:47:49 +02: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 17:22:38 +08:00
|
|
|
typedef struct _virSysinfoChassisDef virSysinfoChassisDef;
|
|
|
|
struct _virSysinfoChassisDef {
|
|
|
|
char *manufacturer;
|
|
|
|
char *version;
|
|
|
|
char *serial;
|
|
|
|
char *asset;
|
|
|
|
char *sku;
|
|
|
|
};
|
|
|
|
|
2017-10-28 14:56:51 +01:00
|
|
|
typedef struct _virSysinfoOEMStringsDef virSysinfoOEMStringsDef;
|
|
|
|
struct _virSysinfoOEMStringsDef {
|
|
|
|
size_t nvalues;
|
|
|
|
char **values;
|
|
|
|
};
|
|
|
|
|
2020-06-04 14:15:40 +02:00
|
|
|
typedef struct _virSysinfoFWCfgDef virSysinfoFWCfgDef;
|
|
|
|
struct _virSysinfoFWCfgDef {
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
char *file;
|
|
|
|
};
|
|
|
|
|
2010-11-05 15:22:13 +01:00
|
|
|
typedef struct _virSysinfoDef virSysinfoDef;
|
|
|
|
struct _virSysinfoDef {
|
2020-06-04 14:15:40 +02:00
|
|
|
virSysinfoType type;
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2020-06-04 14:15:40 +02:00
|
|
|
/* The following members are valid for type == VIR_SYSINFO_SMBIOS */
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoBIOSDef *bios;
|
|
|
|
virSysinfoSystemDef *system;
|
2011-06-24 13:42:02 +08:00
|
|
|
|
2015-05-12 16:47:49 +02:00
|
|
|
size_t nbaseBoard;
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoBaseBoardDef *baseBoard;
|
2015-05-12 16:47:49 +02:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoChassisDef *chassis;
|
2018-02-14 17:22:38 +08:00
|
|
|
|
2011-06-24 13:42:02 +08:00
|
|
|
size_t nprocessor;
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoProcessorDef *processor;
|
2011-06-24 14:05:48 +08:00
|
|
|
|
|
|
|
size_t nmemory;
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoMemoryDef *memory;
|
2017-10-28 14:56:51 +01:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoOEMStringsDef *oemStrings;
|
2020-06-04 14:15:40 +02:00
|
|
|
|
|
|
|
/* The following members are valid for type == VIR_SYSINFO_FWCFG */
|
|
|
|
size_t nfw_cfgs;
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoFWCfgDef *fw_cfgs;
|
2010-11-05 15:22:13 +01:00
|
|
|
};
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
virSysinfoDef *virSysinfoRead(void);
|
2010-11-05 15:22:13 +01:00
|
|
|
|
2021-03-11 08:16:13 +01: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 15:22:13 +01:00
|
|
|
|
2021-03-11 06:17:07 +01:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virSysinfoDef, virSysinfoDefFree);
|
2019-12-20 13:43:14 +01:00
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
int virSysinfoFormat(virBuffer *buf, virSysinfoDef *def)
|
2011-02-07 16:16:04 -07:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
|
|
2021-03-11 08:16:13 +01:00
|
|
|
bool virSysinfoIsEqual(virSysinfoDef *src,
|
|
|
|
virSysinfoDef *dst);
|
2011-05-27 10:47:30 +01:00
|
|
|
|
2019-01-20 11:04:56 -05:00
|
|
|
VIR_ENUM_DECL(virSysinfo);
|