Update terminology used within repo
Update the terms to more inclusive language. This change if only for
variables used in the repo.
Change-Id: I5151c9c2efab707b5dbc707e55333a3cb8c4e32b
Signed-off-by: Matt Simmering <matthew.simmering@intel.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index 62b17a0..fd735bb 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -71,25 +71,25 @@
typedef struct
{
uint8_t busId;
- uint8_t slaveAddr;
- uint8_t slaveAddrMask;
+ uint8_t targetAddr;
+ uint8_t targetAddrMask;
std::vector<uint8_t> data;
std::vector<uint8_t> dataMask;
-} i2cMasterWRWhitelist;
+} i2cControllerWRAllowlist;
-static std::vector<i2cMasterWRWhitelist>& getWRWhitelist()
+static std::vector<i2cControllerWRAllowlist>& getWRAllowlist()
{
- static std::vector<i2cMasterWRWhitelist> wrWhitelist;
- return wrWhitelist;
+ static std::vector<i2cControllerWRAllowlist> wrAllowlist;
+ return wrAllowlist;
}
-static constexpr const char* i2cMasterWRWhitelistFile =
+static constexpr const char* i2cControllerWRAllowlistFile =
"/usr/share/ipmi-providers/master_write_read_white_list.json";
static constexpr const char* filtersStr = "filters";
static constexpr const char* busIdStr = "busId";
-static constexpr const char* slaveAddrStr = "slaveAddr";
-static constexpr const char* slaveAddrMaskStr = "slaveAddrMask";
+static constexpr const char* targetAddrStr = "slaveAddr";
+static constexpr const char* targetAddrMaskStr = "slaveAddrMask";
static constexpr const char* cmdStr = "command";
static constexpr const char* cmdMaskStr = "commandMask";
static constexpr int base_16 = 16;
@@ -1533,15 +1533,16 @@
return dataValue;
}
-static bool populateI2CMasterWRWhitelist()
+static bool populateI2CControllerWRAllowlist()
{
nlohmann::json data = nullptr;
- std::ifstream jsonFile(i2cMasterWRWhitelistFile);
+ std::ifstream jsonFile(i2cControllerWRAllowlistFile);
if (!jsonFile.good())
{
- log<level::WARNING>("i2c white list file not found!",
- entry("FILE_NAME: %s", i2cMasterWRWhitelistFile));
+ log<level::WARNING>(
+ "i2c allow list file not found!",
+ entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
return false;
}
@@ -1551,8 +1552,8 @@
}
catch (const nlohmann::json::parse_error& e)
{
- log<level::ERR>("Corrupted i2c white list config file",
- entry("FILE_NAME: %s", i2cMasterWRWhitelistFile),
+ log<level::ERR>("Corrupted i2c allow list config file",
+ entry("FILE_NAME: %s", i2cControllerWRAllowlistFile),
entry("MSG: %s", e.what()));
return false;
}
@@ -1581,15 +1582,15 @@
// },]
nlohmann::json filters = data[filtersStr].get<nlohmann::json>();
- std::vector<i2cMasterWRWhitelist>& whitelist = getWRWhitelist();
+ std::vector<i2cControllerWRAllowlist>& allowlist = getWRAllowlist();
for (const auto& it : filters.items())
{
nlohmann::json filter = it.value();
if (filter.is_null())
{
log<level::ERR>(
- "Corrupted I2C master write read whitelist config file",
- entry("FILE_NAME: %s", i2cMasterWRWhitelistFile));
+ "Corrupted I2C controller write read allowlist config file",
+ entry("FILE_NAME: %s", i2cControllerWRAllowlistFile));
return false;
}
const std::vector<uint8_t>& writeData =
@@ -1598,38 +1599,39 @@
convertStringToData(filter[cmdMaskStr].get<std::string>());
if (writeDataMask.size() != writeData.size())
{
- log<level::ERR>("I2C master write read whitelist filter "
+ log<level::ERR>("I2C controller write read allowlist filter "
"mismatch for command & mask size");
return false;
}
- whitelist.push_back(
+ allowlist.push_back(
{static_cast<uint8_t>(std::stoul(
filter[busIdStr].get<std::string>(), nullptr, base_16)),
static_cast<uint8_t>(
- std::stoul(filter[slaveAddrStr].get<std::string>(),
+ std::stoul(filter[targetAddrStr].get<std::string>(),
nullptr, base_16)),
static_cast<uint8_t>(
- std::stoul(filter[slaveAddrMaskStr].get<std::string>(),
+ std::stoul(filter[targetAddrMaskStr].get<std::string>(),
nullptr, base_16)),
writeData, writeDataMask});
}
- if (whitelist.size() != filters.size())
+ if (allowlist.size() != filters.size())
{
log<level::ERR>(
- "I2C master write read whitelist filter size mismatch");
+ "I2C controller write read allowlist filter size mismatch");
return false;
}
}
catch (const std::exception& e)
{
- log<level::ERR>("I2C master write read whitelist unexpected exception",
- entry("ERROR=%s", e.what()));
+ log<level::ERR>(
+ "I2C controller write read allowlist unexpected exception",
+ entry("ERROR=%s", e.what()));
return false;
}
return true;
}
-static inline bool isWriteDataWhitelisted(const std::vector<uint8_t>& data,
+static inline bool isWriteDataAllowlisted(const std::vector<uint8_t>& data,
const std::vector<uint8_t>& dataMask,
const std::vector<uint8_t>& writeData)
{
@@ -1643,15 +1645,15 @@
return (processedDataBuf == processedReqBuf);
}
-static bool isCmdWhitelisted(uint8_t busId, uint8_t slaveAddr,
+static bool isCmdAllowlisted(uint8_t busId, uint8_t targetAddr,
std::vector<uint8_t>& writeData)
{
- std::vector<i2cMasterWRWhitelist>& whiteList = getWRWhitelist();
- for (const auto& wlEntry : whiteList)
+ std::vector<i2cControllerWRAllowlist>& allowList = getWRAllowlist();
+ for (const auto& wlEntry : allowList)
{
if ((busId == wlEntry.busId) &&
- ((slaveAddr | wlEntry.slaveAddrMask) ==
- (wlEntry.slaveAddr | wlEntry.slaveAddrMask)))
+ ((targetAddr | wlEntry.targetAddrMask) ==
+ (wlEntry.targetAddr | wlEntry.targetAddrMask)))
{
const std::vector<uint8_t>& dataMask = wlEntry.dataMask;
// Skip as no-match, if requested write data is more than the
@@ -1660,7 +1662,7 @@
{
continue;
}
- if (isWriteDataWhitelisted(wlEntry.data, dataMask, writeData))
+ if (isWriteDataAllowlisted(wlEntry.data, dataMask, writeData))
{
return true;
}
@@ -1669,21 +1671,21 @@
return false;
}
#else
-static bool populateI2CMasterWRWhitelist()
+static bool populateI2CControllerWRAllowlist()
{
log<level::INFO>(
- "I2C_WHITELIST_CHECK is disabled, do not populate whitelist");
+ "I2C_WHITELIST_CHECK is disabled, do not populate allowlist");
return true;
}
#endif // ENABLE_I2C_WHITELIST_CHECK
-/** @brief implements master write read IPMI command which can be used for
+/** @brief implements controller write read IPMI command which can be used for
* low-level I2C/SMBus write, read or write-read access
* @param isPrivateBus -to indicate private bus usage
* @param busId - bus id
* @param channelNum - channel number
* @param reserved - skip 1 bit
- * @param slaveAddr - slave address
+ * @param targetAddr - target address
* @param read count - number of bytes to be read
* @param writeData - data to be written
*
@@ -1691,10 +1693,10 @@
* - readData - i2c response data
*/
ipmi::RspType<std::vector<uint8_t>>
- ipmiMasterWriteRead([[maybe_unused]] bool isPrivateBus, uint3_t busId,
- [[maybe_unused]] uint4_t channelNum, bool reserved,
- uint7_t slaveAddr, uint8_t readCount,
- std::vector<uint8_t> writeData)
+ ipmiControllerWriteRead([[maybe_unused]] bool isPrivateBus, uint3_t busId,
+ [[maybe_unused]] uint4_t channelNum, bool reserved,
+ uint7_t targetAddr, uint8_t readCount,
+ std::vector<uint8_t> writeData)
{
if (reserved)
{
@@ -1703,16 +1705,17 @@
const size_t writeCount = writeData.size();
if (!readCount && !writeCount)
{
- log<level::ERR>("Master write read command: Read & write count are 0");
+ log<level::ERR>(
+ "Controller write read command: Read & write count are 0");
return ipmi::responseInvalidFieldRequest();
}
#ifdef ENABLE_I2C_WHITELIST_CHECK
- if (!isCmdWhitelisted(static_cast<uint8_t>(busId),
- static_cast<uint8_t>(slaveAddr), writeData))
+ if (!isCmdAllowlisted(static_cast<uint8_t>(busId),
+ static_cast<uint8_t>(targetAddr), writeData))
{
- log<level::ERR>("Master write read request blocked!",
+ log<level::ERR>("Controller write read request blocked!",
entry("BUS=%d", static_cast<uint8_t>(busId)),
- entry("ADDR=0x%x", static_cast<uint8_t>(slaveAddr)));
+ entry("ADDR=0x%x", static_cast<uint8_t>(targetAddr)));
return ipmi::responseInvalidFieldRequest();
}
#endif // ENABLE_I2C_WHITELIST_CHECK
@@ -1720,7 +1723,7 @@
std::string i2cBus = "/dev/i2c-" +
std::to_string(static_cast<uint8_t>(busId));
- ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(slaveAddr),
+ ipmi::Cc ret = ipmi::i2cWriteRead(i2cBus, static_cast<uint8_t>(targetAddr),
writeData, readBuf);
if (ret != ipmi::ccSuccess)
{
@@ -1784,15 +1787,15 @@
ipmi::Privilege::User, ipmiGetAcpiPowerState);
// Note: For security reason, this command will be registered only when
- // there are proper I2C Master write read whitelist
- if (populateI2CMasterWRWhitelist())
+ // there are proper I2C Controller write read allowlist
+ if (populateI2CControllerWRAllowlist())
{
- // Note: For security reasons, registering master write read as admin
- // privilege command, even though IPMI 2.0 specification allows it as
- // operator privilege.
+ // Note: For security reasons, registering controller write read as
+ // admin privilege command, even though IPMI 2.0 specification allows it
+ // as operator privilege.
ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnApp,
ipmi::app::cmdMasterWriteRead,
- ipmi::Privilege::Admin, ipmiMasterWriteRead);
+ ipmi::Privilege::Admin, ipmiControllerWriteRead);
}
// <Get System GUID Command>
diff --git a/dcmihandler.cpp b/dcmihandler.cpp
index 31bca0c..07f1b63 100644
--- a/dcmihandler.cpp
+++ b/dcmihandler.cpp
@@ -684,12 +684,12 @@
// Optional Platform Attributes
case DCMICapParameters::OptionalPlatAttributes:
{
- uint7_t powerMgmtDeviceSlaveAddress =
+ uint7_t powerMgmtDeviceTargetAddress =
data.value("PowerMgmtDeviceSlaveAddress", 0);
uint4_t bmcChannelNumber = data.value("BMCChannelNumber", 0);
uint4_t deviceRivision = data.value("DeviceRivision", 0);
- payload.pack(powerMgmtDeviceSlaveAddress, reserved1, deviceRivision,
- bmcChannelNumber);
+ payload.pack(powerMgmtDeviceTargetAddress, reserved1,
+ deviceRivision, bmcChannelNumber);
break;
}
// Manageability Access Attributes
diff --git a/generate_whitelist.sh b/generate_whitelist.sh
index d7d2a71..223ef75 100755
--- a/generate_whitelist.sh
+++ b/generate_whitelist.sh
@@ -7,7 +7,7 @@
fi
cat << EOF
-#include <ipmiwhitelist.hpp>
+#include <ipmiallowlist.hpp>
const std::vector<netfncmd_pair> whitelist = {
diff --git a/include/dbus-sdr/storagecommands.hpp b/include/dbus-sdr/storagecommands.hpp
index c8baaf1..7b3046c 100644
--- a/include/dbus-sdr/storagecommands.hpp
+++ b/include/dbus-sdr/storagecommands.hpp
@@ -81,7 +81,7 @@
struct Type12Record
{
get_sdr::SensorDataRecordHeader header;
- uint8_t slaveAddress;
+ uint8_t targetAddress;
uint8_t channelNumber;
uint8_t powerStateNotification;
uint8_t deviceCapabilities;
@@ -98,7 +98,7 @@
uint8_t pwrStateNotification, uint8_t capabilities,
uint8_t eid, uint8_t entityInst, uint8_t mfrDefined,
const std::string& sensorname) :
- slaveAddress(address),
+ targetAddress(address),
channelNumber(chNumber), powerStateNotification(pwrStateNotification),
deviceCapabilities(capabilities), reserved{}, entityID(eid),
entityInstance(entityInst), oem(mfrDefined)
diff --git a/include/ipmid/utils.hpp b/include/ipmid/utils.hpp
index 20f9847..1e2005f 100644
--- a/include/ipmid/utils.hpp
+++ b/include/ipmid/utils.hpp
@@ -457,11 +457,11 @@
/** @brief Perform the low-level i2c bus write-read.
* @param[in] i2cBus - i2c bus device node name, such as /dev/i2c-2.
- * @param[in] slaveAddr - i2c device slave address.
+ * @param[in] targetAddr - i2c device target address.
* @param[in] writeData - The data written to i2c device.
* @param[out] readBuf - Data read from the i2c device.
*/
-ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
+ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t targetAddr,
std::vector<uint8_t> writeData,
std::vector<uint8_t>& readBuf);
} // namespace ipmi
diff --git a/ipmiwhitelist.hpp b/ipmiallowlist.hpp
similarity index 69%
rename from ipmiwhitelist.hpp
rename to ipmiallowlist.hpp
index fd45a3d..7519de8 100644
--- a/ipmiwhitelist.hpp
+++ b/ipmiallowlist.hpp
@@ -5,4 +5,4 @@
using netfncmd_pair = std::pair<unsigned char, unsigned char>;
-extern const std::vector<netfncmd_pair> whitelist;
+extern const std::vector<netfncmd_pair> allowlist;
diff --git a/libipmid/utils.cpp b/libipmid/utils.cpp
index 1c94aad..f7e9802 100644
--- a/libipmid/utils.cpp
+++ b/libipmid/utils.cpp
@@ -564,7 +564,7 @@
/********* End co-routine yielding alternatives ***************/
-ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t slaveAddr,
+ipmi::Cc i2cWriteRead(std::string i2cBus, const uint8_t targetAddr,
std::vector<uint8_t> writeData,
std::vector<uint8_t>& readBuf)
{
@@ -583,8 +583,8 @@
i2c_msg i2cmsg[2] = {};
if (writeCount)
{
- // Data will be writtern to the slave address
- i2cmsg[msgCount].addr = slaveAddr;
+ // Data will be writtern to the target address
+ i2cmsg[msgCount].addr = targetAddr;
i2cmsg[msgCount].flags = 0x00;
i2cmsg[msgCount].len = writeCount;
i2cmsg[msgCount].buf = writeData.data();
@@ -592,8 +592,8 @@
}
if (readCount)
{
- // Data will be read into the buffer from the slave address
- i2cmsg[msgCount].addr = slaveAddr;
+ // Data will be read into the buffer from the target address
+ i2cmsg[msgCount].addr = targetAddr;
i2cmsg[msgCount].flags = I2C_M_RD;
i2cmsg[msgCount].len = readCount;
i2cmsg[msgCount].buf = readBuf.data();
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 1483456..ad7286b 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -24,7 +24,7 @@
static constexpr uint8_t fruInventoryDevice = 0x10;
static constexpr uint8_t IPMIFruInventory = 0x02;
-static constexpr uint8_t BMCSlaveAddress = 0x20;
+static constexpr uint8_t BMCTargetAddress = 0x20;
extern int updateSensorRecordFromSSRAESC(const void*);
extern sd_bus* bus;
@@ -1150,7 +1150,7 @@
/* Key */
record.key.fruID = fruID;
record.key.accessLun |= IPMI_LOGICAL_FRU;
- record.key.deviceAddress = BMCSlaveAddress;
+ record.key.deviceAddress = BMCTargetAddress;
/* Body */
record.body.entityID = fru->second[0].entityID;
diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp
index cb0d4eb..be98e1c 100644
--- a/whitelist-filter.cpp
+++ b/whitelist-filter.cpp
@@ -1,6 +1,6 @@
+#include <ipmiallowlist.hpp>
#include <ipmid/api.hpp>
#include <ipmid/utils.hpp>
-#include <ipmiwhitelist.hpp>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <settings.hpp>
@@ -20,20 +20,20 @@
namespace
{
-/** @class WhitelistFilter
+/** @class AllowlistFilter
*
* Class that implements an IPMI message filter based
* on incoming interface and a restriction mode setting
*/
-class WhitelistFilter
+class AllowlistFilter
{
public:
- WhitelistFilter();
- ~WhitelistFilter() = default;
- WhitelistFilter(const WhitelistFilter&) = delete;
- WhitelistFilter(WhitelistFilter&&) = delete;
- WhitelistFilter& operator=(const WhitelistFilter&) = delete;
- WhitelistFilter& operator=(WhitelistFilter&&) = delete;
+ AllowlistFilter();
+ ~AllowlistFilter() = default;
+ AllowlistFilter(const AllowlistFilter&) = delete;
+ AllowlistFilter(AllowlistFilter&&) = delete;
+ AllowlistFilter& operator=(const AllowlistFilter&) = delete;
+ AllowlistFilter& operator=(AllowlistFilter&&) = delete;
private:
void postInit();
@@ -52,11 +52,11 @@
"xyz.openbmc_project.Control.Security.RestrictionMode";
};
-WhitelistFilter::WhitelistFilter()
+AllowlistFilter::AllowlistFilter()
{
bus = getSdBus();
- log<level::INFO>("Loading whitelist filter");
+ log<level::INFO>("Loading allowlist filter");
ipmi::registerFilter(ipmi::prioOpenBmcBase,
[this](ipmi::message::Request::ptr request) {
return filterMessage(request);
@@ -72,7 +72,7 @@
* @returns void.
*/
-void WhitelistFilter::cacheRestrictedMode(
+void AllowlistFilter::cacheRestrictedMode(
const std::vector<std::string>& devices)
{
using namespace sdbusplus::server::xyz::openbmc_project::control::security;
@@ -128,7 +128,7 @@
* @returns void.
*/
-void WhitelistFilter::handleRestrictedModeChange(
+void AllowlistFilter::handleRestrictedModeChange(
sdbusplus::message_t& m, const std::map<std::string, size_t>& deviceList)
{
using namespace sdbusplus::server::xyz::openbmc_project::control::security;
@@ -170,7 +170,7 @@
* @returns void.
*/
-void WhitelistFilter::postInit()
+void AllowlistFilter::postInit()
{
objects = std::make_unique<settings::Objects>(
*bus, std::vector<settings::Interface>({restrictionModeIntf}));
@@ -220,7 +220,7 @@
* @returns IPMI completion code success or error.
*/
-ipmi::Cc WhitelistFilter::filterMessage(ipmi::message::Request::ptr request)
+ipmi::Cc AllowlistFilter::filterMessage(ipmi::message::Request::ptr request)
{
/* Getting hostIdx for all IPMI devices like hosts, debugcard and other
devices from ipmi::message::Request and call postInit() to get the
@@ -232,10 +232,10 @@
restrictedMode[hostIdx])
{
if (!std::binary_search(
- whitelist.cbegin(), whitelist.cend(),
+ allowlist.cbegin(), allowlist.cend(),
std::make_pair(request->ctx->netFn, request->ctx->cmd)))
{
- log<level::ERR>("Net function not whitelisted",
+ log<level::ERR>("Net function not allowlisted",
entry("NETFN=0x%X", int(request->ctx->netFn)),
entry("CMD=0x%X", int(request->ctx->cmd)));
@@ -245,8 +245,8 @@
return ipmi::ccSuccess;
}
-// instantiate the WhitelistFilter when this shared object is loaded
-WhitelistFilter whitelistFilter;
+// instantiate the AllowlistFilter when this shared object is loaded
+AllowlistFilter allowlistFilter;
} // namespace