diff --git a/src/fru_device.cpp b/src/fru_device.cpp
index fd083d0..138568c 100644
--- a/src/fru_device.cpp
+++ b/src/fru_device.cpp
@@ -65,7 +65,7 @@
 constexpr size_t maxEepromPageIndex = 255;
 constexpr size_t busTimeoutSeconds = 10;
 
-constexpr const char* blacklistPath = PACKAGE_DIR "blacklist.json";
+constexpr const char* blocklistPath = PACKAGE_DIR "blacklist.json";
 
 const static constexpr char* baseboardFruLocation =
     "/etc/fru/baseboard.fru.bin";
@@ -73,7 +73,7 @@
 const static constexpr char* i2CDevLocation = "/dev";
 
 static boost::container::flat_map<size_t, std::optional<std::set<size_t>>>
-    busBlacklist;
+    busBlocklist;
 struct FindDevicesWithCallback;
 
 static boost::container::flat_map<
@@ -230,14 +230,15 @@
     return false;
 }
 
-// Issue an I2C transaction to first write to_slave_buf_len bytes,then read
-// from_slave_buf_len bytes.
+// Issue an I2C transaction to first write to_target_buf_len bytes,then read
+// from_target_buf_len bytes.
 static int i2cSmbusWriteThenRead(int file, uint16_t address,
-                                 uint8_t* toSlaveBuf, uint8_t toSlaveBufLen,
-                                 uint8_t* fromSlaveBuf, uint8_t fromSlaveBufLen)
+                                 uint8_t* toTargetBuf, uint8_t toTargetBufLen,
+                                 uint8_t* fromTargetBuf,
+                                 uint8_t fromTargetBufLen)
 {
-    if (toSlaveBuf == nullptr || toSlaveBufLen == 0 ||
-        fromSlaveBuf == nullptr || fromSlaveBufLen == 0)
+    if (toTargetBuf == nullptr || toTargetBufLen == 0 ||
+        fromTargetBuf == nullptr || fromTargetBufLen == 0)
     {
         return -1;
     }
@@ -249,12 +250,12 @@
 
     msgs[0].addr = address;
     msgs[0].flags = 0;
-    msgs[0].len = toSlaveBufLen;
-    msgs[0].buf = toSlaveBuf;
+    msgs[0].len = toTargetBufLen;
+    msgs[0].buf = toTargetBuf;
     msgs[1].addr = address;
     msgs[1].flags = I2C_M_RD;
-    msgs[1].len = fromSlaveBufLen;
-    msgs[1].buf = fromSlaveBuf;
+    msgs[1].len = fromTargetBufLen;
+    msgs[1].buf = fromTargetBuf;
 
     rdwr.msgs = msgs.data();
     rdwr.nmsgs = msgs.size();
@@ -411,8 +412,8 @@
         std::set<size_t>& foundItems = fruAddresses[bus];
         foundItems.clear();
 
-        auto busFind = busBlacklist.find(bus);
-        if (busFind != busBlacklist.end())
+        auto busFind = busBlocklist.find(bus);
+        if (busFind != busBlocklist.end())
         {
             if (busFind->second != std::nullopt)
             {
@@ -428,8 +429,8 @@
 
         if (rootBus >= 0)
         {
-            auto rootBusFind = busBlacklist.find(rootBus);
-            if (rootBusFind != busBlacklist.end())
+            auto rootBusFind = busBlocklist.find(rootBus);
+            if (rootBusFind != busBlocklist.end())
             {
                 if (rootBusFind->second != std::nullopt)
                 {
@@ -443,8 +444,8 @@
             foundItems = fruAddresses[rootBus];
         }
 
-        constexpr int startSkipSlaveAddr = 0;
-        constexpr int endSkipSlaveAddr = 12;
+        constexpr int startSkipTargetAddr = 0;
+        constexpr int endSkipTargetAddr = 12;
 
         for (int ii = first; ii <= last; ii++)
         {
@@ -457,11 +458,11 @@
                 continue;
             }
             // skipping since no device is present in this range
-            if (ii >= startSkipSlaveAddr && ii <= endSkipSlaveAddr)
+            if (ii >= startSkipTargetAddr && ii <= endSkipTargetAddr)
             {
                 continue;
             }
-            // Set slave address
+            // Set target address
             if (ioctl(file, I2C_SLAVE, ii) < 0)
             {
                 std::cerr << "device at bus " << bus << " address " << ii
@@ -554,7 +555,7 @@
         std::cerr << "Error reading bus " << bus << "\n";
         if (powerIsOn)
         {
-            busBlacklist[bus] = std::nullopt;
+            busBlocklist[bus] = std::nullopt;
         }
         close(file);
         return -1;
@@ -564,21 +565,21 @@
     return future.get();
 }
 
-void loadBlacklist(const char* path)
+void loadBlocklist(const char* path)
 {
-    std::ifstream blacklistStream(path);
-    if (!blacklistStream.good())
+    std::ifstream blocklistStream(path);
+    if (!blocklistStream.good())
     {
         // File is optional.
-        std::cerr << "Cannot open blacklist file.\n\n";
+        std::cerr << "Cannot open blocklist file.\n\n";
         return;
     }
 
-    nlohmann::json data = nlohmann::json::parse(blacklistStream, nullptr,
+    nlohmann::json data = nlohmann::json::parse(blocklistStream, nullptr,
                                                 false);
     if (data.is_discarded())
     {
-        std::cerr << "Illegal blacklist file detected, cannot validate JSON, "
+        std::cerr << "Illegal blocklist file detected, cannot validate JSON, "
                      "exiting\n";
         std::exit(EXIT_FAILURE);
     }
@@ -588,7 +589,7 @@
     // such as specific addresses or ranges.
     if (data.type() != nlohmann::json::value_t::object)
     {
-        std::cerr << "Illegal blacklist, expected to read dictionary\n";
+        std::cerr << "Illegal blocklist, expected to read dictionary\n";
         std::exit(EXIT_FAILURE);
     }
 
@@ -600,7 +601,7 @@
         if (buses.type() != nlohmann::json::value_t::array)
         {
             // Buses field present but invalid, therefore this is an error.
-            std::cerr << "Invalid contents for blacklist buses field\n";
+            std::cerr << "Invalid contents for blocklist buses field\n";
             std::exit(EXIT_FAILURE);
         }
 
@@ -620,18 +621,18 @@
                     auto addresses =
                         addressData.get<std::set<std::string_view>>();
 
-                    busBlacklist[bus].emplace();
+                    busBlocklist[bus].emplace();
                     for (const auto& address : addresses)
                     {
                         size_t addressInt = 0;
                         std::from_chars(address.begin() + 2, address.end(),
                                         addressInt, 16);
-                        busBlacklist[bus]->insert(addressInt);
+                        busBlocklist[bus]->insert(addressInt);
                     }
                 }
                 else
                 {
-                    busBlacklist[busIterator.get<size_t>()] = std::nullopt;
+                    busBlocklist[busIterator.get<size_t>()] = std::nullopt;
                 }
             }
         }
@@ -657,8 +658,8 @@
             std::cerr << "Cannot translate " << i2cBus << " to int\n";
             continue;
         }
-        auto busFind = busBlacklist.find(bus);
-        if (busFind != busBlacklist.end())
+        auto busFind = busBlocklist.find(bus);
+        if (busFind != busBlocklist.end())
         {
             if (busFind->second == std::nullopt)
             {
@@ -666,8 +667,8 @@
             }
         }
         int rootBus = getRootBus(bus);
-        auto rootBusFind = busBlacklist.find(rootBus);
-        if (rootBusFind != busBlacklist.end())
+        auto rootBusFind = busBlocklist.find(rootBus);
+        if (rootBusFind != busBlocklist.end())
         {
             if (rootBusFind->second == std::nullopt)
             {
@@ -1318,8 +1319,8 @@
         return 1;
     }
 
-    // check for and load blacklist with initial buses.
-    loadBlacklist(blacklistPath);
+    // check for and load blocklist with initial buses.
+    loadBlocklist(blocklistPath);
 
     systemBus->request_name("xyz.openbmc_project.FruDevice");
 
