加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fru_area.cpp 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
#include "fru_area.hpp"
#include "frup.hpp"
#include <phosphor-logging/log.hpp>
#include <cstdint>
#include <cstring>
using namespace phosphor::logging;
IPMIFruArea::IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type,
bool bmcOnlyFru) :
fruID(fruID),
type(type), bmcOnlyFru(bmcOnlyFru)
{
if (type == IPMI_FRU_AREA_INTERNAL_USE)
{
name = "INTERNAL_";
}
else if (type == IPMI_FRU_AREA_CHASSIS_INFO)
{
name = "CHASSIS_";
}
else if (type == IPMI_FRU_AREA_BOARD_INFO)
{
name = "BOARD_";
}
else if (type == IPMI_FRU_AREA_PRODUCT_INFO)
{
name = "PRODUCT_";
}
else if (type == IPMI_FRU_AREA_MULTI_RECORD)
{
name = "MULTI_";
}
else
{
name = IPMI_FRU_AREA_TYPE_MAX;
log<level::ERR>("Invalid Area", entry("TYPE=%d", type));
}
}
void IPMIFruArea::setData(const uint8_t* value, const size_t length)
{
data.reserve(length); // pre-allocate the space.
data.insert(data.begin(), value, value + length);
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化