Migrate CAN bus HAL to nested namespaces
Test: it builds
Change-Id: I83d9ef4f1fff1585e6487c95f09b55b1aa5b3e63
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
index 9845bc7..556debf 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.cpp
@@ -18,9 +18,7 @@
#include <android-base/logging.h>
-namespace android {
-namespace netdevice {
-namespace impl {
+namespace android::netdevice::impl {
static struct rtattr* nlmsg_tail(struct nlmsghdr* n) {
return reinterpret_cast<struct rtattr*>( //
@@ -53,6 +51,4 @@
nest->rta_len = nestLen;
}
-} // namespace impl
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::impl
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
index ba9b65b..3e28d78 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkRequest.h
@@ -21,8 +21,7 @@
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
typedef unsigned short rtattrtype_t; // as in rtnetlink.h
typedef __u16 nlmsgtype_t; // as in netlink.h
@@ -151,5 +150,4 @@
}
};
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
index 0514764..6a7f506 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.cpp
@@ -18,8 +18,7 @@
#include <android-base/logging.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
NetlinkSocket::NetlinkSocket(int protocol) {
mFd.reset(socket(AF_NETLINK, SOCK_RAW, protocol));
@@ -110,5 +109,4 @@
return false;
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
index 90e1f3f..2b40ea2 100644
--- a/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
+++ b/automotive/can/1.0/default/libnetdevice/NetlinkSocket.h
@@ -23,8 +23,7 @@
#include <linux/netlink.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* A wrapper around AF_NETLINK sockets.
@@ -64,5 +63,4 @@
DISALLOW_COPY_AND_ASSIGN(NetlinkSocket);
};
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/can.cpp b/automotive/can/1.0/default/libnetdevice/can.cpp
index 6452d9b..06d45d3 100644
--- a/automotive/can/1.0/default/libnetdevice/can.cpp
+++ b/automotive/can/1.0/default/libnetdevice/can.cpp
@@ -28,9 +28,7 @@
#include <linux/can/netlink.h>
#include <linux/can/raw.h>
-namespace android {
-namespace netdevice {
-namespace can {
+namespace android::netdevice::can {
static constexpr can_err_mask_t kErrMask = CAN_ERR_MASK;
@@ -95,6 +93,4 @@
return sock.send(req) && sock.receiveAck();
}
-} // namespace can
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::can
diff --git a/automotive/can/1.0/default/libnetdevice/common.cpp b/automotive/can/1.0/default/libnetdevice/common.cpp
index 3deac3e..5c62443 100644
--- a/automotive/can/1.0/default/libnetdevice/common.cpp
+++ b/automotive/can/1.0/default/libnetdevice/common.cpp
@@ -20,8 +20,7 @@
#include <net/if.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
unsigned int nametoindex(const std::string& ifname) {
const auto ifidx = if_nametoindex(ifname.c_str());
@@ -34,5 +33,4 @@
return 0;
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/common.h b/automotive/can/1.0/default/libnetdevice/common.h
index 9bdff4d..8097f37 100644
--- a/automotive/can/1.0/default/libnetdevice/common.h
+++ b/automotive/can/1.0/default/libnetdevice/common.h
@@ -18,8 +18,7 @@
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* Returns the index of a given network interface.
@@ -32,5 +31,4 @@
*/
unsigned int nametoindex(const std::string& ifname);
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
index d75361e..3886acf 100644
--- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
+++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/can.h
@@ -20,9 +20,7 @@
#include <string>
-namespace android {
-namespace netdevice {
-namespace can {
+namespace android::netdevice::can {
/**
* Opens and binds SocketCAN socket.
@@ -40,6 +38,4 @@
*/
bool setBitrate(std::string ifname, uint32_t bitrate);
-} // namespace can
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice::can
diff --git a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
index e22eafb..3818a31 100644
--- a/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
+++ b/automotive/can/1.0/default/libnetdevice/include/libnetdevice/libnetdevice.h
@@ -19,8 +19,7 @@
#include <optional>
#include <string>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
/**
* Checks, if the network interface exists.
@@ -71,5 +70,4 @@
*/
bool del(std::string dev);
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice
diff --git a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
index fc2b193..aee8205 100644
--- a/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
+++ b/automotive/can/1.0/default/libnetdevice/libnetdevice.cpp
@@ -25,8 +25,7 @@
#include <linux/can.h>
#include <net/if.h>
-namespace android {
-namespace netdevice {
+namespace android::netdevice {
bool exists(std::string ifname) {
return nametoindex(ifname) != 0;
@@ -96,5 +95,4 @@
return sock.send(req) && sock.receiveAck();
}
-} // namespace netdevice
-} // namespace android
+} // namespace android::netdevice