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>