shill: Rename address -> mac_address
Rename the "address" field in DeviceInfo::Info to "mac_address",
since this struct will now also hold IP addresses.
BUG=chromium-os:19744
TEST=Rerun unit tests
Change-Id: I724e389c32ca6a730d476d825f916461161e1442
Reviewed-on: http://gerrit.chromium.org/gerrit/7179
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/device_info.cc b/device_info.cc
index 23777d4..638f88f 100644
--- a/device_info.cc
+++ b/device_info.cc
@@ -156,9 +156,9 @@
DeviceRefPtr device = GetDevice(dev_index);
if (!device.get()) {
if (msg.HasAttribute(IFLA_ADDRESS)) {
- infos_[dev_index].address = msg.GetAttribute(IFLA_ADDRESS);
+ infos_[dev_index].mac_address = msg.GetAttribute(IFLA_ADDRESS);
VLOG(2) << "link index " << dev_index << " address "
- << infos_[dev_index].address.HexEncode();
+ << infos_[dev_index].mac_address.HexEncode();
} else {
LOG(ERROR) << "Add Link message does not have IFLA_ADDRESS!";
return;
@@ -178,7 +178,7 @@
technology = GetDeviceTechnology(link_name);
}
}
- string address = infos_[dev_index].address.HexEncode();
+ string address = infos_[dev_index].mac_address.HexEncode();
switch (technology) {
case Device::kCellular:
// Cellular devices are managed by ModemInfo.
@@ -222,12 +222,12 @@
return info ? info->device : NULL;
}
-bool DeviceInfo::GetAddress(int interface_index, ByteString *address) const {
+bool DeviceInfo::GetMACAddress(int interface_index, ByteString *address) const {
const Info *info = GetInfo(interface_index);
if (!info) {
return false;
}
- *address = info->address;
+ *address = info->mac_address;
return true;
}
diff --git a/device_info.h b/device_info.h
index f7cb7dc..9cc2e91 100644
--- a/device_info.h
+++ b/device_info.h
@@ -39,7 +39,7 @@
void RegisterDevice(const DeviceRefPtr &device);
DeviceRefPtr GetDevice(int interface_index) const;
- virtual bool GetAddress(int interface_index, ByteString *address) const;
+ virtual bool GetMACAddress(int interface_index, ByteString *address) const;
virtual bool GetFlags(int interface_index, unsigned int *flags) const;
private:
@@ -50,7 +50,7 @@
Info() : flags(0) {}
DeviceRefPtr device;
- ByteString address;
+ ByteString mac_address;
unsigned int flags;
};
diff --git a/device_info_unittest.cc b/device_info_unittest.cc
index bac4b8c..228bc80 100644
--- a/device_info_unittest.cc
+++ b/device_info_unittest.cc
@@ -99,7 +99,7 @@
EXPECT_TRUE(device_info_.GetFlags(kTestDeviceIndex, &flags));
EXPECT_EQ(IFF_LOWER_UP, flags);
ByteString address;
- EXPECT_TRUE(device_info_.GetAddress(kTestDeviceIndex, &address));
+ EXPECT_TRUE(device_info_.GetMACAddress(kTestDeviceIndex, &address));
EXPECT_FALSE(address.IsEmpty());
EXPECT_TRUE(address.Equals(ByteString(kTestAddress, sizeof(kTestAddress))));
diff --git a/mock_device_info.h b/mock_device_info.h
index 97ddd2c..e179adb 100644
--- a/mock_device_info.h
+++ b/mock_device_info.h
@@ -24,7 +24,7 @@
Manager *manager);
virtual ~MockDeviceInfo();
- MOCK_CONST_METHOD2(GetAddress, bool(int, ByteString*));
+ MOCK_CONST_METHOD2(GetMACAddress, bool(int, ByteString*));
MOCK_CONST_METHOD2(GetFlags, bool(int, unsigned int*));
private:
diff --git a/modem.cc b/modem.cc
index 4f38518..50aa67c 100644
--- a/modem.cc
+++ b/modem.cc
@@ -85,7 +85,8 @@
}
ByteString address_bytes;
- if (!manager_->device_info()->GetAddress(interface_index, &address_bytes)) {
+ if (!manager_->device_info()->GetMACAddress(interface_index,
+ &address_bytes)) {
// TODO(petkov): ensure that DeviceInfo has heard about this device before
// we go ahead and try to add it.
LOG(ERROR) << "Unable to create cellular device without a hardware addr.";
diff --git a/modem_unittest.cc b/modem_unittest.cc
index 781c052..7710746 100644
--- a/modem_unittest.cc
+++ b/modem_unittest.cc
@@ -150,7 +150,7 @@
ByteString expected_address(kAddress, arraysize(kAddress));
MockDeviceInfo info_(&control_interface_, &dispatcher_, &manager_);
- EXPECT_CALL(info_, GetAddress(kTestInterfaceIndex, _))
+ EXPECT_CALL(info_, GetMACAddress(kTestInterfaceIndex, _))
.WillOnce(DoAll(SetArgumentPointee<1>(expected_address), Return(true)))
.WillOnce(DoAll(SetArgumentPointee<1>(expected_address), Return(true)));
EXPECT_CALL(manager_, device_info()).WillRepeatedly(Return(&info_));