namespace cvd -> namespace cuttlefish
This is a mechanical change using the following commands:
sed -i "s/namespace cvd/namespace cuttlefish/g" $(find . -type f)
sed -i "s/cvd::/cuttlefish::/g" $(find . -type f)
Bug: 159054521
Test: make -j
Change-Id: I1d3afa0e3aa094061a162fd834b28e1b31395243
diff --git a/common/frontend/socket_vsock_proxy/main.cpp b/common/frontend/socket_vsock_proxy/main.cpp
index 61054c1..9237d73 100644
--- a/common/frontend/socket_vsock_proxy/main.cpp
+++ b/common/frontend/socket_vsock_proxy/main.cpp
@@ -39,7 +39,7 @@
// Sends packets, Shutdown(SHUT_WR) on destruction
class SocketSender {
public:
- explicit SocketSender(cvd::SharedFD socket) : socket_{socket} {}
+ explicit SocketSender(cuttlefish::SharedFD socket) : socket_{socket} {}
SocketSender(SocketSender&&) = default;
SocketSender& operator=(SocketSender&&) = default;
@@ -73,12 +73,12 @@
}
private:
- cvd::SharedFD socket_;
+ cuttlefish::SharedFD socket_;
};
class SocketReceiver {
public:
- explicit SocketReceiver(cvd::SharedFD socket) : socket_{socket} {}
+ explicit SocketReceiver(cuttlefish::SharedFD socket) : socket_{socket} {}
SocketReceiver(SocketReceiver&&) = default;
SocketReceiver& operator=(SocketReceiver&&) = default;
@@ -97,7 +97,7 @@
}
private:
- cvd::SharedFD socket_;
+ cuttlefish::SharedFD socket_;
};
void SocketToVsock(SocketReceiver socket_receiver,
@@ -131,8 +131,8 @@
// One thread for reading from shm and writing into a socket.
// One thread for reading from a socket and writing into shm.
-void HandleConnection(cvd::SharedFD vsock,
- cvd::SharedFD socket) {
+void HandleConnection(cuttlefish::SharedFD vsock,
+ cuttlefish::SharedFD socket) {
auto socket_to_vsock =
std::thread(SocketToVsock, SocketReceiver{socket}, SocketSender{vsock});
VsockToSocket(SocketSender{socket}, SocketReceiver{vsock});
@@ -142,14 +142,14 @@
[[noreturn]] void TcpServer() {
LOG(DEBUG) << "starting TCP server on " << FLAGS_tcp_port
<< " for vsock port " << FLAGS_vsock_port;
- auto server = cvd::SharedFD::SocketLocalServer(FLAGS_tcp_port, SOCK_STREAM);
+ auto server = cuttlefish::SharedFD::SocketLocalServer(FLAGS_tcp_port, SOCK_STREAM);
CHECK(server->IsOpen()) << "Could not start server on " << FLAGS_tcp_port;
LOG(DEBUG) << "Accepting client connections";
int last_failure_reason = 0;
while (true) {
- auto client_socket = cvd::SharedFD::Accept(*server);
+ auto client_socket = cuttlefish::SharedFD::Accept(*server);
CHECK(client_socket->IsOpen()) << "error creating client socket";
- cvd::SharedFD vsock_socket = cvd::SharedFD::VsockClient(
+ cuttlefish::SharedFD vsock_socket = cuttlefish::SharedFD::VsockClient(
FLAGS_vsock_cid, FLAGS_vsock_port, SOCK_STREAM);
if (vsock_socket->IsOpen()) {
last_failure_reason = 0;
@@ -170,9 +170,9 @@
}
}
-cvd::SharedFD OpenSocketConnection() {
+cuttlefish::SharedFD OpenSocketConnection() {
while (true) {
- auto sock = cvd::SharedFD::SocketLocalClient(FLAGS_tcp_port, SOCK_STREAM);
+ auto sock = cuttlefish::SharedFD::SocketLocalClient(FLAGS_tcp_port, SOCK_STREAM);
if (sock->IsOpen()) {
return sock;
}
@@ -195,9 +195,9 @@
[[noreturn]] void VsockServer() {
LOG(DEBUG) << "Starting vsock server on " << FLAGS_vsock_port;
- cvd::SharedFD vsock;
+ cuttlefish::SharedFD vsock;
do {
- vsock = cvd::SharedFD::VsockServer(FLAGS_vsock_port, SOCK_STREAM);
+ vsock = cuttlefish::SharedFD::VsockServer(FLAGS_vsock_port, SOCK_STREAM);
if (!vsock->IsOpen() && !socketErrorIsRecoverable(vsock->GetErrno())) {
LOG(ERROR) << "Could not open vsock socket: " << vsock->StrError();
SleepForever();
@@ -206,7 +206,7 @@
CHECK(vsock->IsOpen()) << "Could not start server on " << FLAGS_vsock_port;
while (true) {
LOG(DEBUG) << "waiting for vsock connection";
- auto vsock_client = cvd::SharedFD::Accept(*vsock);
+ auto vsock_client = cuttlefish::SharedFD::Accept(*vsock);
CHECK(vsock_client->IsOpen()) << "error creating vsock socket";
LOG(DEBUG) << "vsock socket accepted";
auto client = OpenSocketConnection();
@@ -221,7 +221,7 @@
int main(int argc, char* argv[]) {
#ifdef CUTTLEFISH_HOST
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
#else
::android::base::InitLogging(argv, android::base::LogdLogger());
#endif
diff --git a/common/libs/device_config/device_config.cpp b/common/libs/device_config/device_config.cpp
index c13f869..cddf400 100644
--- a/common/libs/device_config/device_config.cpp
+++ b/common/libs/device_config/device_config.cpp
@@ -21,7 +21,7 @@
#include <android-base/logging.h>
-namespace cvd {
+namespace cuttlefish {
// TODO(jemoreira): Endianness when on arm64 guest and x86 host is a problem
// Raw data is sent through a vsocket from host to guest, this assert tries to
@@ -38,7 +38,7 @@
} // namespace
-bool DeviceConfig::SendRawData(cvd::SharedFD fd) {
+bool DeviceConfig::SendRawData(cuttlefish::SharedFD fd) {
std::size_t sent = 0;
auto buffer = reinterpret_cast<uint8_t*>(&data_);
while (sent < kDataSize) {
@@ -58,4 +58,4 @@
ril_address_and_prefix_ = ss.str();
}
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/common/libs/device_config/device_config.h b/common/libs/device_config/device_config.h
index 0e3680f..bbd74d1 100644
--- a/common/libs/device_config/device_config.h
+++ b/common/libs/device_config/device_config.h
@@ -27,7 +27,7 @@
#include <host/libs/config/cuttlefish_config.h>
#endif
-namespace cvd {
+namespace cuttlefish {
class DeviceConfig {
public:
@@ -57,7 +57,7 @@
static std::unique_ptr<DeviceConfig> Get();
- bool SendRawData(cvd::SharedFD fd);
+ bool SendRawData(cuttlefish::SharedFD fd);
const char* ril_address_and_prefix() const {
return ril_address_and_prefix_.c_str();
@@ -86,4 +86,4 @@
std::string ril_address_and_prefix_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/device_config/guest_device_config.cpp b/common/libs/device_config/guest_device_config.cpp
index 0be87be..7be6c5c 100644
--- a/common/libs/device_config/guest_device_config.cpp
+++ b/common/libs/device_config/guest_device_config.cpp
@@ -22,7 +22,7 @@
#include <cutils/properties.h>
#include <android-base/logging.h>
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -39,7 +39,7 @@
return false;
}
auto config_server =
- cvd::SharedFD::VsockClient(2 /*host cid*/,
+ cuttlefish::SharedFD::VsockClient(2 /*host cid*/,
static_cast<unsigned int>(port), SOCK_STREAM);
if (!config_server->IsOpen()) {
LOG(ERROR) << "Unable to connect to config server: "
@@ -87,4 +87,4 @@
generate_address_and_prefix();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/device_config/host_device_config.cpp b/common/libs/device_config/host_device_config.cpp
index 8299b03..0a3f0a0 100644
--- a/common/libs/device_config/host_device_config.cpp
+++ b/common/libs/device_config/host_device_config.cpp
@@ -23,7 +23,7 @@
#include "device_config.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -191,4 +191,4 @@
data_.screen.refresh_rate = config.refresh_rate_hz();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/fs/shared_buf.cc b/common/libs/fs/shared_buf.cc
index 5ae1aa2..34a5e81 100644
--- a/common/libs/fs/shared_buf.cc
+++ b/common/libs/fs/shared_buf.cc
@@ -28,7 +28,7 @@
} // namespace
-namespace cvd {
+namespace cuttlefish {
ssize_t WriteAll(SharedFD fd, const char* buf, size_t size) {
size_t total_written = 0;
@@ -94,4 +94,4 @@
return WriteAll(fd, buf.data(), buf.size());
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/fs/shared_buf.h b/common/libs/fs/shared_buf.h
index f8f86b7..c61222f 100644
--- a/common/libs/fs/shared_buf.h
+++ b/common/libs/fs/shared_buf.h
@@ -20,7 +20,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
/**
* Reads from fd until it is closed or errors, storing all data in buf.
@@ -118,4 +118,4 @@
return WriteAll(fd, (const char*) binary_data, sizeof(*binary_data));
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/fs/shared_fd.cpp b/common/libs/fs/shared_fd.cpp
index 0386dd9..8b5b1d4 100644
--- a/common/libs/fs/shared_fd.cpp
+++ b/common/libs/fs/shared_fd.cpp
@@ -33,7 +33,7 @@
// #define ENABLE_GCE_SHARED_FD_LOGGING 1
namespace {
-using cvd::SharedFDSet;
+using cuttlefish::SharedFDSet;
void MarkAll(const SharedFDSet& input, fd_set* dest, int* max_index) {
for (SharedFDSet::const_iterator it = input.begin(); it != input.end();
@@ -84,7 +84,7 @@
} // namespace
-namespace cvd {
+namespace cuttlefish {
bool FileInstance::CopyFrom(FileInstance& in, size_t length) {
std::vector<char> buffer(8192);
@@ -383,7 +383,7 @@
}
SharedFD SharedFD::VsockServer(unsigned int port, int type) {
- auto vsock = cvd::SharedFD::Socket(AF_VSOCK, type, 0);
+ auto vsock = cuttlefish::SharedFD::Socket(AF_VSOCK, type, 0);
if (!vsock->IsOpen()) {
return vsock;
}
@@ -410,7 +410,7 @@
}
SharedFD SharedFD::VsockClient(unsigned int cid, unsigned int port, int type) {
- auto vsock = cvd::SharedFD::Socket(AF_VSOCK, type, 0);
+ auto vsock = cuttlefish::SharedFD::Socket(AF_VSOCK, type, 0);
if (!vsock->IsOpen()) {
return vsock;
}
@@ -425,4 +425,4 @@
return vsock;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/fs/shared_fd.h b/common/libs/fs/shared_fd.h
index 7bcac6a..e058cfa 100644
--- a/common/libs/fs/shared_fd.h
+++ b/common/libs/fs/shared_fd.h
@@ -61,7 +61,7 @@
* it makes it easier to convert existing code to SharedFDs and avoids the
* possibility that new POSIX functionality will lead to large refactorings.
*/
-namespace cvd {
+namespace cuttlefish {
class FileInstance;
@@ -151,9 +151,9 @@
std::shared_ptr<FileInstance> operator->() const { return value_; }
- const cvd::FileInstance& operator*() const { return *value_; }
+ const cuttlefish::FileInstance& operator*() const { return *value_; }
- cvd::FileInstance& operator*() { return *value_; }
+ cuttlefish::FileInstance& operator*() { return *value_; }
private:
static SharedFD ErrorFD(int error);
@@ -405,6 +405,6 @@
inline SharedFD::SharedFD() : value_(FileInstance::ClosedInstance()) {}
-} // namespace cvd
+} // namespace cuttlefish
#endif // CUTTLEFISH_COMMON_COMMON_LIBS_FS_SHARED_FD_H_
diff --git a/common/libs/fs/shared_fd_test.cpp b/common/libs/fs/shared_fd_test.cpp
index 7ca6204..db62b45 100644
--- a/common/libs/fs/shared_fd_test.cpp
+++ b/common/libs/fs/shared_fd_test.cpp
@@ -23,7 +23,7 @@
#include <string>
-using cvd::SharedFD;
+using cuttlefish::SharedFD;
char pipe_message[] = "Testing the pipe";
diff --git a/common/libs/fs/shared_select.h b/common/libs/fs/shared_select.h
index d103f1d..9e0e0ab 100644
--- a/common/libs/fs/shared_select.h
+++ b/common/libs/fs/shared_select.h
@@ -20,7 +20,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
/**
* The SharedFD version of fdset for the Select call.
*
@@ -76,6 +76,6 @@
int Select(SharedFDSet* read_set, SharedFDSet* write_set,
SharedFDSet* error_set, struct timeval* timeout);
-} // namespace cvd
+} // namespace cuttlefish
#endif // CUTTLEFISH_COMMON_COMMON_LIBS_FS_SHARED_SELECT_H_
diff --git a/common/libs/net/netlink_client.cpp b/common/libs/net/netlink_client.cpp
index 624b1a7..7b2404f 100644
--- a/common/libs/net/netlink_client.cpp
+++ b/common/libs/net/netlink_client.cpp
@@ -24,7 +24,7 @@
#include "common/libs/fs/shared_fd.h"
#include "android-base/logging.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
// NetlinkClient implementation.
// Talks to libnetlink to apply network changes.
@@ -165,4 +165,4 @@
return &factory;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/net/netlink_client.h b/common/libs/net/netlink_client.h
index c8805c5..25ff7f4 100644
--- a/common/libs/net/netlink_client.h
+++ b/common/libs/net/netlink_client.h
@@ -21,7 +21,7 @@
#include <string>
#include "common/libs/net/netlink_request.h"
-namespace cvd {
+namespace cuttlefish {
// Abstraction of Netlink client class.
class NetlinkClient {
@@ -50,6 +50,6 @@
virtual ~NetlinkClientFactory() = default;
};
-} // namespace cvd
+} // namespace cuttlefish
#endif // COMMON_LIBS_NET_NETLINK_CLIENT_H_
diff --git a/common/libs/net/netlink_request.cpp b/common/libs/net/netlink_request.cpp
index bc7c1cf..3900e8a 100644
--- a/common/libs/net/netlink_request.cpp
+++ b/common/libs/net/netlink_request.cpp
@@ -26,7 +26,7 @@
#include "android-base/logging.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
uint32_t kRequestSequenceNumber = 0;
} // namespace
@@ -126,4 +126,4 @@
return request_.size();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/net/netlink_request.h b/common/libs/net/netlink_request.h
index 541c04b..eee231c 100644
--- a/common/libs/net/netlink_request.h
+++ b/common/libs/net/netlink_request.h
@@ -24,7 +24,7 @@
#include <string>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
// Abstraction of Network link request.
// Used to supply kernel with information about which interface needs to be
// changed, and how.
@@ -108,5 +108,5 @@
NetlinkRequest(const NetlinkRequest&) = delete;
NetlinkRequest& operator= (const NetlinkRequest&) = delete;
};
-} // namespace cvd
+} // namespace cuttlefish
#endif // COMMON_LIBS_NET_NETLINK_REQUEST_H_
diff --git a/common/libs/net/netlink_request_test.cpp b/common/libs/net/netlink_request_test.cpp
index 2410b02..d3b2dbd 100644
--- a/common/libs/net/netlink_request_test.cpp
+++ b/common/libs/net/netlink_request_test.cpp
@@ -28,7 +28,7 @@
using ::testing::MatchResultListener;
using ::testing::Return;
-namespace cvd {
+namespace cuttlefish {
namespace {
extern "C" void klog_write(int /* level */, const char* /* format */, ...) {}
@@ -130,7 +130,7 @@
memcpy(&expected.text, kLongString, sizeof(kLongString));
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.AddString(kDummyTag, kLongString);
EXPECT_THAT(request, RequestDataIs(&expected, sizeof(expected)));
}
@@ -146,7 +146,7 @@
const uint32_t attr_value = kValue;
} expected;
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.AddInt(kDummyTag, kValue);
EXPECT_THAT(request, RequestDataIs(&expected, sizeof(expected)));
}
@@ -188,7 +188,7 @@
uint8_t attr_padding_u8[3] = {0, 0, 0};
} expected = {};
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.AddInt<int64_t>(kDummyTag, kValue);
request.AddInt<int32_t>(kDummyTag + 1, kValue);
request.AddInt<int16_t>(kDummyTag + 2, kValue);
@@ -215,7 +215,7 @@
const uint32_t attr_value = kValue;
} expected;
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.PushList(kListTag);
request.AddInt(kDummyTag, kValue);
request.PopList();
@@ -240,7 +240,7 @@
const uint32_t attr_value = kValue;
} expected;
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.PushList(kList1Tag);
request.PushList(kList2Tag);
request.AddInt(kDummyTag, kValue);
@@ -272,7 +272,7 @@
const uint32_t attr2_value = kValue2;
} expected;
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.PushList(kList1Tag);
request.AddInt(kDummy1Tag, kValue1);
request.PopList();
@@ -305,7 +305,7 @@
const uint32_t attr2_value = kValue2;
} expected;
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
request.PushList(kList1Tag);
request.PushList(kList2Tag);
request.AddInt(kDummy1Tag, kValue1);
@@ -317,7 +317,7 @@
}
TEST(NetlinkClientTest, SimpleNetlinkCreateHeader) {
- cvd::NetlinkRequest request(RTM_NEWLINK, NLM_F_CREATE | NLM_F_EXCL);
+ cuttlefish::NetlinkRequest request(RTM_NEWLINK, NLM_F_CREATE | NLM_F_EXCL);
constexpr char kValue[] = "random string";
request.AddString(0, kValue); // Have something to work with.
@@ -331,7 +331,7 @@
NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL | NLM_F_REQUEST,
base_seq));
- cvd::NetlinkRequest request2(RTM_NEWLINK, NLM_F_CREATE | NLM_F_EXCL);
+ cuttlefish::NetlinkRequest request2(RTM_NEWLINK, NLM_F_CREATE | NLM_F_EXCL);
request2.AddString(0, kValue); // Have something to work with.
EXPECT_THAT(request2, RequestHeaderIs(
kMsgLength,
@@ -341,7 +341,7 @@
}
TEST(NetlinkClientTest, SimpleNetlinkUpdateHeader) {
- cvd::NetlinkRequest request(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request(RTM_SETLINK, 0);
constexpr char kValue[] = "random string";
request.AddString(0, kValue); // Have something to work with.
@@ -352,10 +352,10 @@
EXPECT_THAT(request, RequestHeaderIs(
kMsgLength, RTM_SETLINK, NLM_F_REQUEST | NLM_F_ACK, base_seq));
- cvd::NetlinkRequest request2(RTM_SETLINK, 0);
+ cuttlefish::NetlinkRequest request2(RTM_SETLINK, 0);
request2.AddString(0, kValue); // Have something to work with.
EXPECT_THAT(request2, RequestHeaderIs(
kMsgLength, RTM_SETLINK, NLM_F_REQUEST | NLM_F_ACK, base_seq + 1));
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/net/network_interface.h b/common/libs/net/network_interface.h
index 2f4430d..323db53 100644
--- a/common/libs/net/network_interface.h
+++ b/common/libs/net/network_interface.h
@@ -18,7 +18,7 @@
#include <string>
-namespace cvd {
+namespace cuttlefish {
// Abstraction of network interfaces.
// This interface provides means to modify network interface parameters.
@@ -111,6 +111,6 @@
NetworkInterface& operator= (const NetworkInterface&);
};
-} // namespace cvd
+} // namespace cuttlefish
#endif // GUEST_GCE_NETWORK_NETWORK_INTERFACE_H_
diff --git a/common/libs/net/network_interface_manager.cpp b/common/libs/net/network_interface_manager.cpp
index b61ba33..19371e6 100644
--- a/common/libs/net/network_interface_manager.cpp
+++ b/common/libs/net/network_interface_manager.cpp
@@ -27,7 +27,7 @@
#include "android-base/logging.h"
#include "common/libs/net/network_interface.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
NetlinkRequest BuildLinkRequest(
const NetworkInterface& interface) {
@@ -104,4 +104,4 @@
return nl_client_->Send(BuildAddrRequest(iface));
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/net/network_interface_manager.h b/common/libs/net/network_interface_manager.h
index f28b0ff..4ade909 100644
--- a/common/libs/net/network_interface_manager.h
+++ b/common/libs/net/network_interface_manager.h
@@ -22,7 +22,7 @@
#include "common/libs/net/netlink_client.h"
#include "common/libs/net/network_interface.h"
-namespace cvd {
+namespace cuttlefish {
// Network interface manager class.
// - Provides access for existing network interfaces,
@@ -67,6 +67,6 @@
NetworkInterfaceManager& operator= (const NetworkInterfaceManager&);
};
-} // namespace cvd
+} // namespace cuttlefish
#endif // COMMON_LIBS_NET_NETWORK_INTERFACE_MANAGER_H_
diff --git a/common/libs/security/keymaster_channel.cpp b/common/libs/security/keymaster_channel.cpp
index 34c7da6..be7253e 100644
--- a/common/libs/security/keymaster_channel.cpp
+++ b/common/libs/security/keymaster_channel.cpp
@@ -21,7 +21,7 @@
#include "common/libs/fs/shared_buf.h"
-namespace cvd {
+namespace cuttlefish {
ManagedKeymasterMessage CreateKeymasterMessage(
AndroidKeymasterCommand command, bool is_response, size_t payload_size) {
@@ -63,7 +63,7 @@
message.Serialize(to_send->payload, to_send->payload + payload_size);
auto write_size = payload_size + sizeof(keymaster_message);
auto to_send_bytes = reinterpret_cast<const char*>(to_send.get());
- auto written = cvd::WriteAll(channel_, to_send_bytes, write_size);
+ auto written = cuttlefish::WriteAll(channel_, to_send_bytes, write_size);
if (written == -1) {
LOG(ERROR) << "Could not write Keymaster Message: " << channel_->StrError();
}
@@ -72,7 +72,7 @@
ManagedKeymasterMessage KeymasterChannel::ReceiveMessage() {
struct keymaster_message message_header;
- auto read = cvd::ReadExactBinary(channel_, &message_header);
+ auto read = cuttlefish::ReadExactBinary(channel_, &message_header);
if (read != sizeof(keymaster_message)) {
LOG(ERROR) << "Expected " << sizeof(keymaster_message) << ", received "
<< read;
@@ -84,7 +84,7 @@
message_header.is_response,
message_header.payload_size);
auto message_bytes = reinterpret_cast<char*>(message->payload);
- read = cvd::ReadExact(channel_, message_bytes, message->payload_size);
+ read = cuttlefish::ReadExact(channel_, message_bytes, message->payload_size);
if (read != message->payload_size) {
LOG(ERROR) << "Could not read Keymaster Message: " << channel_->StrError();
return {};
diff --git a/common/libs/security/keymaster_channel.h b/common/libs/security/keymaster_channel.h
index 529325a..8051689 100644
--- a/common/libs/security/keymaster_channel.h
+++ b/common/libs/security/keymaster_channel.h
@@ -39,7 +39,7 @@
} // namespace keymaster
-namespace cvd {
+namespace cuttlefish {
using keymaster::AndroidKeymasterCommand;
using keymaster::keymaster_message;
@@ -83,4 +83,4 @@
ManagedKeymasterMessage ReceiveMessage();
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/tcp_socket/tcp_socket.cpp b/common/libs/tcp_socket/tcp_socket.cpp
index 2775c29..05f47e9 100644
--- a/common/libs/tcp_socket/tcp_socket.cpp
+++ b/common/libs/tcp_socket/tcp_socket.cpp
@@ -24,13 +24,13 @@
#include <android-base/logging.h>
-using cvd::ClientSocket;
-using cvd::ServerSocket;
+using cuttlefish::ClientSocket;
+using cuttlefish::ServerSocket;
ClientSocket::ClientSocket(int port)
: fd_(SharedFD::SocketLocalClient(port, SOCK_STREAM)) {}
-cvd::Message ClientSocket::RecvAny(std::size_t length) {
+cuttlefish::Message ClientSocket::RecvAny(std::size_t length) {
Message buf(length);
auto read_count = fd_->Read(buf.data(), buf.size());
if (read_count < 0) {
@@ -45,7 +45,7 @@
return other_side_closed_;
}
-cvd::Message ClientSocket::Recv(std::size_t length) {
+cuttlefish::Message ClientSocket::Recv(std::size_t length) {
Message buf(length);
ssize_t total_read = 0;
while (total_read < static_cast<ssize_t>(length)) {
@@ -106,28 +106,28 @@
return ClientSocket{client};
}
-void cvd::AppendInNetworkByteOrder(Message* msg, const std::uint8_t b) {
+void cuttlefish::AppendInNetworkByteOrder(Message* msg, const std::uint8_t b) {
msg->push_back(b);
}
-void cvd::AppendInNetworkByteOrder(Message* msg, const std::uint16_t s) {
+void cuttlefish::AppendInNetworkByteOrder(Message* msg, const std::uint16_t s) {
const std::uint16_t n = htons(s);
auto p = reinterpret_cast<const std::uint8_t*>(&n);
msg->insert(msg->end(), p, p + sizeof n);
}
-void cvd::AppendInNetworkByteOrder(Message* msg, const std::uint32_t w) {
+void cuttlefish::AppendInNetworkByteOrder(Message* msg, const std::uint32_t w) {
const std::uint32_t n = htonl(w);
auto p = reinterpret_cast<const std::uint8_t*>(&n);
msg->insert(msg->end(), p, p + sizeof n);
}
-void cvd::AppendInNetworkByteOrder(Message* msg, const std::int32_t w) {
+void cuttlefish::AppendInNetworkByteOrder(Message* msg, const std::int32_t w) {
std::uint32_t u{};
std::memcpy(&u, &w, sizeof u);
AppendInNetworkByteOrder(msg, u);
}
-void cvd::AppendInNetworkByteOrder(Message* msg, const std::string& str) {
+void cuttlefish::AppendInNetworkByteOrder(Message* msg, const std::string& str) {
msg->insert(msg->end(), str.begin(), str.end());
}
diff --git a/common/libs/tcp_socket/tcp_socket.h b/common/libs/tcp_socket/tcp_socket.h
index e484f48..39058f2 100644
--- a/common/libs/tcp_socket/tcp_socket.h
+++ b/common/libs/tcp_socket/tcp_socket.h
@@ -25,7 +25,7 @@
#include <mutex>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
using Message = std::vector<std::uint8_t>;
class ServerSocket;
@@ -63,9 +63,9 @@
private:
friend ServerSocket;
- explicit ClientSocket(cvd::SharedFD fd) : fd_(fd) {}
+ explicit ClientSocket(cuttlefish::SharedFD fd) : fd_(fd) {}
- cvd::SharedFD fd_;
+ cuttlefish::SharedFD fd_;
bool other_side_closed_{};
mutable std::mutex closed_lock_;
std::mutex send_lock_;
@@ -81,7 +81,7 @@
ClientSocket Accept();
private:
- cvd::SharedFD fd_;
+ cuttlefish::SharedFD fd_;
};
void AppendInNetworkByteOrder(Message* msg, const std::uint8_t b);
@@ -105,4 +105,4 @@
return m;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/thread_safe_queue/thread_safe_queue.h b/common/libs/thread_safe_queue/thread_safe_queue.h
index 9970d31..f2148b5 100644
--- a/common/libs/thread_safe_queue/thread_safe_queue.h
+++ b/common/libs/thread_safe_queue/thread_safe_queue.h
@@ -22,7 +22,7 @@
#include <utility>
#include <iterator>
-namespace cvd {
+namespace cuttlefish {
// Simple queue with Push and Pop capabilities.
// If the max_elements argument is passed to the constructor, and Push is called
// when the queue holds max_elements items, the max_elements_handler is called
@@ -85,4 +85,4 @@
std::condition_variable new_item_;
QueueImpl items_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/time/monotonic_time.cpp b/common/libs/time/monotonic_time.cpp
index 1d7bbd8..7a86721 100644
--- a/common/libs/time/monotonic_time.cpp
+++ b/common/libs/time/monotonic_time.cpp
@@ -15,7 +15,7 @@
*/
#include "common/libs/time/monotonic_time.h"
-namespace cvd {
+namespace cuttlefish {
namespace time {
MonotonicTimePointFactory* MonotonicTimePointFactory::GetInstance() {
static MonotonicTimePointFactory factory;
@@ -23,4 +23,4 @@
return &factory;
}
} // namespace time
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/time/monotonic_time.h b/common/libs/time/monotonic_time.h
index 8f5de13..56ae3c5 100644
--- a/common/libs/time/monotonic_time.h
+++ b/common/libs/time/monotonic_time.h
@@ -18,7 +18,7 @@
#include <stdint.h>
#include <time.h>
-namespace cvd {
+namespace cuttlefish {
namespace time {
static const int64_t kNanosecondsPerSecond = 1000000000;
@@ -279,7 +279,7 @@
};
} // namespace time
-} // namespace cvd
+} // namespace cuttlefish
/**
* Legacy support for microseconds. Use MonotonicTimePoint in new code.
@@ -287,6 +287,6 @@
static const int64_t kSecsToUsecs = static_cast<int64_t>(1000) * 1000;
static inline int64_t get_monotonic_usecs() {
- return cvd::time::Microseconds(
- cvd::time::MonotonicTimePoint::Now().SinceEpoch()).count();
+ return cuttlefish::time::Microseconds(
+ cuttlefish::time::MonotonicTimePoint::Now().SinceEpoch()).count();
}
diff --git a/common/libs/time/monotonic_time_test.cpp b/common/libs/time/monotonic_time_test.cpp
index b1c07c9..888deaa 100644
--- a/common/libs/time/monotonic_time_test.cpp
+++ b/common/libs/time/monotonic_time_test.cpp
@@ -18,7 +18,7 @@
#include <gtest/gtest.h>
#include <algorithm>
-using cvd::time::TimeDifference;
+using cuttlefish::time::TimeDifference;
class MonotonicTimeTest : public ::testing::Test {
public:
diff --git a/common/libs/utils/archive.cpp b/common/libs/utils/archive.cpp
index 10ca95a..8d68b91 100644
--- a/common/libs/utils/archive.cpp
+++ b/common/libs/utils/archive.cpp
@@ -24,7 +24,7 @@
#include "common/libs/utils/subprocess.h"
-namespace cvd {
+namespace cuttlefish {
Archive::Archive(const std::string& file) : file(file) {
}
@@ -33,11 +33,11 @@
}
std::vector<std::string> Archive::Contents() {
- cvd::Command bsdtar_cmd("/usr/bin/bsdtar");
+ cuttlefish::Command bsdtar_cmd("/usr/bin/bsdtar");
bsdtar_cmd.AddParameter("-tf");
bsdtar_cmd.AddParameter(file);
std::string bsdtar_input, bsdtar_output;
- auto bsdtar_ret = cvd::RunWithManagedStdio(std::move(bsdtar_cmd), &bsdtar_input,
+ auto bsdtar_ret = cuttlefish::RunWithManagedStdio(std::move(bsdtar_cmd), &bsdtar_input,
&bsdtar_output, nullptr);
if (bsdtar_ret != 0) {
LOG(ERROR) << "`bsdtar -tf \"" << file << "\"` returned " << bsdtar_ret;
@@ -53,7 +53,7 @@
bool Archive::ExtractFiles(const std::vector<std::string>& to_extract,
const std::string& target_directory) {
- cvd::Command bsdtar_cmd("/usr/bin/bsdtar");
+ cuttlefish::Command bsdtar_cmd("/usr/bin/bsdtar");
bsdtar_cmd.AddParameter("-x");
bsdtar_cmd.AddParameter("-v");
bsdtar_cmd.AddParameter("-C");
@@ -64,8 +64,8 @@
for (const auto& extract : to_extract) {
bsdtar_cmd.AddParameter(extract);
}
- bsdtar_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut,
- cvd::Subprocess::StdIOChannel::kStdErr);
+ bsdtar_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut,
+ cuttlefish::Subprocess::StdIOChannel::kStdErr);
auto bsdtar_ret = bsdtar_cmd.Start().Wait();
if (bsdtar_ret != 0) {
LOG(ERROR) << "bsdtar extraction on \"" << file << "\" returned " << bsdtar_ret;
@@ -74,7 +74,7 @@
}
std::string Archive::ExtractToMemory(const std::string& path) {
- cvd::Command bsdtar_cmd("/usr/bin/bsdtar");
+ cuttlefish::Command bsdtar_cmd("/usr/bin/bsdtar");
bsdtar_cmd.AddParameter("-xf");
bsdtar_cmd.AddParameter(file);
bsdtar_cmd.AddParameter("-O");
@@ -90,4 +90,4 @@
return stdout;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/archive.h b/common/libs/utils/archive.h
index 7563ca0..ea548f2 100644
--- a/common/libs/utils/archive.h
+++ b/common/libs/utils/archive.h
@@ -18,7 +18,7 @@
#include <string>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
// Operations on archive files
class Archive {
@@ -34,4 +34,4 @@
std::string ExtractToMemory(const std::string& path);
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/base64.cpp b/common/libs/utils/base64.cpp
index cd4fbb7..1aa09ce 100644
--- a/common/libs/utils/base64.cpp
+++ b/common/libs/utils/base64.cpp
@@ -18,7 +18,7 @@
#include <openssl/base64.h>
-namespace cvd {
+namespace cuttlefish {
bool EncodeBase64(const void *data, size_t size, std::string *out) {
size_t enc_len = 0;
@@ -48,4 +48,4 @@
data.size());
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/base64.h b/common/libs/utils/base64.h
index 15ad268..dd262c3 100644
--- a/common/libs/utils/base64.h
+++ b/common/libs/utils/base64.h
@@ -20,10 +20,10 @@
#include <string>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
bool EncodeBase64(const void* _data, size_t size, std::string* out);
bool DecodeBase64(const std::string& data, std::vector<uint8_t>* buffer);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/environment.cpp b/common/libs/utils/environment.cpp
index e6cacd0..699dfe3 100644
--- a/common/libs/utils/environment.cpp
+++ b/common/libs/utils/environment.cpp
@@ -20,7 +20,7 @@
#include <stdio.h>
#include <iostream>
-namespace cvd {
+namespace cuttlefish {
std::string StringFromEnv(const std::string& varname,
const std::string& defval) {
@@ -82,4 +82,4 @@
return arch;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/environment.h b/common/libs/utils/environment.h
index 5a83b49..c709d07 100644
--- a/common/libs/utils/environment.h
+++ b/common/libs/utils/environment.h
@@ -17,11 +17,11 @@
#include <string>
-namespace cvd {
+namespace cuttlefish {
std::string StringFromEnv(const std::string& varname,
const std::string& defval);
std::string HostArch();
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/files.cpp b/common/libs/utils/files.cpp
index 4900562..66286e3 100644
--- a/common/libs/utils/files.cpp
+++ b/common/libs/utils/files.cpp
@@ -30,7 +30,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
bool FileExists(const std::string& path) {
struct stat st;
@@ -189,4 +189,4 @@
return (FileSizes) { .sparse_size = farthest_seek, .disk_size = data_bytes };
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/files.h b/common/libs/utils/files.h
index 0541344..46fdc71 100644
--- a/common/libs/utils/files.h
+++ b/common/libs/utils/files.h
@@ -20,7 +20,7 @@
#include <chrono>
#include <string>
-namespace cvd {
+namespace cuttlefish {
bool FileExists(const std::string& path);
bool FileHasContent(const std::string& path);
bool DirectoryExists(const std::string& path);
@@ -43,4 +43,4 @@
off_t disk_size;
};
FileSizes SparseFileSizes(const std::string& path);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/network.cpp b/common/libs/utils/network.cpp
index 33a1ea9..68ec69e 100644
--- a/common/libs/utils/network.cpp
+++ b/common/libs/utils/network.cpp
@@ -33,12 +33,12 @@
#include "common/libs/utils/environment.h"
#include "common/libs/utils/subprocess.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
static std::string DefaultHostArtifactsPath(const std::string& file_name) {
- return (cvd::StringFromEnv("ANDROID_HOST_OUT",
- cvd::StringFromEnv("HOME", ".")) +
+ return (cuttlefish::StringFromEnv("ANDROID_HOST_OUT",
+ cuttlefish::StringFromEnv("HOME", ".")) +
"/") +
file_name;
}
@@ -97,16 +97,16 @@
return tap_fd;
}
- if (cvd::HostArch() == "aarch64") {
+ if (cuttlefish::HostArch() == "aarch64") {
auto tapsetiff_path = DefaultHostArtifactsPath("bin/tapsetiff");
- cvd::Command cmd(tapsetiff_path);
+ cuttlefish::Command cmd(tapsetiff_path);
cmd.AddParameter(tap_fd);
cmd.AddParameter(interface_name.c_str());
int ret = cmd.Start().Wait();
if (ret != 0) {
LOG(ERROR) << "Unable to run tapsetiff.py. Exited with status " << ret;
tap_fd->Close();
- return cvd::SharedFD();
+ return cuttlefish::SharedFD();
}
} else {
struct ifreq ifr;
@@ -119,7 +119,7 @@
LOG(ERROR) << "Unable to connect to " << interface_name
<< " tap interface: " << tap_fd->StrError();
tap_fd->Close();
- return cvd::SharedFD();
+ return cuttlefish::SharedFD();
}
// The interface's configuration may have been modified or just not set
@@ -311,4 +311,4 @@
return true;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/network.h b/common/libs/utils/network.h
index 0fae86a..64b562e 100644
--- a/common/libs/utils/network.h
+++ b/common/libs/utils/network.h
@@ -22,7 +22,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
// Creates, or connects to if it already exists, a tap network interface. The
// user needs CAP_NET_ADMIN to create such interfaces or be the owner to connect
// to one.
diff --git a/common/libs/utils/size_utils.cpp b/common/libs/utils/size_utils.cpp
index 0f7ed3c..a04cb6e 100644
--- a/common/libs/utils/size_utils.cpp
+++ b/common/libs/utils/size_utils.cpp
@@ -18,11 +18,11 @@
#include <unistd.h>
-namespace cvd {
+namespace cuttlefish {
uint32_t AlignToPowerOf2(uint32_t val, uint8_t align_log) {
uint32_t align = 1 << align_log;
return ((val + (align - 1)) / align) * align;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/size_utils.h b/common/libs/utils/size_utils.h
index 42044ec..0e39050 100644
--- a/common/libs/utils/size_utils.h
+++ b/common/libs/utils/size_utils.h
@@ -17,9 +17,9 @@
#include <stdint.h>
-namespace cvd {
+namespace cuttlefish {
// Returns the smallest multiple of 2^align_log greater than or equal to val.
uint32_t AlignToPowerOf2(uint32_t val, uint8_t align_log);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/subprocess.cpp b/common/libs/utils/subprocess.cpp
index bedbd14..54b0ef3 100644
--- a/common/libs/utils/subprocess.cpp
+++ b/common/libs/utils/subprocess.cpp
@@ -38,8 +38,8 @@
// some inherited file descriptor duped to this file descriptor and the redirect
// would override that. This function makes sure that doesn't happen.
bool validate_redirects(
- const std::map<cvd::Subprocess::StdIOChannel, int>& redirects,
- const std::map<cvd::SharedFD, int>& inherited_fds) {
+ const std::map<cuttlefish::Subprocess::StdIOChannel, int>& redirects,
+ const std::map<cuttlefish::SharedFD, int>& inherited_fds) {
// Add the redirected IO channels to a set as integers. This allows converting
// the enum values into integers instead of the other way around.
std::set<int> int_redirects;
@@ -58,7 +58,7 @@
}
void do_redirects(
- const std::map<cvd::Subprocess::StdIOChannel, int>& redirects) {
+ const std::map<cuttlefish::Subprocess::StdIOChannel, int>& redirects) {
for (const auto& entry : redirects) {
auto std_channel = static_cast<int>(entry.first);
auto fd = entry.second;
@@ -75,7 +75,7 @@
return ret;
}
} // namespace
-namespace cvd {
+namespace cuttlefish {
Subprocess::Subprocess(Subprocess&& subprocess)
: pid_(subprocess.pid_),
@@ -198,8 +198,8 @@
return true;
}
-bool Command::RedirectStdIO(cvd::Subprocess::StdIOChannel channel,
- cvd::SharedFD shared_fd) {
+bool Command::RedirectStdIO(cuttlefish::Subprocess::StdIOChannel channel,
+ cuttlefish::SharedFD shared_fd) {
if (!shared_fd->IsOpen()) {
return false;
}
@@ -219,7 +219,7 @@
bool Command::RedirectStdIO(Subprocess::StdIOChannel subprocess_channel,
Subprocess::StdIOChannel parent_channel) {
return RedirectStdIO(subprocess_channel,
- cvd::SharedFD::Dup(static_cast<int>(parent_channel)));
+ cuttlefish::SharedFD::Dup(static_cast<int>(parent_channel)));
}
Subprocess Command::Start(SubprocessOptions options) const {
@@ -315,7 +315,7 @@
SubprocessOptions options) {
/*
* The order of these declarations is necessary for safety. If the function
- * returns at any point, the cvd::Command will be destroyed first, closing all
+ * returns at any point, the cuttlefish::Command will be destroyed first, closing all
* of its references to SharedFDs. This will cause the thread internals to fail
* their reads or writes. The ThreadJoiner then waits for the threads to
* complete, as running the destructor of an active std::thread crashes the
@@ -326,22 +326,22 @@
*/
std::thread stdin_thread, stdout_thread, stderr_thread;
ThreadJoiner thread_joiner({&stdin_thread, &stdout_thread, &stderr_thread});
- cvd::Command cmd = std::move(cmd_tmp);
+ cuttlefish::Command cmd = std::move(cmd_tmp);
bool io_error = false;
if (stdin != nullptr) {
- cvd::SharedFD pipe_read, pipe_write;
- if (!cvd::SharedFD::Pipe(&pipe_read, &pipe_write)) {
+ cuttlefish::SharedFD pipe_read, pipe_write;
+ if (!cuttlefish::SharedFD::Pipe(&pipe_read, &pipe_write)) {
LOG(ERROR) << "Could not create a pipe to write the stdin of \""
<< cmd.GetShortName() << "\"";
return -1;
}
- if (!cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdIn, pipe_read)) {
+ if (!cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdIn, pipe_read)) {
LOG(ERROR) << "Could not set stdout of \"" << cmd.GetShortName()
<< "\", was already set.";
return -1;
}
stdin_thread = std::thread([pipe_write, stdin, &io_error]() {
- int written = cvd::WriteAll(pipe_write, *stdin);
+ int written = cuttlefish::WriteAll(pipe_write, *stdin);
if (written < 0) {
io_error = true;
LOG(ERROR) << "Error in writing stdin to process";
@@ -349,19 +349,19 @@
});
}
if (stdout != nullptr) {
- cvd::SharedFD pipe_read, pipe_write;
- if (!cvd::SharedFD::Pipe(&pipe_read, &pipe_write)) {
+ cuttlefish::SharedFD pipe_read, pipe_write;
+ if (!cuttlefish::SharedFD::Pipe(&pipe_read, &pipe_write)) {
LOG(ERROR) << "Could not create a pipe to read the stdout of \""
<< cmd.GetShortName() << "\"";
return -1;
}
- if (!cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut, pipe_write)) {
+ if (!cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut, pipe_write)) {
LOG(ERROR) << "Could not set stdout of \"" << cmd.GetShortName()
<< "\", was already set.";
return -1;
}
stdout_thread = std::thread([pipe_read, stdout, &io_error]() {
- int read = cvd::ReadAll(pipe_read, stdout);
+ int read = cuttlefish::ReadAll(pipe_read, stdout);
if (read < 0) {
io_error = true;
LOG(ERROR) << "Error in reading stdout from process";
@@ -369,19 +369,19 @@
});
}
if (stderr != nullptr) {
- cvd::SharedFD pipe_read, pipe_write;
- if (!cvd::SharedFD::Pipe(&pipe_read, &pipe_write)) {
+ cuttlefish::SharedFD pipe_read, pipe_write;
+ if (!cuttlefish::SharedFD::Pipe(&pipe_read, &pipe_write)) {
LOG(ERROR) << "Could not create a pipe to read the stderr of \""
<< cmd.GetShortName() << "\"";
return -1;
}
- if (!cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdErr, pipe_write)) {
+ if (!cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdErr, pipe_write)) {
LOG(ERROR) << "Could not set stderr of \"" << cmd.GetShortName()
<< "\", was already set.";
return -1;
}
stderr_thread = std::thread([pipe_read, stderr, &io_error]() {
- int read = cvd::ReadAll(pipe_read, stderr);
+ int read = cuttlefish::ReadAll(pipe_read, stderr);
if (read < 0) {
io_error = true;
LOG(ERROR) << "Error in reading stderr from process";
@@ -397,7 +397,7 @@
{
// Force the destructor to run by moving it into a smaller scope.
// This is necessary to close the write end of the pipe.
- cvd::Command forceDelete = std::move(cmd);
+ cuttlefish::Command forceDelete = std::move(cmd);
}
int wstatus;
subprocess.Wait(&wstatus, 0);
@@ -440,4 +440,4 @@
return subprocess.Wait();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/subprocess.h b/common/libs/utils/subprocess.h
index 633c9f5..3a79c52 100644
--- a/common/libs/utils/subprocess.h
+++ b/common/libs/utils/subprocess.h
@@ -25,7 +25,7 @@
#include <common/libs/fs/shared_fd.h>
-namespace cvd {
+namespace cuttlefish {
class Command;
class Subprocess;
class SubprocessOptions;
@@ -143,7 +143,7 @@
void Build();
private:
- cvd::Command* cmd_;
+ cuttlefish::Command* cmd_;
std::stringstream stream_;
};
@@ -187,7 +187,7 @@
ParameterBuilder GetParameterBuilder() { return ParameterBuilder(this); }
// Redirects the standard IO of the command.
- bool RedirectStdIO(Subprocess::StdIOChannel channel, cvd::SharedFD shared_fd);
+ bool RedirectStdIO(Subprocess::StdIOChannel channel, cuttlefish::SharedFD shared_fd);
bool RedirectStdIO(Subprocess::StdIOChannel subprocess_channel,
Subprocess::StdIOChannel parent_channel);
@@ -203,7 +203,7 @@
private:
std::vector<std::string> command_;
- std::map<cvd::SharedFD, int> inherited_fds_{};
+ std::map<cuttlefish::SharedFD, int> inherited_fds_{};
std::map<Subprocess::StdIOChannel, int> redirects_{};
bool use_parent_env_ = true;
std::vector<std::string> env_{};
@@ -211,7 +211,7 @@
};
/*
- * Consumes a cvd::Command and runs it, optionally managing the stdio channels.
+ * Consumes a cuttlefish::Command and runs it, optionally managing the stdio channels.
*
* If `stdin` is set, the subprocess stdin will be pipe providing its contents.
* If `stdout` is set, the subprocess stdout will be captured and saved to it.
@@ -222,7 +222,7 @@
* If some setup fails, `command` fails to start, or `command` exits due to a
* signal, the return value will be negative.
*/
-int RunWithManagedStdio(cvd::Command&& command, const std::string* stdin,
+int RunWithManagedStdio(cuttlefish::Command&& command, const std::string* stdin,
std::string* stdout, std::string* stderr,
SubprocessOptions options = SubprocessOptions());
@@ -234,4 +234,4 @@
const std::vector<std::string>& env);
int execute(const std::vector<std::string>& command);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/tee_logging.cpp b/common/libs/utils/tee_logging.cpp
index 650a813..5935cf5 100644
--- a/common/libs/utils/tee_logging.cpp
+++ b/common/libs/utils/tee_logging.cpp
@@ -29,7 +29,7 @@
using android::base::LogSeverity;
using android::base::StringPrintf;
-namespace cvd {
+namespace cuttlefish {
static LogSeverity GuessSeverity(
const std::string& env_var, LogSeverity default_value) {
@@ -164,7 +164,7 @@
now, getpid(), GetThreadId(), severity, tag, file, line, message);
for (const auto& destination : destinations_) {
if (severity >= destination.severity) {
- cvd::WriteAll(destination.target, output_string);
+ cuttlefish::WriteAll(destination.target, output_string);
}
}
}
@@ -174,7 +174,7 @@
std::vector<SeverityTarget> log_severities;
for (const auto& file : files) {
auto log_file_fd =
- cvd::SharedFD::Open(
+ cuttlefish::SharedFD::Open(
file,
O_CREAT | O_WRONLY | O_APPEND,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -197,4 +197,4 @@
return TeeLogger(log_severities);
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/tee_logging.h b/common/libs/utils/tee_logging.h
index 09d4963..bb0a8ef 100644
--- a/common/libs/utils/tee_logging.h
+++ b/common/libs/utils/tee_logging.h
@@ -22,14 +22,14 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
android::base::LogSeverity ConsoleSeverity();
android::base::LogSeverity LogFileSeverity();
struct SeverityTarget {
android::base::LogSeverity severity;
- cvd::SharedFD target;
+ cuttlefish::SharedFD target;
};
class TeeLogger {
@@ -51,4 +51,4 @@
TeeLogger LogToFiles(const std::vector<std::string>& files);
TeeLogger LogToStderrAndFiles(const std::vector<std::string>& files);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/common/libs/utils/users.cpp b/common/libs/utils/users.cpp
index 0b59069..f20a083 100644
--- a/common/libs/utils/users.cpp
+++ b/common/libs/utils/users.cpp
@@ -73,7 +73,7 @@
}
} // namespace
-bool cvd::InGroup(const std::string& group) {
+bool cuttlefish::InGroup(const std::string& group) {
auto gid = GroupIdFromName(group);
if (gid == static_cast<gid_t>(-1)) {
return false;
diff --git a/common/libs/utils/users.h b/common/libs/utils/users.h
index 2fbbdd4..16fcbeb 100644
--- a/common/libs/utils/users.h
+++ b/common/libs/utils/users.h
@@ -17,8 +17,8 @@
#include <string>
-namespace cvd {
+namespace cuttlefish {
bool InGroup(const std::string& group);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/commands/ip_link_add/main.cpp b/guest/commands/ip_link_add/main.cpp
index 5b07798..0138d6f 100644
--- a/guest/commands/ip_link_add/main.cpp
+++ b/guest/commands/ip_link_add/main.cpp
@@ -39,11 +39,11 @@
return -2;
}
const char *const new_name = argv[3];
- auto factory = cvd::NetlinkClientFactory::Default();
- std::unique_ptr<cvd::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
+ auto factory = cuttlefish::NetlinkClientFactory::Default();
+ std::unique_ptr<cuttlefish::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
// http://maz-programmersdiary.blogspot.com/2011/09/netlink-sockets.html
- cvd::NetlinkRequest link_add_request(RTM_NEWLINK, NLM_F_REQUEST|NLM_F_ACK|0x600);
+ cuttlefish::NetlinkRequest link_add_request(RTM_NEWLINK, NLM_F_REQUEST|NLM_F_ACK|0x600);
link_add_request.Append(ifinfomsg {
.ifi_change = 0xFFFFFFFF,
});
@@ -62,7 +62,7 @@
nl->Send(link_add_request);
- cvd::NetlinkRequest bring_up_backing_request(RTM_SETLINK, NLM_F_REQUEST|NLM_F_ACK|0x600);
+ cuttlefish::NetlinkRequest bring_up_backing_request(RTM_SETLINK, NLM_F_REQUEST|NLM_F_ACK|0x600);
bring_up_backing_request.Append(ifinfomsg {
.ifi_index = index,
.ifi_flags = IFF_UP,
diff --git a/guest/commands/rename_netiface/main.cpp b/guest/commands/rename_netiface/main.cpp
index 3703107..b48184d 100644
--- a/guest/commands/rename_netiface/main.cpp
+++ b/guest/commands/rename_netiface/main.cpp
@@ -35,11 +35,11 @@
return -2;
}
const char *const new_name = argv[2];
- auto factory = cvd::NetlinkClientFactory::Default();
- std::unique_ptr<cvd::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
- std::unique_ptr<cvd::NetworkInterfaceManager> nm(
- cvd::NetworkInterfaceManager::New(factory));
- std::unique_ptr<cvd::NetworkInterface> ni(nm->Open(new_name, name));
+ auto factory = cuttlefish::NetlinkClientFactory::Default();
+ std::unique_ptr<cuttlefish::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
+ std::unique_ptr<cuttlefish::NetworkInterfaceManager> nm(
+ cuttlefish::NetworkInterfaceManager::New(factory));
+ std::unique_ptr<cuttlefish::NetworkInterface> ni(nm->Open(new_name, name));
bool res = false;
if (ni) {
ni->SetName(new_name);
diff --git a/guest/commands/setup_wifi/main.cpp b/guest/commands/setup_wifi/main.cpp
index 494a767..44fb051 100644
--- a/guest/commands/setup_wifi/main.cpp
+++ b/guest/commands/setup_wifi/main.cpp
@@ -49,8 +49,8 @@
// TODO(schuffelen): Merge this with the ip_link_add binary.
int CreateWifiWrapper(const std::string& source,
const std::string& destination) {
- auto factory = cvd::NetlinkClientFactory::Default();
- std::unique_ptr<cvd::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
+ auto factory = cuttlefish::NetlinkClientFactory::Default();
+ std::unique_ptr<cuttlefish::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
LOG(INFO) << "Setting " << source << " mac address to " << FLAGS_mac_address;
int32_t index = if_nametoindex(source.c_str());
@@ -59,7 +59,7 @@
// https://elixir.bootlin.com/linux/v5.4.44/source/net/core/rtnetlink.c#L2460
// Setting the address seems to work better on the underlying ethernet device,
// and this mac address is inherited by the virt_wifi device.
- cvd::NetlinkRequest fix_mac_request(
+ cuttlefish::NetlinkRequest fix_mac_request(
RTM_SETLINK, NLM_F_REQUEST|NLM_F_ACK|0x600);
fix_mac_request.Append(ifinfomsg {
.ifi_index = index,
@@ -73,7 +73,7 @@
}
// http://maz-programmersdiary.blogspot.com/2011/09/netlink-sockets.html
- cvd::NetlinkRequest link_add_request(RTM_NEWLINK,
+ cuttlefish::NetlinkRequest link_add_request(RTM_NEWLINK,
NLM_F_REQUEST|NLM_F_ACK|0x600);
link_add_request.Append(ifinfomsg {
.ifi_change = 0xFFFFFFFF,
@@ -97,7 +97,7 @@
return -3;
}
- cvd::NetlinkRequest bring_up_backing_request(RTM_SETLINK,
+ cuttlefish::NetlinkRequest bring_up_backing_request(RTM_SETLINK,
NLM_F_REQUEST|NLM_F_ACK|0x600);
bring_up_backing_request.Append(ifinfomsg {
.ifi_index = index,
@@ -116,7 +116,7 @@
int RenameNetwork(const std::string& name, const std::string& new_name) {
static auto net_manager =
- cvd::NetworkInterfaceManager::New(cvd::NetlinkClientFactory::Default());
+ cuttlefish::NetworkInterfaceManager::New(cuttlefish::NetlinkClientFactory::Default());
auto connection = net_manager->Open(name, "ignore");
if (!connection) {
LOG(ERROR) << "setup_network: could not open " << name << " on device.";
diff --git a/guest/commands/vsoc_input_service/vsoc_input_service.cpp b/guest/commands/vsoc_input_service/vsoc_input_service.cpp
index 4e2cc91..0cb56ef 100644
--- a/guest/commands/vsoc_input_service/vsoc_input_service.cpp
+++ b/guest/commands/vsoc_input_service/vsoc_input_service.cpp
@@ -61,7 +61,7 @@
return false;
}
- auto config = cvd::DeviceConfig::Get();
+ auto config = cuttlefish::DeviceConfig::Get();
if (!config) {
LOG(ERROR) << "Failed to open device config";
return false;
@@ -77,12 +77,12 @@
}
bool VSoCInputService::ProcessEvents() {
- cvd::SharedFD keyboard_fd;
- cvd::SharedFD touch_fd;
+ cuttlefish::SharedFD keyboard_fd;
+ cuttlefish::SharedFD touch_fd;
LOG(INFO) << "Connecting to the keyboard at " << FLAGS_keyboard_port;
if (FLAGS_keyboard_port) {
- keyboard_fd = cvd::SharedFD::VsockClient(2, FLAGS_keyboard_port, SOCK_STREAM);
+ keyboard_fd = cuttlefish::SharedFD::VsockClient(2, FLAGS_keyboard_port, SOCK_STREAM);
if (!keyboard_fd->IsOpen()) {
LOG(ERROR) << "Could not connect to the keyboard at vsock:2:" << FLAGS_keyboard_port;
}
@@ -90,7 +90,7 @@
}
LOG(INFO) << "Connecting to the touchscreen at " << FLAGS_keyboard_port;
if (FLAGS_touch_port) {
- touch_fd = cvd::SharedFD::VsockClient(2, FLAGS_touch_port, SOCK_STREAM);
+ touch_fd = cuttlefish::SharedFD::VsockClient(2, FLAGS_touch_port, SOCK_STREAM);
if (!touch_fd->IsOpen()) {
LOG(ERROR) << "Could not connect to the touch at vsock:2:" << FLAGS_touch_port;
}
diff --git a/guest/commands/vsock_logcat/main.cpp b/guest/commands/vsock_logcat/main.cpp
index 70c7a50..ea2c21a 100644
--- a/guest/commands/vsock_logcat/main.cpp
+++ b/guest/commands/vsock_logcat/main.cpp
@@ -103,7 +103,7 @@
ServiceStatus status;
- auto log_fd = cvd::SharedFD::VsockClient(FLAGS_cid, FLAGS_port, SOCK_STREAM);
+ auto log_fd = cuttlefish::SharedFD::VsockClient(FLAGS_cid, FLAGS_port, SOCK_STREAM);
if (!log_fd->IsOpen()) {
std::ostringstream msg;
msg << "Unable to connect to vsock:" << FLAGS_cid << ":" << FLAGS_port
@@ -117,9 +117,9 @@
<< ServiceStatus::kServiceStatusProperty;
}
- if (cvd::FileExists(FLAGS_pipe_name)) {
+ if (cuttlefish::FileExists(FLAGS_pipe_name)) {
LOG(WARNING) << "The file " << FLAGS_pipe_name << " already exists. Deleting...";
- cvd::RemoveFile(FLAGS_pipe_name);
+ cuttlefish::RemoveFile(FLAGS_pipe_name);
}
auto pipe = mkfifo(FLAGS_pipe_name.c_str(), 0600);
if (pipe != 0) {
@@ -127,7 +127,7 @@
}
property_set("vendor.ser.cf-logcat", FLAGS_pipe_name.c_str());
while (1) {
- auto conn = cvd::SharedFD::Open(FLAGS_pipe_name.c_str(), O_RDONLY);
+ auto conn = cuttlefish::SharedFD::Open(FLAGS_pipe_name.c_str(), O_RDONLY);
while (conn->IsOpen()) {
char buff[4096];
auto read = conn->Read(buff, sizeof(buff));
diff --git a/guest/commands/vtpm_manager/main.cpp b/guest/commands/vtpm_manager/main.cpp
index d2b3584..5785eb7 100644
--- a/guest/commands/vtpm_manager/main.cpp
+++ b/guest/commands/vtpm_manager/main.cpp
@@ -41,45 +41,45 @@
unsigned char locality = 0;
-bool ReadResponseLoop(cvd::SharedFD in_fd, cvd::SharedFD out_fd) {
+bool ReadResponseLoop(cuttlefish::SharedFD in_fd, cuttlefish::SharedFD out_fd) {
std::vector<char> message;
while (true) {
std::uint32_t response_size;
- CHECK(cvd::ReadExactBinary(in_fd, &response_size) == 4)
+ CHECK(cuttlefish::ReadExactBinary(in_fd, &response_size) == 4)
<< "Could not read response size";
// the tpm simulator writes 4 extra bytes at the end of the message.
response_size = be32toh(response_size);
message.resize(response_size, '\0');
- CHECK(cvd::ReadExact(in_fd, &message) == response_size)
+ CHECK(cuttlefish::ReadExact(in_fd, &message) == response_size)
<< "Could not read response message";
auto header = reinterpret_cast<tpm_message_header*>(message.data());
auto host_rc = betoh32(header->ordinal);
LOG(DEBUG) << "TPM response was: \"" << Tss2_RC_Decode(host_rc) << "\" ("
<< host_rc << ")";
std::vector<char> response_bytes(4, 0);
- CHECK(cvd::ReadExact(in_fd, &response_bytes) == 4)
+ CHECK(cuttlefish::ReadExact(in_fd, &response_bytes) == 4)
<< "Could not read parity response";
- CHECK(cvd::WriteAll(out_fd, message) == message.size())
+ CHECK(cuttlefish::WriteAll(out_fd, message) == message.size())
<< "Could not forward message to vTPM";
}
}
-void SendCommand(cvd::SharedFD out_fd, std::vector<char> command) {
+void SendCommand(cuttlefish::SharedFD out_fd, std::vector<char> command) {
// TODO(schuffelen): Implement this logic on the host.
// TPM2 simulator command protocol.
std::uint32_t command_num = htobe32(8); // TPM_SEND_COMMAND
- CHECK(cvd::WriteAllBinary(out_fd, &command_num) == 4)
+ CHECK(cuttlefish::WriteAllBinary(out_fd, &command_num) == 4)
<< "Could not send TPM_SEND_COMMAND";
- CHECK(cvd::WriteAllBinary(out_fd, (char*)&locality) == 1)
+ CHECK(cuttlefish::WriteAllBinary(out_fd, (char*)&locality) == 1)
<< "Could not send locality";
std::uint32_t length = htobe32(command.size());
- CHECK(cvd::WriteAllBinary(out_fd, &length) == 4)
+ CHECK(cuttlefish::WriteAllBinary(out_fd, &length) == 4)
<< "Could not send command length";
- CHECK(cvd::WriteAll(out_fd, command) == command.size())
+ CHECK(cuttlefish::WriteAll(out_fd, command) == command.size())
<< "Could not write TPM message";
}
-bool SendCommandLoop(cvd::SharedFD in_fd, cvd::SharedFD out_fd) {
+bool SendCommandLoop(cuttlefish::SharedFD in_fd, cuttlefish::SharedFD out_fd) {
std::vector<char> message(8192, '\0');
while (true) {
std::int32_t data_length = 0;
@@ -100,7 +100,7 @@
header->ordinal = htobe32(locality);
header->length = htobe32(sizeof(tpm_message_header));
message.resize(sizeof(tpm_message_header), '\0');
- CHECK(cvd::WriteAll(in_fd, message) == message.size())
+ CHECK(cuttlefish::WriteAll(in_fd, message) == message.size())
<< "Could not write TPM message";
} else {
SendCommand(out_fd, message);
@@ -116,10 +116,10 @@
CHECK(FLAGS_tpm_vsock_port != 0) << "Need a value for -tpm_vsock_port";
- auto proxy = cvd::SharedFD::VsockClient(2, FLAGS_tpm_vsock_port, SOCK_STREAM);
+ auto proxy = cuttlefish::SharedFD::VsockClient(2, FLAGS_tpm_vsock_port, SOCK_STREAM);
CHECK(proxy->IsOpen()) << proxy->StrError();
- auto vtpmx = cvd::SharedFD::Open("/dev/vtpmx", O_RDWR | O_CLOEXEC);
+ auto vtpmx = cuttlefish::SharedFD::Open("/dev/vtpmx", O_RDWR | O_CLOEXEC);
CHECK(vtpmx->IsOpen()) << vtpmx->StrError();
vtpm_proxy_new_dev vtpm_creation;
@@ -127,7 +127,7 @@
CHECK(vtpmx->Ioctl(VTPM_PROXY_IOC_NEW_DEV, &vtpm_creation) == 0) << vtpmx->StrError();
- auto device_fd = cvd::SharedFD::Dup(vtpm_creation.fd);
+ auto device_fd = cuttlefish::SharedFD::Dup(vtpm_creation.fd);
CHECK(device_fd->IsOpen()) << device_fd->StrError();
close(vtpm_creation.fd);
diff --git a/guest/hals/camera/CameraConfiguration.cpp b/guest/hals/camera/CameraConfiguration.cpp
index 32ac332..23e0a0c 100644
--- a/guest/hals/camera/CameraConfiguration.cpp
+++ b/guest/hals/camera/CameraConfiguration.cpp
@@ -24,7 +24,7 @@
#include <json/reader.h>
#include <stdlib.h>
-namespace cvd {
+namespace cuttlefish {
namespace {
////////////////////// Device Personality keys //////////////////////
//
@@ -297,4 +297,4 @@
return ConfigureCameras(root, &cameras_);
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/camera/CameraConfiguration.h b/guest/hals/camera/CameraConfiguration.h
index 983963b..f1418e6 100644
--- a/guest/hals/camera/CameraConfiguration.h
+++ b/guest/hals/camera/CameraConfiguration.h
@@ -21,7 +21,7 @@
#include <algorithm>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
// Camera properties and features.
struct CameraDefinition {
@@ -54,6 +54,6 @@
std::vector<CameraDefinition> cameras_;
};
-} // namespace cvd
+} // namespace cuttlefish
#endif // GUEST_HALS_CAMERA_CAMERACONFIGURATION_H_
diff --git a/guest/hals/camera/EmulatedBaseCamera.h b/guest/hals/camera/EmulatedBaseCamera.h
index ba4b98e..ce88044 100644
--- a/guest/hals/camera/EmulatedBaseCamera.h
+++ b/guest/hals/camera/EmulatedBaseCamera.h
@@ -51,7 +51,7 @@
* Return:
* NO_ERROR on success, or an appropriate error status on failure.
*/
- virtual status_t Initialize(const cvd::CameraDefinition& params) = 0;
+ virtual status_t Initialize(const cuttlefish::CameraDefinition& params) = 0;
/****************************************************************************
* Camera API implementation
diff --git a/guest/hals/camera/EmulatedCamera.cpp b/guest/hals/camera/EmulatedCamera.cpp
index e48d579..fc9086d 100644
--- a/guest/hals/camera/EmulatedCamera.cpp
+++ b/guest/hals/camera/EmulatedCamera.cpp
@@ -88,7 +88,7 @@
* Public API
***************************************************************************/
-status_t EmulatedCamera::Initialize(const cvd::CameraDefinition&) {
+status_t EmulatedCamera::Initialize(const cuttlefish::CameraDefinition&) {
/* Preview formats supported by this HAL. */
char preview_formats[1024];
snprintf(preview_formats, sizeof(preview_formats), "%s,%s,%s",
diff --git a/guest/hals/camera/EmulatedCamera.h b/guest/hals/camera/EmulatedCamera.h
index a2de643..25e6836 100644
--- a/guest/hals/camera/EmulatedCamera.h
+++ b/guest/hals/camera/EmulatedCamera.h
@@ -74,7 +74,7 @@
public:
/** Override of base class method */
- virtual status_t Initialize(const cvd::CameraDefinition& properties);
+ virtual status_t Initialize(const cuttlefish::CameraDefinition& properties);
/* Next frame is available in the camera device.
* This is a notification callback that is invoked by the camera device when
diff --git a/guest/hals/camera/EmulatedCamera2.cpp b/guest/hals/camera/EmulatedCamera2.cpp
index ccb8006..cc40f16 100644
--- a/guest/hals/camera/EmulatedCamera2.cpp
+++ b/guest/hals/camera/EmulatedCamera2.cpp
@@ -71,7 +71,7 @@
* Public API
***************************************************************************/
-status_t EmulatedCamera2::Initialize(const cvd::CameraDefinition & /*props*/) {
+status_t EmulatedCamera2::Initialize(const cuttlefish::CameraDefinition & /*props*/) {
return NO_ERROR;
}
diff --git a/guest/hals/camera/EmulatedCamera2.h b/guest/hals/camera/EmulatedCamera2.h
index ad8b113..7db5eb0 100644
--- a/guest/hals/camera/EmulatedCamera2.h
+++ b/guest/hals/camera/EmulatedCamera2.h
@@ -64,7 +64,7 @@
***************************************************************************/
public:
- virtual status_t Initialize(const cvd::CameraDefinition &props);
+ virtual status_t Initialize(const cuttlefish::CameraDefinition &props);
/****************************************************************************
* Camera module API and generic hardware device API implementation
diff --git a/guest/hals/camera/EmulatedCamera3.cpp b/guest/hals/camera/EmulatedCamera3.cpp
index 8b8921a..009f0d0 100644
--- a/guest/hals/camera/EmulatedCamera3.cpp
+++ b/guest/hals/camera/EmulatedCamera3.cpp
@@ -59,7 +59,7 @@
* Public API
***************************************************************************/
-status_t EmulatedCamera3::Initialize(const cvd::CameraDefinition& /*params*/) {
+status_t EmulatedCamera3::Initialize(const cuttlefish::CameraDefinition& /*params*/) {
ALOGV("%s", __FUNCTION__);
mStatus = STATUS_CLOSED;
diff --git a/guest/hals/camera/EmulatedCamera3.h b/guest/hals/camera/EmulatedCamera3.h
index 92fbb4d..52bee58 100644
--- a/guest/hals/camera/EmulatedCamera3.h
+++ b/guest/hals/camera/EmulatedCamera3.h
@@ -84,7 +84,7 @@
***************************************************************************/
public:
- virtual status_t Initialize(const cvd::CameraDefinition ¶ms);
+ virtual status_t Initialize(const cuttlefish::CameraDefinition ¶ms);
/****************************************************************************
* Camera module API and generic hardware device API implementation
diff --git a/guest/hals/camera/EmulatedCameraFactory.cpp b/guest/hals/camera/EmulatedCameraFactory.cpp
index 009e194..025fe18 100644
--- a/guest/hals/camera/EmulatedCameraFactory.cpp
+++ b/guest/hals/camera/EmulatedCameraFactory.cpp
@@ -44,7 +44,7 @@
: mCallbacks(NULL)
{
mCameraConfiguration.Init();
- const std::vector<cvd::CameraDefinition>& cameras =
+ const std::vector<cuttlefish::CameraDefinition>& cameras =
mCameraConfiguration.cameras();
for (size_t camera_index = 0; camera_index < cameras.size(); ++camera_index) {
mCameraDefinitions.push(cameras[camera_index]);
@@ -74,22 +74,22 @@
return mEmulatedCameras[cameraId];
}
- const cvd::CameraDefinition& definition = mCameraDefinitions[cameraId];
+ const cuttlefish::CameraDefinition& definition = mCameraDefinitions[cameraId];
bool is_back_facing =
- (definition.orientation == cvd::CameraDefinition::kBack);
+ (definition.orientation == cuttlefish::CameraDefinition::kBack);
EmulatedBaseCamera* camera;
/* Create, and initialize the fake camera */
switch (definition.hal_version) {
- case cvd::CameraDefinition::kHalV1:
+ case cuttlefish::CameraDefinition::kHalV1:
camera = new EmulatedFakeCamera(cameraId, is_back_facing,
&HAL_MODULE_INFO_SYM.common);
break;
- case cvd::CameraDefinition::kHalV2:
+ case cuttlefish::CameraDefinition::kHalV2:
camera = new EmulatedFakeCamera2(cameraId, is_back_facing,
&HAL_MODULE_INFO_SYM.common);
break;
- case cvd::CameraDefinition::kHalV3:
+ case cuttlefish::CameraDefinition::kHalV3:
camera = new EmulatedFakeCamera3(cameraId, is_back_facing,
&HAL_MODULE_INFO_SYM.common);
break;
diff --git a/guest/hals/camera/EmulatedCameraFactory.h b/guest/hals/camera/EmulatedCameraFactory.h
index f86ae1c..809a8f8 100644
--- a/guest/hals/camera/EmulatedCameraFactory.h
+++ b/guest/hals/camera/EmulatedCameraFactory.h
@@ -178,8 +178,8 @@
sp<EmulatedCameraHotplugThread> mHotplugThread;
/* Back- and front camera properties accessed from the vsoc device. */
- cvd::CameraConfiguration mCameraConfiguration;
- Vector<cvd::CameraDefinition> mCameraDefinitions;
+ cuttlefish::CameraConfiguration mCameraConfiguration;
+ Vector<cuttlefish::CameraDefinition> mCameraDefinitions;
public:
/* Contains device open entry point, as required by HAL API. */
diff --git a/guest/hals/camera/EmulatedFakeCamera.cpp b/guest/hals/camera/EmulatedFakeCamera.cpp
index 4153fd7..ef49ee5 100644
--- a/guest/hals/camera/EmulatedFakeCamera.cpp
+++ b/guest/hals/camera/EmulatedFakeCamera.cpp
@@ -45,7 +45,7 @@
* Public API overrides
***************************************************************************/
-status_t EmulatedFakeCamera::Initialize(const cvd::CameraDefinition& params) {
+status_t EmulatedFakeCamera::Initialize(const cuttlefish::CameraDefinition& params) {
status_t res = mFakeCameraDevice.Initialize();
if (res != NO_ERROR) {
return res;
diff --git a/guest/hals/camera/EmulatedFakeCamera.h b/guest/hals/camera/EmulatedFakeCamera.h
index 5afba3f..78c589f 100644
--- a/guest/hals/camera/EmulatedFakeCamera.h
+++ b/guest/hals/camera/EmulatedFakeCamera.h
@@ -46,7 +46,7 @@
public:
/* Initializes EmulatedFakeCamera instance. */
- status_t Initialize(const cvd::CameraDefinition& params);
+ status_t Initialize(const cuttlefish::CameraDefinition& params);
/****************************************************************************
* EmulatedCamera abstract API implementation.
diff --git a/guest/hals/camera/EmulatedFakeCamera2.cpp b/guest/hals/camera/EmulatedFakeCamera2.cpp
index 393adf1..37bc3a0 100644
--- a/guest/hals/camera/EmulatedFakeCamera2.cpp
+++ b/guest/hals/camera/EmulatedFakeCamera2.cpp
@@ -110,7 +110,7 @@
* Public API overrides
***************************************************************************/
-status_t EmulatedFakeCamera2::Initialize(const cvd::CameraDefinition ¶ms) {
+status_t EmulatedFakeCamera2::Initialize(const cuttlefish::CameraDefinition ¶ms) {
status_t res;
for (size_t index = 0; index < params.resolutions.size(); ++index) {
@@ -143,7 +143,7 @@
kAvailableRawSizes + arraysize(kAvailableRawSizes),
std::back_inserter(mAvailableRawSizes));
- if (params.orientation == cvd::CameraDefinition::kFront) {
+ if (params.orientation == cuttlefish::CameraDefinition::kFront) {
std::copy(kAvailableProcessedSizesFront,
kAvailableProcessedSizesFront +
arraysize(kAvailableProcessedSizesFront),
diff --git a/guest/hals/camera/EmulatedFakeCamera2.h b/guest/hals/camera/EmulatedFakeCamera2.h
index b55d012..0be7b36 100644
--- a/guest/hals/camera/EmulatedFakeCamera2.h
+++ b/guest/hals/camera/EmulatedFakeCamera2.h
@@ -54,7 +54,7 @@
public:
/* Initializes EmulatedFakeCamera2 instance. */
- status_t Initialize(const cvd::CameraDefinition &props);
+ status_t Initialize(const cuttlefish::CameraDefinition &props);
/****************************************************************************
* Camera Module API and generic hardware device API implementation
diff --git a/guest/hals/camera/EmulatedFakeCamera3.cpp b/guest/hals/camera/EmulatedFakeCamera3.cpp
index 756b448..4789bbb 100644
--- a/guest/hals/camera/EmulatedFakeCamera3.cpp
+++ b/guest/hals/camera/EmulatedFakeCamera3.cpp
@@ -101,7 +101,7 @@
}
}
-status_t EmulatedFakeCamera3::Initialize(const cvd::CameraDefinition ¶ms) {
+status_t EmulatedFakeCamera3::Initialize(const cuttlefish::CameraDefinition ¶ms) {
ALOGV("%s: E", __FUNCTION__);
status_t res;
@@ -1077,7 +1077,7 @@
}
status_t EmulatedFakeCamera3::constructStaticInfo(
- const cvd::CameraDefinition ¶ms) {
+ const cuttlefish::CameraDefinition ¶ms) {
CameraMetadata info;
Vector<int32_t> availableCharacteristicsKeys;
status_t res;
diff --git a/guest/hals/camera/EmulatedFakeCamera3.h b/guest/hals/camera/EmulatedFakeCamera3.h
index d67662a..65cb825 100644
--- a/guest/hals/camera/EmulatedFakeCamera3.h
+++ b/guest/hals/camera/EmulatedFakeCamera3.h
@@ -58,7 +58,7 @@
***************************************************************************/
public:
- virtual status_t Initialize(const cvd::CameraDefinition ¶ms);
+ virtual status_t Initialize(const cuttlefish::CameraDefinition ¶ms);
/****************************************************************************
* Camera module API and generic hardware device API implementation
@@ -104,7 +104,7 @@
/**
* Build the static info metadata buffer for this device
*/
- status_t constructStaticInfo(const cvd::CameraDefinition ¶ms);
+ status_t constructStaticInfo(const cuttlefish::CameraDefinition ¶ms);
/**
* Run the fake 3A algorithms as needed. May override/modify settings
diff --git a/guest/hals/hwcomposer/common/base_composer.cpp b/guest/hals/hwcomposer/common/base_composer.cpp
index cd3ac65..0ae63f5 100644
--- a/guest/hals/hwcomposer/common/base_composer.cpp
+++ b/guest/hals/hwcomposer/common/base_composer.cpp
@@ -21,7 +21,7 @@
#include <cutils/properties.h>
#include <log/log.h>
-namespace cvd {
+namespace cuttlefish {
BaseComposer::BaseComposer(std::unique_ptr<ScreenView> screen_view)
: screen_view_(std::move(screen_view)), gralloc_() {}
@@ -52,7 +52,7 @@
screen_view_->Broadcast(buffer_id);
return 0;
-} // namespace cvd
+} // namespace cuttlefish
bool BaseComposer::IsValidLayer(const hwc_layer_1_t& layer) {
auto buffer_opt = gralloc_.Import(layer.handle);
@@ -111,4 +111,4 @@
return -1;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/base_composer.h b/guest/hals/hwcomposer/common/base_composer.h
index c1ffbfe..5169aca 100644
--- a/guest/hals/hwcomposer/common/base_composer.h
+++ b/guest/hals/hwcomposer/common/base_composer.h
@@ -22,7 +22,7 @@
#include "guest/hals/hwcomposer/common/hwcomposer.h"
#include "guest/hals/hwcomposer/common/screen_view.h"
-namespace cvd {
+namespace cuttlefish {
class BaseComposer {
public:
@@ -50,4 +50,4 @@
// Returns buffer offset or negative on error.
int PostFrameBufferTarget(buffer_handle_t handle);
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/cpu_composer.cpp b/guest/hals/hwcomposer/common/cpu_composer.cpp
index 966aabf..4b46c80 100644
--- a/guest/hals/hwcomposer/common/cpu_composer.cpp
+++ b/guest/hals/hwcomposer/common/cpu_composer.cpp
@@ -31,7 +31,7 @@
#include "guest/hals/hwcomposer/common/drm_utils.h"
#include "guest/hals/hwcomposer/common/geometry_utils.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -463,7 +463,7 @@
int tmp_buffer_height =
src_layer->displayFrame.bottom - src_layer->displayFrame.top;
int tmp_buffer_stride_bytes =
- cvd::AlignToPowerOf2(tmp_buffer_width * screen_view_->bytes_per_pixel(), 4);
+ cuttlefish::AlignToPowerOf2(tmp_buffer_width * screen_view_->bytes_per_pixel(), 4);
for (int i = 0; i < needed_tmp_buffers; i++) {
BufferSpec tmp_buffer_spec(
@@ -491,7 +491,7 @@
int src_width = src_layer_spec.crop_width;
int src_height = src_layer_spec.crop_height;
int dst_stride_bytes =
- cvd::AlignToPowerOf2(src_width * screen_view_->bytes_per_pixel(), 4);
+ cuttlefish::AlignToPowerOf2(src_width * screen_view_->bytes_per_pixel(), 4);
size_t needed_size = dst_stride_bytes * src_height;
dst_buffer_spec.width = src_width;
dst_buffer_spec.height = src_height;
@@ -694,4 +694,4 @@
return &special_tmp_buffer_[0];
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/cpu_composer.h b/guest/hals/hwcomposer/common/cpu_composer.h
index f331e2d..c2f21f7 100644
--- a/guest/hals/hwcomposer/common/cpu_composer.h
+++ b/guest/hals/hwcomposer/common/cpu_composer.h
@@ -23,7 +23,7 @@
#include "guest/hals/hwcomposer/common/base_composer.h"
#include "guest/hals/hwcomposer/common/hwcomposer.h"
-namespace cvd {
+namespace cuttlefish {
class CpuComposer : public BaseComposer {
public:
@@ -45,4 +45,4 @@
std::vector<uint8_t> special_tmp_buffer_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/drm_utils.cpp b/guest/hals/hwcomposer/common/drm_utils.cpp
index d4c864e..28985c6 100644
--- a/guest/hals/hwcomposer/common/drm_utils.cpp
+++ b/guest/hals/hwcomposer/common/drm_utils.cpp
@@ -20,7 +20,7 @@
#include <log/log.h>
#include <system/graphics.h>
-namespace cvd {
+namespace cuttlefish {
const char* GetDrmFormatString(uint32_t drm_format) {
switch (drm_format) {
@@ -177,4 +177,4 @@
return 0;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/drm_utils.h b/guest/hals/hwcomposer/common/drm_utils.h
index 15f788d..265e9f4 100644
--- a/guest/hals/hwcomposer/common/drm_utils.h
+++ b/guest/hals/hwcomposer/common/drm_utils.h
@@ -17,7 +17,7 @@
#include <cstdlib>
-namespace cvd {
+namespace cuttlefish {
const char* GetDrmFormatString(uint32_t drm_format);
@@ -25,4 +25,4 @@
int GetDrmFormatFromHalFormat(int hal_format);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/geometry_utils.cpp b/guest/hals/hwcomposer/common/geometry_utils.cpp
index ade2d78..629bcc0 100644
--- a/guest/hals/hwcomposer/common/geometry_utils.cpp
+++ b/guest/hals/hwcomposer/common/geometry_utils.cpp
@@ -19,7 +19,7 @@
#include <algorithm>
#include <utility>
-namespace cvd {
+namespace cuttlefish {
bool LayersOverlap(const hwc_layer_1_t& layer1, const hwc_layer_1_t& layer2) {
int left1 = layer1.displayFrame.left;
@@ -38,4 +38,4 @@
return overlap_x && overlap_y;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/geometry_utils.h b/guest/hals/hwcomposer/common/geometry_utils.h
index 5563fa7..7fdfb95 100644
--- a/guest/hals/hwcomposer/common/geometry_utils.h
+++ b/guest/hals/hwcomposer/common/geometry_utils.h
@@ -17,8 +17,8 @@
#include "guest/hals/hwcomposer/common/hwcomposer.h"
-namespace cvd {
+namespace cuttlefish {
bool LayersOverlap(const hwc_layer_1_t& layer1, const hwc_layer_1_t& layer2);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/gralloc_utils.cpp b/guest/hals/hwcomposer/common/gralloc_utils.cpp
index bb2350f..4672aac 100644
--- a/guest/hals/hwcomposer/common/gralloc_utils.cpp
+++ b/guest/hals/hwcomposer/common/gralloc_utils.cpp
@@ -41,7 +41,7 @@
// TODO(b/146515640): remove this.
using cuttlefish_gralloc0_buffer_handle_t = private_handle_t;
-namespace cvd {
+namespace cuttlefish {
Gralloc::Gralloc() {
android::hardware::preloadPassthroughService<IMapper>();
@@ -526,4 +526,4 @@
return std::nullopt;
}
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/guest/hals/hwcomposer/common/gralloc_utils.h b/guest/hals/hwcomposer/common/gralloc_utils.h
index 370f2bb..b6d91e7 100644
--- a/guest/hals/hwcomposer/common/gralloc_utils.h
+++ b/guest/hals/hwcomposer/common/gralloc_utils.h
@@ -26,7 +26,7 @@
#include <system/graphics.h>
#include <utils/StrongPointer.h>
-namespace cvd {
+namespace cuttlefish {
class Gralloc;
@@ -131,4 +131,4 @@
android::sp<android::hardware::graphics::mapper::V4_0::IMapper> gralloc4_;
};
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/guest/hals/hwcomposer/common/hwcomposer.cpp b/guest/hals/hwcomposer/common/hwcomposer.cpp
index 4b51202..29d91e2 100644
--- a/guest/hals/hwcomposer/common/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/common/hwcomposer.cpp
@@ -58,9 +58,9 @@
#include "guest/hals/hwcomposer/common/hwcomposer.h"
#ifdef USE_OLD_HWCOMPOSER
-typedef cvd::BaseComposer ComposerType;
+typedef cuttlefish::BaseComposer ComposerType;
#else
-typedef cvd::CpuComposer ComposerType;
+typedef cuttlefish::CpuComposer ComposerType;
#endif
struct hwc_composer_device_data_t {
@@ -73,7 +73,7 @@
struct cvd_hwc_composer_device_1_t {
hwc_composer_device_1_t base;
hwc_composer_device_data_t vsync_data;
- cvd::BaseComposer* composer;
+ cuttlefish::BaseComposer* composer;
};
struct external_display_config_t {
@@ -506,7 +506,7 @@
return 0;
}
-namespace cvd {
+namespace cuttlefish {
int cvd_hwc_open(std::unique_ptr<ScreenView> screen_view,
const struct hw_module_t* module, const char* name,
@@ -546,7 +546,7 @@
dev->base.getDisplayConfigs = cvd_hwc_get_display_configs;
dev->base.getDisplayAttributes = cvd_hwc_get_display_attributes;
#ifdef GATHER_STATS
- dev->composer = new cvd::StatsKeepingComposer<ComposerType>(
+ dev->composer = new cuttlefish::StatsKeepingComposer<ComposerType>(
dev->vsync_data.vsync_base_timestamp, std::move(screen_view));
#else
dev->composer = new ComposerType(std::move(screen_view));
@@ -571,4 +571,4 @@
return ret;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/hwcomposer.h b/guest/hals/hwcomposer/common/hwcomposer.h
index 60a786c..3ee94f6 100644
--- a/guest/hals/hwcomposer/common/hwcomposer.h
+++ b/guest/hals/hwcomposer/common/hwcomposer.h
@@ -26,8 +26,8 @@
#define IS_PRIMARY_DISPLAY(x) ((x) == HWC_DISPLAY_PRIMARY)
#define IS_EXTERNAL_DISPLAY(x) ((x) == HWC_DISPLAY_EXTERNAL)
-namespace cvd {
+namespace cuttlefish {
int cvd_hwc_open(std::unique_ptr<ScreenView> screen_view,
const struct hw_module_t* module, const char* name,
struct hw_device_t** device);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/screen_view.cpp b/guest/hals/hwcomposer/common/screen_view.cpp
index 48f9fa6..d86d7a8 100644
--- a/guest/hals/hwcomposer/common/screen_view.cpp
+++ b/guest/hals/hwcomposer/common/screen_view.cpp
@@ -18,7 +18,7 @@
#include "common/libs/utils/size_utils.h"
-namespace cvd {
+namespace cuttlefish {
int ScreenView::NextBuffer() {
int num_buffers = this->num_buffers();
@@ -31,8 +31,8 @@
}
size_t ScreenView::line_length() const {
- return cvd::AlignToPowerOf2(x_res() * bytes_per_pixel(), 4);
+ return cuttlefish::AlignToPowerOf2(x_res() * bytes_per_pixel(), 4);
}
int ScreenView::bytes_per_pixel() const { return 4; }
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/screen_view.h b/guest/hals/hwcomposer/common/screen_view.h
index b985f8f..8eb27a9 100644
--- a/guest/hals/hwcomposer/common/screen_view.h
+++ b/guest/hals/hwcomposer/common/screen_view.h
@@ -19,7 +19,7 @@
#include <stdint.h>
#include <sys/time.h>
-namespace cvd {
+namespace cuttlefish {
struct CompositionStats {
uint32_t num_prepare_calls;
@@ -59,4 +59,4 @@
private:
int last_buffer_ = 0;
};
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/guest/hals/hwcomposer/common/stats_keeper.cpp b/guest/hals/hwcomposer/common/stats_keeper.cpp
index 9e0d0d2..681594f 100644
--- a/guest/hals/hwcomposer/common/stats_keeper.cpp
+++ b/guest/hals/hwcomposer/common/stats_keeper.cpp
@@ -30,13 +30,13 @@
#include "guest/hals/hwcomposer/common/geometry_utils.h"
-using cvd::time::Microseconds;
-using cvd::time::MonotonicTimePoint;
-using cvd::time::Nanoseconds;
-using cvd::time::Seconds;
-using cvd::time::TimeDifference;
+using cuttlefish::time::Microseconds;
+using cuttlefish::time::MonotonicTimePoint;
+using cuttlefish::time::Nanoseconds;
+using cuttlefish::time::Seconds;
+using cuttlefish::time::TimeDifference;
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -257,4 +257,4 @@
#undef bprintf
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/common/stats_keeper.h b/guest/hals/hwcomposer/common/stats_keeper.h
index 3a123f7..a5de93a 100644
--- a/guest/hals/hwcomposer/common/stats_keeper.h
+++ b/guest/hals/hwcomposer/common/stats_keeper.h
@@ -26,14 +26,14 @@
#include "guest/hals/hwcomposer/common/base_composer.h"
#include "guest/hals/hwcomposer/common/hwcomposer.h"
-namespace cvd {
+namespace cuttlefish {
class CompositionData {
public:
- CompositionData(cvd::time::MonotonicTimePoint time_point, int num_prepares,
+ CompositionData(cuttlefish::time::MonotonicTimePoint time_point, int num_prepares,
int num_layers, int num_hwcomposited_layers,
- cvd::time::Nanoseconds prepare_time,
- cvd::time::Nanoseconds set_calls_time)
+ cuttlefish::time::Nanoseconds prepare_time,
+ cuttlefish::time::Nanoseconds set_calls_time)
: time_point_(time_point),
num_prepare_calls_(num_prepares),
num_layers_(num_layers),
@@ -41,7 +41,7 @@
prepare_time_(prepare_time),
set_calls_time_(set_calls_time) {}
- cvd::time::MonotonicTimePoint time_point() const { return time_point_; }
+ cuttlefish::time::MonotonicTimePoint time_point() const { return time_point_; }
int num_prepare_calls() const { return num_prepare_calls_; }
@@ -49,25 +49,25 @@
int num_hwcomposited_layers() const { return num_hwcomposited_layers_; }
- cvd::time::Nanoseconds prepare_time() const { return prepare_time_; }
+ cuttlefish::time::Nanoseconds prepare_time() const { return prepare_time_; }
- cvd::time::Nanoseconds set_calls_time() const { return set_calls_time_; }
+ cuttlefish::time::Nanoseconds set_calls_time() const { return set_calls_time_; }
private:
- cvd::time::MonotonicTimePoint time_point_;
+ cuttlefish::time::MonotonicTimePoint time_point_;
int num_prepare_calls_;
int num_layers_;
int num_hwcomposited_layers_;
- cvd::time::Nanoseconds prepare_time_;
- cvd::time::Nanoseconds set_calls_time_;
+ cuttlefish::time::Nanoseconds prepare_time_;
+ cuttlefish::time::Nanoseconds set_calls_time_;
};
struct HWCCompositionStats {
- cvd::time::MonotonicTimePoint prepare_start;
- cvd::time::MonotonicTimePoint prepare_end;
- cvd::time::MonotonicTimePoint set_start;
- cvd::time::MonotonicTimePoint set_end;
- cvd::time::MonotonicTimePoint last_vsync;
+ cuttlefish::time::MonotonicTimePoint prepare_start;
+ cuttlefish::time::MonotonicTimePoint prepare_end;
+ cuttlefish::time::MonotonicTimePoint set_start;
+ cuttlefish::time::MonotonicTimePoint set_end;
+ cuttlefish::time::MonotonicTimePoint last_vsync;
// There may be more than one call to prepare, the timestamps are with regards
// to the last one (the one that precedes the set call)
int num_prepare_calls;
@@ -80,7 +80,7 @@
public:
// The timespan parameter indicates for how long we keep stats about the past
// compositions.
- StatsKeeper(cvd::time::TimeDifference timespan, int64_t vsync_base,
+ StatsKeeper(cuttlefish::time::TimeDifference timespan, int64_t vsync_base,
int32_t vsync_period);
StatsKeeper();
~StatsKeeper();
@@ -102,7 +102,7 @@
void SynchronizedDump(char* buffer, int buffer_size) const EXCLUDES(mutex_);
private:
- cvd::time::TimeDifference period_length_;
+ cuttlefish::time::TimeDifference period_length_;
// Base and period of the VSYNC signal, allows to accurately calculate the
// time of the last vsync broadcast.
@@ -121,14 +121,14 @@
int num_hwcomposited_layers_ GUARDED_BY(mutex_);
int num_prepare_calls_ GUARDED_BY(mutex_);
int num_set_calls_ GUARDED_BY(mutex_);
- cvd::time::Nanoseconds prepare_call_total_time_ GUARDED_BY(mutex_);
- cvd::time::Nanoseconds set_call_total_time_ GUARDED_BY(mutex_);
+ cuttlefish::time::Nanoseconds prepare_call_total_time_ GUARDED_BY(mutex_);
+ cuttlefish::time::Nanoseconds set_call_total_time_ GUARDED_BY(mutex_);
// These are kept in multisets to be able to calculate mins and maxs of
// changing sets of (not necessarily different) values.
std::multiset<int> prepare_calls_per_set_calls_ GUARDED_BY(mutex_);
std::multiset<int> layers_per_compositions_ GUARDED_BY(mutex_);
- std::multiset<cvd::time::Nanoseconds> prepare_call_times_ GUARDED_BY(mutex_);
- std::multiset<cvd::time::Nanoseconds> set_call_times_ GUARDED_BY(mutex_);
+ std::multiset<cuttlefish::time::Nanoseconds> prepare_call_times_ GUARDED_BY(mutex_);
+ std::multiset<cuttlefish::time::Nanoseconds> set_call_times_ GUARDED_BY(mutex_);
std::multiset<int64_t> set_call_times_per_hwcomposited_layer_ns_
GUARDED_BY(mutex_);
@@ -191,7 +191,7 @@
[this](CompositionStats* stats) {
FinalizeStatsAndGet(stats);
}))),
- stats_keeper_(cvd::time::TimeDifference(cvd::time::Seconds(10), 1),
+ stats_keeper_(cuttlefish::time::TimeDifference(cuttlefish::time::Seconds(10), 1),
vsync_base_timestamp, 1e9 / composer_.refresh_rate()) {}
virtual ~StatsKeepingComposer() = default;
@@ -221,4 +221,4 @@
StatsKeeper stats_keeper_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/cutf_cvm/HWC2.cpp b/guest/hals/hwcomposer/cutf_cvm/HWC2.cpp
index 4afe974..6619b47 100644
--- a/guest/hals/hwcomposer/cutf_cvm/HWC2.cpp
+++ b/guest/hals/hwcomposer/cutf_cvm/HWC2.cpp
@@ -2800,14 +2800,14 @@
return -EINVAL;
}
- std::unique_ptr<cvd::ScreenView> screen_view(new cvd::VsocketScreenView());
+ std::unique_ptr<cuttlefish::ScreenView> screen_view(new cuttlefish::VsocketScreenView());
if (!screen_view) {
ALOGE("Failed to instantiate screen view");
return -1;
}
hw_device_t* device;
- int error = cvd::cvd_hwc_open(std::move(screen_view), module, name, &device);
+ int error = cuttlefish::cvd_hwc_open(std::move(screen_view), module, name, &device);
if (error) {
ALOGE("failed to open hwcomposer device: %s", strerror(-error));
return -1;
diff --git a/guest/hals/hwcomposer/cutf_cvm/hwcomposer.cpp b/guest/hals/hwcomposer/cutf_cvm/hwcomposer.cpp
index 976a68c..788647b 100644
--- a/guest/hals/hwcomposer/cutf_cvm/hwcomposer.cpp
+++ b/guest/hals/hwcomposer/cutf_cvm/hwcomposer.cpp
@@ -28,13 +28,13 @@
static int hwc_open(const struct hw_module_t* module, const char* name,
struct hw_device_t** device) {
- std::unique_ptr<cvd::ScreenView> screen_view(new cvd::VsocketScreenView());
+ std::unique_ptr<cuttlefish::ScreenView> screen_view(new cuttlefish::VsocketScreenView());
if (!screen_view) {
ALOGE("Failed to instantiate screen view");
return -1;
}
- return cvd::cvd_hwc_open(std::move(screen_view), module, name, device);
+ return cuttlefish::cvd_hwc_open(std::move(screen_view), module, name, device);
}
static struct hw_module_methods_t hwc_module_methods = {
diff --git a/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.cpp b/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.cpp
index 16185b5..48b7772 100644
--- a/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.cpp
+++ b/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.cpp
@@ -23,7 +23,7 @@
#include "common/libs/device_config/device_config.h"
-namespace cvd {
+namespace cuttlefish {
VsocketScreenView::VsocketScreenView()
: broadcast_thread_([this]() { BroadcastLoop(); }) {
@@ -39,7 +39,7 @@
}
void VsocketScreenView::GetScreenParameters() {
- auto device_config = cvd::DeviceConfig::Get();
+ auto device_config = cuttlefish::DeviceConfig::Get();
if (!device_config) {
ALOGI(
"Failed to obtain device configuration from server, running in "
@@ -67,7 +67,7 @@
return false;
}
- screen_server_ = cvd::SharedFD::VsockClient(
+ screen_server_ = cuttlefish::SharedFD::VsockClient(
2, static_cast<unsigned int>(vsock_frames_port), SOCK_STREAM);
if (!screen_server_->IsOpen()) {
ALOGE("Unable to connect to screen server: %s", screen_server_->StrError());
@@ -136,4 +136,4 @@
return inner_buffer_.size() / buffer_size();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.h b/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.h
index 0d6d90a..c0685bc 100644
--- a/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.h
+++ b/guest/hals/hwcomposer/cutf_cvm/vsocket_screen_view.h
@@ -24,7 +24,7 @@
#include "common/libs/fs/shared_fd.h"
#include "guest/hals/hwcomposer/common/screen_view.h"
-namespace cvd {
+namespace cuttlefish {
class VsocketScreenView : public ScreenView {
public:
@@ -48,7 +48,7 @@
void BroadcastLoop();
std::vector<char> inner_buffer_;
- cvd::SharedFD screen_server_;
+ cuttlefish::SharedFD screen_server_;
std::thread broadcast_thread_;
int current_offset_ = 0;
int current_seq_ = 0;
@@ -61,4 +61,4 @@
int32_t refresh_rate_{60};
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/guest/hals/keymaster/remote/remote_keymaster.cpp b/guest/hals/keymaster/remote/remote_keymaster.cpp
index fb58a20..edc2547 100644
--- a/guest/hals/keymaster/remote/remote_keymaster.cpp
+++ b/guest/hals/keymaster/remote/remote_keymaster.cpp
@@ -22,7 +22,7 @@
namespace keymaster {
-RemoteKeymaster::RemoteKeymaster(cvd::KeymasterChannel* channel)
+RemoteKeymaster::RemoteKeymaster(cuttlefish::KeymasterChannel* channel)
: channel_(channel) {}
RemoteKeymaster::~RemoteKeymaster() {
diff --git a/guest/hals/keymaster/remote/remote_keymaster.h b/guest/hals/keymaster/remote/remote_keymaster.h
index 64007b0..4c351db 100644
--- a/guest/hals/keymaster/remote/remote_keymaster.h
+++ b/guest/hals/keymaster/remote/remote_keymaster.h
@@ -25,12 +25,12 @@
class RemoteKeymaster {
private:
- cvd::KeymasterChannel* channel_;
+ cuttlefish::KeymasterChannel* channel_;
void ForwardCommand(
AndroidKeymasterCommand command, const Serializable& req, KeymasterResponse* rsp);
public:
- RemoteKeymaster(cvd::KeymasterChannel*);
+ RemoteKeymaster(cuttlefish::KeymasterChannel*);
~RemoteKeymaster();
bool Initialize();
void GetVersion(const GetVersionRequest& request, GetVersionResponse* response);
diff --git a/guest/hals/keymaster/remote/service4.cpp b/guest/hals/keymaster/remote/service4.cpp
index d2be84c..456c285 100644
--- a/guest/hals/keymaster/remote/service4.cpp
+++ b/guest/hals/keymaster/remote/service4.cpp
@@ -36,12 +36,12 @@
gflags::ParseCommandLineFlags(&argc, &argv, true);
::android::hardware::configureRpcThreadpool(1, true);
- auto vsockFd = cvd::SharedFD::VsockClient(2, FLAGS_port, SOCK_STREAM);
+ auto vsockFd = cuttlefish::SharedFD::VsockClient(2, FLAGS_port, SOCK_STREAM);
if (!vsockFd->IsOpen()) {
LOG(FATAL) << "Could not connect to keymaster server: "
<< vsockFd->StrError();
}
- cvd::KeymasterChannel keymasterChannel(vsockFd);
+ cuttlefish::KeymasterChannel keymasterChannel(vsockFd);
auto remoteKeymaster = new keymaster::RemoteKeymaster(&keymasterChannel);
if (!remoteKeymaster->Initialize()) {
diff --git a/guest/hals/ril/cuttlefish_ril.cpp b/guest/hals/ril/cuttlefish_ril.cpp
index bdf8f82..0b20f3d 100644
--- a/guest/hals/ril/cuttlefish_ril.cpp
+++ b/guest/hals/ril/cuttlefish_ril.cpp
@@ -56,7 +56,7 @@
RUIM_NETWORK_PERSONALIZATION = 11
} SIM_Status;
-static std::unique_ptr<cvd::DeviceConfig> global_ril_config = nullptr;
+static std::unique_ptr<cuttlefish::DeviceConfig> global_ril_config = nullptr;
static const struct RIL_Env* gce_ril_env;
@@ -109,11 +109,11 @@
// This call returns true, if operation was successful.
bool SetUpNetworkInterface(const char* ipaddr, int prefixlen,
const char* bcaddr) {
- auto factory = cvd::NetlinkClientFactory::Default();
- std::unique_ptr<cvd::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
- std::unique_ptr<cvd::NetworkInterfaceManager> nm(
- cvd::NetworkInterfaceManager::New(factory));
- std::unique_ptr<cvd::NetworkInterface> ni(nm->Open("rmnet0", "eth1"));
+ auto factory = cuttlefish::NetlinkClientFactory::Default();
+ std::unique_ptr<cuttlefish::NetlinkClient> nl(factory->New(NETLINK_ROUTE));
+ std::unique_ptr<cuttlefish::NetworkInterfaceManager> nm(
+ cuttlefish::NetworkInterfaceManager::New(factory));
+ std::unique_ptr<cuttlefish::NetworkInterface> ni(nm->Open("rmnet0", "eth1"));
if (ni) {
ni->SetName("rmnet0");
@@ -131,7 +131,7 @@
// TearDownNetworkInterface disables network interface.
// This call returns true, if operation was successful.
bool TearDownNetworkInterface() {
- auto nm(cvd::NetworkInterfaceManager::New(nullptr));
+ auto nm(cuttlefish::NetworkInterfaceManager::New(nullptr));
auto ni(nm->Open("rmnet0", "eth1"));
if (ni) {
@@ -2610,7 +2610,7 @@
time(&gce_ril_start_time);
gce_ril_env = env;
- global_ril_config = cvd::DeviceConfig::Get();
+ global_ril_config = cuttlefish::DeviceConfig::Get();
if (!global_ril_config) {
ALOGE("Failed to open device configuration!!!");
return nullptr;
diff --git a/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp b/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
index c2e07ee..3d08780 100644
--- a/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
+++ b/guest/monitoring/tombstone_transmit/tombstone_transmit.cpp
@@ -108,7 +108,7 @@
if(ts_path.empty()) {continue;}
- auto log_fd = cvd::SharedFD::VsockClient(FLAGS_cid, FLAGS_port,
+ auto log_fd = cuttlefish::SharedFD::VsockClient(FLAGS_cid, FLAGS_port,
SOCK_STREAM);
std::ifstream ifs(ts_path);
diff --git a/host/commands/assemble_cvd/assemble_cvd.cc b/host/commands/assemble_cvd/assemble_cvd.cc
index 63bc4f7..ee36ff4 100644
--- a/host/commands/assemble_cvd/assemble_cvd.cc
+++ b/host/commands/assemble_cvd/assemble_cvd.cc
@@ -28,8 +28,8 @@
std::string kFetcherConfigFile = "fetcher_config.json";
-cvd::FetcherConfig FindFetcherConfig(const std::vector<std::string>& files) {
- cvd::FetcherConfig fetcher_config;
+cuttlefish::FetcherConfig FindFetcherConfig(const std::vector<std::string>& files) {
+ cuttlefish::FetcherConfig fetcher_config;
for (const auto& file : files) {
auto expected_pos = file.size() - kFetcherConfigFile.size();
if (file.rfind(kFetcherConfigFile) == expected_pos) {
@@ -51,20 +51,20 @@
if (isatty(0)) {
LOG(FATAL) << "stdin was a tty, expected to be passed the output of a previous stage. "
<< "Did you mean to run launch_cvd?";
- return cvd::AssemblerExitCodes::kInvalidHostConfiguration;
+ return cuttlefish::AssemblerExitCodes::kInvalidHostConfiguration;
} else {
int error_num = errno;
if (error_num == EBADF) {
LOG(FATAL) << "stdin was not a valid file descriptor, expected to be passed the output "
<< "of launch_cvd. Did you mean to run launch_cvd?";
- return cvd::AssemblerExitCodes::kInvalidHostConfiguration;
+ return cuttlefish::AssemblerExitCodes::kInvalidHostConfiguration;
}
}
std::string input_files_str;
{
- auto input_fd = cvd::SharedFD::Dup(0);
- auto bytes_read = cvd::ReadAll(input_fd, &input_files_str);
+ auto input_fd = cuttlefish::SharedFD::Dup(0);
+ auto bytes_read = cuttlefish::ReadAll(input_fd, &input_files_str);
if (bytes_read < 0) {
LOG(FATAL) << "Failed to read input files. Error was \"" << input_fd->StrError() << "\"";
}
@@ -76,5 +76,5 @@
std::cout << GetConfigFilePath(*config) << "\n";
std::cout << std::flush;
- return cvd::AssemblerExitCodes::kSuccess;
+ return cuttlefish::AssemblerExitCodes::kSuccess;
}
diff --git a/host/commands/assemble_cvd/assembler_defs.h b/host/commands/assemble_cvd/assembler_defs.h
index 233f2f5..fd37c03 100644
--- a/host/commands/assemble_cvd/assembler_defs.h
+++ b/host/commands/assemble_cvd/assembler_defs.h
@@ -15,7 +15,7 @@
*/
#pragma once
-namespace cvd {
+namespace cuttlefish {
enum AssemblerExitCodes : int {
kSuccess = 0,
@@ -45,4 +45,4 @@
kDiskSpaceError = 24,
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/assemble_cvd/boot_config.cc b/host/commands/assemble_cvd/boot_config.cc
index c88536a..bdfdf09 100644
--- a/host/commands/assemble_cvd/boot_config.cc
+++ b/host/commands/assemble_cvd/boot_config.cc
@@ -68,7 +68,7 @@
}
auto mkimage_path = vsoc::DefaultHostArtifactsPath("bin/mkenvimage");
- cvd::Command cmd(mkimage_path);
+ cuttlefish::Command cmd(mkimage_path);
cmd.AddParameter("-s");
cmd.AddParameter("4096");
cmd.AddParameter("-o");
@@ -80,14 +80,14 @@
return false;
}
- if(!cvd::FileExists(boot_env_image_path) || cvd::ReadFile(boot_env_image_path) != cvd::ReadFile(tmp_boot_env_image_path)) {
- if(!cvd::RenameFile(tmp_boot_env_image_path, boot_env_image_path)) {
+ if(!cuttlefish::FileExists(boot_env_image_path) || cuttlefish::ReadFile(boot_env_image_path) != cuttlefish::ReadFile(tmp_boot_env_image_path)) {
+ if(!cuttlefish::RenameFile(tmp_boot_env_image_path, boot_env_image_path)) {
LOG(ERROR) << "Unable to delete the old env image.";
return false;
}
LOG(DEBUG) << "Updated bootloader environment image.";
} else {
- cvd::RemoveFile(tmp_boot_env_image_path);
+ cuttlefish::RemoveFile(tmp_boot_env_image_path);
}
return true;
diff --git a/host/commands/assemble_cvd/boot_image_unpacker.cc b/host/commands/assemble_cvd/boot_image_unpacker.cc
index 9ea407a..9fed631 100644
--- a/host/commands/assemble_cvd/boot_image_unpacker.cc
+++ b/host/commands/assemble_cvd/boot_image_unpacker.cc
@@ -26,7 +26,7 @@
#include "common/libs/utils/subprocess.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -153,4 +153,4 @@
return true;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/assemble_cvd/boot_image_unpacker.h b/host/commands/assemble_cvd/boot_image_unpacker.h
index a331f0c..de38a3c 100644
--- a/host/commands/assemble_cvd/boot_image_unpacker.h
+++ b/host/commands/assemble_cvd/boot_image_unpacker.h
@@ -22,7 +22,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
// Unpacks the boot image and extracts kernel, ramdisk and kernel arguments
class BootImageUnpacker {
@@ -85,4 +85,4 @@
bool ExtractVendorRamdiskImage(const std::string& path) const;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/assemble_cvd/data_image.cc b/host/commands/assemble_cvd/data_image.cc
index 15fff42..60d05a1 100644
--- a/host/commands/assemble_cvd/data_image.cc
+++ b/host/commands/assemble_cvd/data_image.cc
@@ -20,7 +20,7 @@
bool ForceFsckImage(const char* data_image) {
auto fsck_path = vsoc::DefaultHostArtifactsPath("bin/fsck.f2fs");
- int fsck_status = cvd::execute({fsck_path, "-y", "-f", data_image});
+ int fsck_status = cuttlefish::execute({fsck_path, "-y", "-f", data_image});
if (fsck_status & ~(FSCK_ERROR_CORRECTED|FSCK_ERROR_CORRECTED_REQUIRES_REBOOT)) {
LOG(ERROR) << "`fsck.f2fs -y -f " << data_image << "` failed with code "
<< fsck_status;
@@ -30,7 +30,7 @@
}
bool ResizeImage(const char* data_image, int data_image_mb) {
- auto file_mb = cvd::FileSize(data_image) >> 20;
+ auto file_mb = cuttlefish::FileSize(data_image) >> 20;
if (file_mb > data_image_mb) {
LOG(ERROR) << data_image << " is already " << file_mb << " MB, will not "
<< "resize down.";
@@ -40,7 +40,7 @@
return true;
} else {
off_t raw_target = static_cast<off_t>(data_image_mb) << 20;
- auto fd = cvd::SharedFD::Open(data_image, O_RDWR);
+ auto fd = cuttlefish::SharedFD::Open(data_image, O_RDWR);
if (fd->Truncate(raw_target) != 0) {
LOG(ERROR) << "`truncate --size=" << data_image_mb << "M "
<< data_image << "` failed:" << fd->StrError();
@@ -51,7 +51,7 @@
return false;
}
auto resize_path = vsoc::DefaultHostArtifactsPath("bin/resize.f2fs");
- int resize_status = cvd::execute({resize_path, data_image});
+ int resize_status = cuttlefish::execute({resize_path, data_image});
if (resize_status != 0) {
LOG(ERROR) << "`resize.f2fs " << data_image << "` failed with code "
<< resize_status;
@@ -74,7 +74,7 @@
// The newfs_msdos tool with the mandatory -C option will do the same
// as below to zero the image file, so we don't need to do it here
if (image_fmt != "sdcard") {
- auto fd = cvd::SharedFD::Open(image, O_CREAT | O_TRUNC | O_RDWR, 0666);
+ auto fd = cuttlefish::SharedFD::Open(image, O_CREAT | O_TRUNC | O_RDWR, 0666);
if (fd->Truncate(image_size_bytes) != 0) {
LOG(ERROR) << "`truncate --size=" << num_mb << "M " << image
<< "` failed:" << fd->StrError();
@@ -83,10 +83,10 @@
}
if (image_fmt == "ext4") {
- cvd::execute({"/sbin/mkfs.ext4", image});
+ cuttlefish::execute({"/sbin/mkfs.ext4", image});
} else if (image_fmt == "f2fs") {
auto make_f2fs_path = vsoc::DefaultHostArtifactsPath("bin/make_f2fs");
- cvd::execute({make_f2fs_path, "-t", image_fmt, image, "-g", "android"});
+ cuttlefish::execute({make_f2fs_path, "-t", image_fmt, image, "-g", "android"});
} else if (image_fmt == "sdcard") {
// Reserve 1MB in the image for the MBR and padding, to simulate what
// other OSes do by default when partitioning a drive
@@ -94,7 +94,7 @@
image_size_bytes -= offset_size_bytes;
off_t image_size_sectors = image_size_bytes / 512;
auto newfs_msdos_path = vsoc::DefaultHostArtifactsPath("bin/newfs_msdos");
- cvd::execute({newfs_msdos_path, "-F", "32", "-m", "0xf8", "-a", "4088",
+ cuttlefish::execute({newfs_msdos_path, "-F", "32", "-m", "0xf8", "-a", "4088",
"-o", "0", "-c", "8", "-h", "255",
"-u", "63", "-S", "512",
"-s", std::to_string(image_size_sectors),
@@ -111,8 +111,8 @@
}},
.boot_signature = { 0x55, 0xAA },
};
- auto fd = cvd::SharedFD::Open(image, O_RDWR);
- if (cvd::WriteAllBinary(fd, &mbr) != sizeof(MasterBootRecord)) {
+ auto fd = cuttlefish::SharedFD::Open(image, O_RDWR);
+ if (cuttlefish::WriteAllBinary(fd, &mbr) != sizeof(MasterBootRecord)) {
LOG(ERROR) << "Writing MBR to " << image << " failed:" << fd->StrError();
return;
}
@@ -124,7 +124,7 @@
DataImageResult ApplyDataImagePolicy(const vsoc::CuttlefishConfig& config,
const std::string& data_image) {
- bool data_exists = cvd::FileHasContent(data_image.c_str());
+ bool data_exists = cuttlefish::FileHasContent(data_image.c_str());
bool remove{};
bool create{};
bool resize{};
@@ -160,7 +160,7 @@
}
if (remove) {
- cvd::RemoveFile(data_image.c_str());
+ cuttlefish::RemoveFile(data_image.c_str());
}
if (create) {
@@ -185,7 +185,7 @@
}
bool InitializeMiscImage(const std::string& misc_image) {
- bool misc_exists = cvd::FileHasContent(misc_image.c_str());
+ bool misc_exists = cuttlefish::FileHasContent(misc_image.c_str());
if (misc_exists) {
LOG(DEBUG) << "misc partition image: use existing";
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index d2c3020..2772d4c 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -35,7 +35,7 @@
#define VBMETA_MAX_SIZE 65536ul
using vsoc::ForCurrentInstance;
-using cvd::AssemblerExitCodes;
+using cuttlefish::AssemblerExitCodes;
DEFINE_string(cache_image, "", "Location of the cache partition image.");
DEFINE_string(metadata_image, "", "Location of the metadata partition image "
@@ -94,7 +94,7 @@
vsoc::DefaultHostArtifactsPath("cuttlefish_assembly"),
"A directory to put generated files common between instances");
DEFINE_string(instance_dir,
- cvd::StringFromEnv("HOME", ".") + "/cuttlefish_runtime",
+ cuttlefish::StringFromEnv("HOME", ".") + "/cuttlefish_runtime",
"A directory to put all instance specific files");
DEFINE_string(
vm_manager, vm_manager::CrosvmManager::name(),
@@ -142,7 +142,7 @@
"Enable crosvm sandbox. Use this when you are sure about what you are doing.");
static const std::string kSeccompDir =
- std::string("usr/share/cuttlefish/") + cvd::HostArch() + "-linux-gnu/seccomp";
+ std::string("usr/share/cuttlefish/") + cuttlefish::HostArch() + "-linux-gnu/seccomp";
DEFINE_string(seccomp_policy_dir,
vsoc::DefaultHostArtifactsPath(kSeccompDir),
"With sandbox'ed crosvm, overrieds the security comp policy directory");
@@ -305,7 +305,7 @@
}
std::string GetCuttlefishEnvPath() {
- return cvd::StringFromEnv("HOME", ".") + "/.cuttlefish.sh";
+ return cuttlefish::StringFromEnv("HOME", ".") + "/.cuttlefish.sh";
}
int NumStreamers() {
@@ -322,8 +322,8 @@
// Initializes the config object and saves it to file. It doesn't return it, all
// further uses of the config should happen through the singleton
vsoc::CuttlefishConfig InitializeCuttlefishConfiguration(
- const cvd::BootImageUnpacker& boot_image_unpacker,
- const cvd::FetcherConfig& fetcher_config) {
+ const cuttlefish::BootImageUnpacker& boot_image_unpacker,
+ const cuttlefish::FetcherConfig& fetcher_config) {
// At most one streamer can be started.
CHECK(NumStreamers() <= 1);
@@ -593,23 +593,23 @@
void SetDefaultFlagsForQemu() {
// TODO(b/144119457) Use the serial port.
- SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode,
+ SetCommandLineOptionWithMode("logcat_mode", cuttlefish::kLogcatVsockMode,
google::FlagSettingMode::SET_FLAGS_DEFAULT);
}
void SetDefaultFlagsForCrosvm() {
- SetCommandLineOptionWithMode("logcat_mode", cvd::kLogcatVsockMode,
+ SetCommandLineOptionWithMode("logcat_mode", cuttlefish::kLogcatVsockMode,
google::FlagSettingMode::SET_FLAGS_DEFAULT);
// for now, we support only x86_64 by default
bool default_enable_sandbox = false;
std::set<const std::string> supported_archs{std::string("x86_64")};
- if (supported_archs.find(cvd::HostArch()) != supported_archs.end()) {
+ if (supported_archs.find(cuttlefish::HostArch()) != supported_archs.end()) {
default_enable_sandbox =
[](const std::string& var_empty) -> bool {
- if (cvd::DirectoryExists(var_empty)) {
- return cvd::IsDirectoryEmpty(var_empty);
+ if (cuttlefish::DirectoryExists(var_empty)) {
+ return cuttlefish::IsDirectoryEmpty(var_empty);
}
- if (cvd::FileExists(var_empty)) {
+ if (cuttlefish::FileExists(var_empty)) {
return false;
}
return (::mkdir(var_empty.c_str(), 0755) == 0);
@@ -629,7 +629,7 @@
// Crosvm requires a specific setting for kernel decompression; it must be
// on for aarch64 and off for x86, no other mode is supported.
bool decompress_kernel = false;
- if (cvd::HostArch() == "aarch64") {
+ if (cuttlefish::HostArch() == "aarch64") {
decompress_kernel = true;
}
SetCommandLineOptionWithMode("decompress_kernel",
@@ -657,7 +657,7 @@
google::FlagSettingMode::SET_FLAGS_DEFAULT);
}
// Various temporary workarounds for aarch64
- if (cvd::HostArch() == "aarch64") {
+ if (cuttlefish::HostArch() == "aarch64") {
SetCommandLineOptionWithMode("tpm_binary",
"",
google::FlagSettingMode::SET_FLAGS_DEFAULT);
@@ -782,15 +782,15 @@
}
bool DecompressKernel(const std::string& src, const std::string& dst) {
- cvd::Command decomp_cmd(vsoc::DefaultHostArtifactsPath("bin/extract-vmlinux"));
+ cuttlefish::Command decomp_cmd(vsoc::DefaultHostArtifactsPath("bin/extract-vmlinux"));
decomp_cmd.AddParameter(src);
- auto output_file = cvd::SharedFD::Creat(dst.c_str(), 0666);
+ auto output_file = cuttlefish::SharedFD::Creat(dst.c_str(), 0666);
if (!output_file->IsOpen()) {
LOG(ERROR) << "Unable to create decompressed image file: "
<< output_file->StrError();
return false;
}
- decomp_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut, output_file);
+ decomp_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut, output_file);
auto decomp_proc = decomp_cmd.Start();
return decomp_proc.Started() && decomp_proc.Wait() == 0;
}
@@ -875,7 +875,7 @@
std::chrono::system_clock::time_point LastUpdatedInputDisk() {
std::chrono::system_clock::time_point ret;
for (auto& partition : disk_config()) {
- auto partition_mod_time = cvd::FileModificationTime(partition.image_file_path);
+ auto partition_mod_time = cuttlefish::FileModificationTime(partition.image_file_path);
if (partition_mod_time > ret) {
ret = partition_mod_time;
}
@@ -884,10 +884,10 @@
}
bool ShouldCreateCompositeDisk(const vsoc::CuttlefishConfig& config) {
- if (!cvd::FileExists(config.composite_disk_path())) {
+ if (!cuttlefish::FileExists(config.composite_disk_path())) {
return true;
}
- auto composite_age = cvd::FileModificationTime(config.composite_disk_path());
+ auto composite_age = cuttlefish::FileModificationTime(config.composite_disk_path());
return composite_age < LastUpdatedInputDisk();
}
@@ -918,13 +918,13 @@
}
bool CreateCompositeDisk(const vsoc::CuttlefishConfig& config) {
- if (!cvd::SharedFD::Open(config.composite_disk_path().c_str(), O_WRONLY | O_CREAT, 0644)->IsOpen()) {
+ if (!cuttlefish::SharedFD::Open(config.composite_disk_path().c_str(), O_WRONLY | O_CREAT, 0644)->IsOpen()) {
LOG(ERROR) << "Could not ensure " << config.composite_disk_path() << " exists";
return false;
}
if (FLAGS_vm_manager == vm_manager::CrosvmManager::name()) {
// Check if filling in the sparse image would run out of disk space.
- auto existing_sizes = cvd::SparseFileSizes(FLAGS_data_image);
+ auto existing_sizes = cuttlefish::SparseFileSizes(FLAGS_data_image);
if (existing_sizes.sparse_size == 0 && existing_sizes.disk_size == 0) {
LOG(ERROR) << "Unable to determine size of \"" << FLAGS_data_image
<< "\". Does this file exist?";
@@ -962,13 +962,13 @@
#endif
const vsoc::CuttlefishConfig* InitFilesystemAndCreateConfig(
- int* argc, char*** argv, cvd::FetcherConfig fetcher_config) {
+ int* argc, char*** argv, cuttlefish::FetcherConfig fetcher_config) {
if (!ParseCommandLineFlags(argc, argv)) {
LOG(ERROR) << "Failed to parse command arguments";
exit(AssemblerExitCodes::kArgumentParsingError);
}
- std::string assembly_dir_parent = cvd::AbsolutePath(FLAGS_assembly_dir);
+ std::string assembly_dir_parent = cuttlefish::AbsolutePath(FLAGS_assembly_dir);
while (assembly_dir_parent[assembly_dir_parent.size() - 1] == '/') {
assembly_dir_parent =
assembly_dir_parent.substr(0, FLAGS_assembly_dir.rfind('/'));
@@ -976,7 +976,7 @@
assembly_dir_parent =
assembly_dir_parent.substr(0, FLAGS_assembly_dir.rfind('/'));
auto log =
- cvd::SharedFD::Open(
+ cuttlefish::SharedFD::Open(
assembly_dir_parent,
O_WRONLY | O_TMPFILE,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -984,14 +984,14 @@
LOG(ERROR) << "Could not open O_TMPFILE precursor to assemble_cvd.log: "
<< log->StrError();
} else {
- android::base::SetLogger(cvd::TeeLogger({
- {cvd::ConsoleSeverity(), cvd::SharedFD::Dup(2)},
- {cvd::LogFileSeverity(), log},
+ android::base::SetLogger(cuttlefish::TeeLogger({
+ {cuttlefish::ConsoleSeverity(), cuttlefish::SharedFD::Dup(2)},
+ {cuttlefish::LogFileSeverity(), log},
}));
}
auto boot_img_unpacker =
- cvd::BootImageUnpacker::FromImages(FLAGS_boot_image,
+ cuttlefish::BootImageUnpacker::FromImages(FLAGS_boot_image,
FLAGS_vendor_boot_image);
{
// The config object is created here, but only exists in memory until the
@@ -1019,7 +1019,7 @@
exit(AssemblerExitCodes::kPrioFilesCleanupError);
}
// Create assembly directory if it doesn't exist.
- if (!cvd::DirectoryExists(FLAGS_assembly_dir.c_str())) {
+ if (!cuttlefish::DirectoryExists(FLAGS_assembly_dir.c_str())) {
LOG(DEBUG) << "Setting up " << FLAGS_assembly_dir;
if (mkdir(FLAGS_assembly_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0
&& errno != EEXIST) {
@@ -1034,7 +1034,7 @@
<< ": " << log->StrError();
}
std::string disk_hole_dir = FLAGS_assembly_dir + "/disk_hole";
- if (!cvd::DirectoryExists(disk_hole_dir.c_str())) {
+ if (!cuttlefish::DirectoryExists(disk_hole_dir.c_str())) {
LOG(DEBUG) << "Setting up " << disk_hole_dir << "/disk_hole";
if (mkdir(disk_hole_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0
&& errno != EEXIST) {
@@ -1045,7 +1045,7 @@
}
for (const auto& instance : config.Instances()) {
// Create instance directory if it doesn't exist.
- if (!cvd::DirectoryExists(instance.instance_dir().c_str())) {
+ if (!cuttlefish::DirectoryExists(instance.instance_dir().c_str())) {
LOG(DEBUG) << "Setting up " << FLAGS_instance_dir << ".N";
if (mkdir(instance.instance_dir().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0
&& errno != EEXIST) {
@@ -1055,7 +1055,7 @@
}
}
auto internal_dir = instance.instance_dir() + "/" + vsoc::kInternalDirName;
- if (!cvd::DirectoryExists(internal_dir)) {
+ if (!cuttlefish::DirectoryExists(internal_dir)) {
if (mkdir(internal_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0
&& errno != EEXIST) {
LOG(ERROR) << "Failed to create internal instance directory: "
@@ -1079,17 +1079,17 @@
std::string first_instance = FLAGS_instance_dir + "." + std::to_string(vsoc::GetInstance());
if (symlink(first_instance.c_str(), FLAGS_instance_dir.c_str()) < 0) {
LOG(ERROR) << "Could not symlink \"" << first_instance << "\" to \"" << FLAGS_instance_dir << "\"";
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
- if (!cvd::FileHasContent(FLAGS_boot_image)) {
+ if (!cuttlefish::FileHasContent(FLAGS_boot_image)) {
LOG(ERROR) << "File not found: " << FLAGS_boot_image;
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
- if (!cvd::FileHasContent(FLAGS_vendor_boot_image)) {
+ if (!cuttlefish::FileHasContent(FLAGS_vendor_boot_image)) {
LOG(ERROR) << "File not found: " << FLAGS_vendor_boot_image;
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
// Do this early so that the config object is ready for anything that needs it
@@ -1148,34 +1148,34 @@
// Create misc if necessary
if (!InitializeMiscImage(FLAGS_misc_image)) {
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
// Create data if necessary
DataImageResult dataImageResult = ApplyDataImagePolicy(*config, FLAGS_data_image);
if (dataImageResult == DataImageResult::Error) {
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
// Create boot_config if necessary
if (!InitBootloaderEnvPartition(*config, FLAGS_boot_env_image)) {
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
- if (!cvd::FileExists(FLAGS_metadata_image)) {
+ if (!cuttlefish::FileExists(FLAGS_metadata_image)) {
CreateBlankImage(FLAGS_metadata_image, FLAGS_blank_metadata_image_mb, "none");
}
for (const auto& instance : config->Instances()) {
- if (!cvd::FileExists(instance.access_kregistry_path())) {
+ if (!cuttlefish::FileExists(instance.access_kregistry_path())) {
CreateBlankImage(instance.access_kregistry_path(), 2 /* mb */, "none");
}
- if (!cvd::FileExists(instance.pstore_path())) {
+ if (!cuttlefish::FileExists(instance.pstore_path())) {
CreateBlankImage(instance.pstore_path(), 2 /* mb */, "none");
}
- if (!cvd::FileExists(instance.sdcard_path())) {
+ if (!cuttlefish::FileExists(instance.sdcard_path())) {
CreateBlankImage(instance.sdcard_path(),
FLAGS_blank_sdcard_image_mb, "sdcard");
}
@@ -1184,12 +1184,12 @@
// libavb expects to be able to read the maximum vbmeta size, so we must
// provide a partition which matches this or the read will fail
for (const auto& vbmeta_image : { FLAGS_vbmeta_image, FLAGS_vbmeta_system_image }) {
- if (cvd::FileSize(vbmeta_image) != VBMETA_MAX_SIZE) {
- auto fd = cvd::SharedFD::Open(vbmeta_image, O_RDWR);
+ if (cuttlefish::FileSize(vbmeta_image) != VBMETA_MAX_SIZE) {
+ auto fd = cuttlefish::SharedFD::Open(vbmeta_image, O_RDWR);
if (fd->Truncate(VBMETA_MAX_SIZE) != 0) {
LOG(ERROR) << "`truncate --size=" << VBMETA_MAX_SIZE << " "
<< vbmeta_image << "` failed: " << fd->StrError();
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
}
}
@@ -1197,7 +1197,7 @@
if (SuperImageNeedsRebuilding(fetcher_config, *config)) {
if (!RebuildSuperImage(fetcher_config, *config, FLAGS_super_image)) {
LOG(ERROR) << "Super image rebuilding requested but could not be completed.";
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
}
@@ -1205,15 +1205,15 @@
bool newDataImage = dataImageResult == DataImageResult::FileUpdated;
if (oldCompositeDisk || newDataImage) {
if (!CreateCompositeDisk(*config)) {
- exit(cvd::kDiskSpaceError);
+ exit(cuttlefish::kDiskSpaceError);
}
}
for (auto instance : config->Instances()) {
auto overlay_path = instance.PerInstancePath("overlay.img");
- bool missingOverlay = !cvd::FileExists(overlay_path);
- bool newOverlay = cvd::FileModificationTime(overlay_path)
- < cvd::FileModificationTime(config->composite_disk_path());
+ bool missingOverlay = !cuttlefish::FileExists(overlay_path);
+ bool newOverlay = cuttlefish::FileModificationTime(overlay_path)
+ < cuttlefish::FileModificationTime(config->composite_disk_path());
if (missingOverlay || oldCompositeDisk || !FLAGS_resume || newDataImage || newOverlay) {
if (FLAGS_resume) {
LOG(INFO) << "Requested to continue an existing session, (the default)"
@@ -1229,9 +1229,9 @@
for (auto instance : config->Instances()) {
// Check that the files exist
for (const auto& file : instance.virtual_disk_paths()) {
- if (!file.empty() && !cvd::FileHasContent(file.c_str())) {
+ if (!file.empty() && !cuttlefish::FileHasContent(file.c_str())) {
LOG(ERROR) << "File not found: " << file;
- exit(cvd::kCuttlefishConfigurationInitError);
+ exit(cuttlefish::kCuttlefishConfigurationInitError);
}
}
}
diff --git a/host/commands/assemble_cvd/flags.h b/host/commands/assemble_cvd/flags.h
index 0373388..da5c5b5 100644
--- a/host/commands/assemble_cvd/flags.h
+++ b/host/commands/assemble_cvd/flags.h
@@ -4,5 +4,5 @@
#include "host/libs/config/fetcher_config.h"
const vsoc::CuttlefishConfig* InitFilesystemAndCreateConfig(
- int* argc, char*** argv, cvd::FetcherConfig config);
+ int* argc, char*** argv, cuttlefish::FetcherConfig config);
std::string GetConfigFilePath(const vsoc::CuttlefishConfig& config);
diff --git a/host/commands/assemble_cvd/image_aggregator.cc b/host/commands/assemble_cvd/image_aggregator.cc
index 7be4aaa..05ff382 100644
--- a/host/commands/assemble_cvd/image_aggregator.cc
+++ b/host/commands/assemble_cvd/image_aggregator.cc
@@ -137,7 +137,7 @@
<< strerror(errno);
auto sparse = sparse_file_import(fd, /* verbose */ false, /* crc */ false);
auto size =
- sparse ? sparse_file_len(sparse, false, true) : cvd::FileSize(file_path);
+ sparse ? sparse_file_len(sparse, false, true) : cuttlefish::FileSize(file_path);
close(fd);
return size;
}
@@ -286,19 +286,19 @@
}
};
-bool WriteBeginning(cvd::SharedFD out, const GptBeginning& beginning) {
+bool WriteBeginning(cuttlefish::SharedFD out, const GptBeginning& beginning) {
std::string begin_str((const char*) &beginning, sizeof(GptBeginning));
- if (cvd::WriteAll(out, begin_str) != begin_str.size()) {
+ if (cuttlefish::WriteAll(out, begin_str) != begin_str.size()) {
LOG(ERROR) << "Could not write GPT beginning: " << out->StrError();
return false;
}
return true;
}
-bool WriteEnd(cvd::SharedFD out, const GptEnd& end, std::int64_t padding) {
+bool WriteEnd(cuttlefish::SharedFD out, const GptEnd& end, std::int64_t padding) {
std::string end_str((const char*) &end, sizeof(GptEnd));
end_str.resize(end_str.size() + padding, '\0');
- if (cvd::WriteAll(out, end_str) != end_str.size()) {
+ if (cuttlefish::WriteAll(out, end_str) != end_str.size()) {
LOG(ERROR) << "Could not write GPT end: " << out->StrError();
return false;
}
@@ -362,15 +362,15 @@
for (auto& disk : partitions) {
builder.AppendDisk(disk);
}
- auto output = cvd::SharedFD::Creat(output_path, 0600);
+ auto output = cuttlefish::SharedFD::Creat(output_path, 0600);
auto beginning = builder.Beginning();
if (!WriteBeginning(output, beginning)) {
LOG(FATAL) << "Could not write GPT beginning to \"" << output_path
<< "\": " << output->StrError();
}
for (auto& disk : partitions) {
- auto disk_fd = cvd::SharedFD::Open(disk.image_file_path, O_RDONLY);
- auto file_size = cvd::FileSize(disk.image_file_path);
+ auto disk_fd = cuttlefish::SharedFD::Open(disk.image_file_path, O_RDONLY);
+ auto file_size = cuttlefish::FileSize(disk.image_file_path);
if (!output->CopyFrom(*disk_fd, file_size)) {
LOG(FATAL) << "Could not copy from \"" << disk.image_file_path
<< "\" to \"" << output_path << "\": " << output->StrError();
@@ -392,13 +392,13 @@
for (auto& disk : partitions) {
builder.AppendDisk(disk);
}
- auto header = cvd::SharedFD::Creat(header_file, 0600);
+ auto header = cuttlefish::SharedFD::Creat(header_file, 0600);
auto beginning = builder.Beginning();
if (!WriteBeginning(header, beginning)) {
LOG(FATAL) << "Could not write GPT beginning to \"" << header_file
<< "\": " << header->StrError();
}
- auto footer = cvd::SharedFD::Creat(footer_file, 0600);
+ auto footer = cuttlefish::SharedFD::Creat(footer_file, 0600);
std::uint64_t padding =
builder.DiskSize() - ((beginning.header.backup_lba + 1) * SECTOR_SIZE);
if (!WriteEnd(footer, builder.End(beginning), padding)) {
@@ -416,7 +416,7 @@
void CreateQcowOverlay(const std::string& crosvm_path,
const std::string& backing_file,
const std::string& output_overlay_path) {
- cvd::Command crosvm_qcow2_cmd(crosvm_path);
+ cuttlefish::Command crosvm_qcow2_cmd(crosvm_path);
crosvm_qcow2_cmd.AddParameter("create_qcow2");
crosvm_qcow2_cmd.AddParameter("--backing_file=", backing_file);
crosvm_qcow2_cmd.AddParameter(output_overlay_path);
diff --git a/host/commands/assemble_cvd/super_image_mixer.cc b/host/commands/assemble_cvd/super_image_mixer.cc
index de6d94c..8afa2ea 100644
--- a/host/commands/assemble_cvd/super_image_mixer.cc
+++ b/host/commands/assemble_cvd/super_image_mixer.cc
@@ -36,11 +36,11 @@
namespace {
-using cvd::FileExists;
+using cuttlefish::FileExists;
using vsoc::DefaultHostArtifactsPath;
-std::string TargetFilesZip(const cvd::FetcherConfig& fetcher_config,
- cvd::FileSource source) {
+std::string TargetFilesZip(const cuttlefish::FetcherConfig& fetcher_config,
+ cuttlefish::FileSource source) {
for (const auto& file_iter : fetcher_config.get_cvd_files()) {
const auto& file_path = file_iter.first;
const auto& file_info = file_iter.second;
@@ -72,7 +72,7 @@
"VENDOR/etc/build.prop",
};
-void FindImports(cvd::Archive* archive, const std::string& build_prop_file) {
+void FindImports(cuttlefish::Archive* archive, const std::string& build_prop_file) {
auto contents = archive->ExtractToMemory(build_prop_file);
auto lines = android::base::Split(contents, "\n");
for (const auto& line : lines) {
@@ -86,8 +86,8 @@
bool CombineTargetZipFiles(const std::string& default_target_zip,
const std::string& system_target_zip,
const std::string& output_path) {
- cvd::Archive default_target_archive(default_target_zip);
- cvd::Archive system_target_archive(system_target_zip);
+ cuttlefish::Archive default_target_archive(default_target_zip);
+ cuttlefish::Archive system_target_archive(system_target_zip);
auto default_target_contents = default_target_archive.Contents();
if (default_target_contents.size() == 0) {
@@ -140,14 +140,14 @@
}
SetSuperPartitionComponents(system_super_partitions, &output_misc);
auto misc_output_path = output_path + "/" + kMiscInfoPath;
- cvd::SharedFD misc_output_file =
- cvd::SharedFD::Creat(misc_output_path.c_str(), 0644);
+ cuttlefish::SharedFD misc_output_file =
+ cuttlefish::SharedFD::Creat(misc_output_path.c_str(), 0644);
if (!misc_output_file->IsOpen()) {
LOG(ERROR) << "Failed to open output misc file: "
<< misc_output_file->StrError();
return false;
}
- if (cvd::WriteAll(misc_output_file, WriteMiscInfo(output_misc)) < 0) {
+ if (cuttlefish::WriteAll(misc_output_file, WriteMiscInfo(output_misc)) < 0) {
LOG(ERROR) << "Failed to write output misc file contents: "
<< misc_output_file->StrError();
return false;
@@ -228,7 +228,7 @@
LOG(ERROR) << "Could not find otatools";
return false;
}
- return cvd::execute({
+ return cuttlefish::execute({
build_super_image_binary,
"--path=" + otatools_path,
combined_target_zip,
@@ -238,31 +238,31 @@
} // namespace
-bool SuperImageNeedsRebuilding(const cvd::FetcherConfig& fetcher_config,
+bool SuperImageNeedsRebuilding(const cuttlefish::FetcherConfig& fetcher_config,
const vsoc::CuttlefishConfig&) {
bool has_default_build = false;
bool has_system_build = false;
for (const auto& file_iter : fetcher_config.get_cvd_files()) {
- if (file_iter.second.source == cvd::FileSource::DEFAULT_BUILD) {
+ if (file_iter.second.source == cuttlefish::FileSource::DEFAULT_BUILD) {
has_default_build = true;
- } else if (file_iter.second.source == cvd::FileSource::SYSTEM_BUILD) {
+ } else if (file_iter.second.source == cuttlefish::FileSource::SYSTEM_BUILD) {
has_system_build = true;
}
}
return has_default_build && has_system_build;
}
-bool RebuildSuperImage(const cvd::FetcherConfig& fetcher_config,
+bool RebuildSuperImage(const cuttlefish::FetcherConfig& fetcher_config,
const vsoc::CuttlefishConfig& config,
const std::string& output_path) {
std::string default_target_zip =
- TargetFilesZip(fetcher_config, cvd::FileSource::DEFAULT_BUILD);
+ TargetFilesZip(fetcher_config, cuttlefish::FileSource::DEFAULT_BUILD);
if (default_target_zip == "") {
LOG(ERROR) << "Unable to find default target zip file.";
return false;
}
std::string system_target_zip =
- TargetFilesZip(fetcher_config, cvd::FileSource::SYSTEM_BUILD);
+ TargetFilesZip(fetcher_config, cuttlefish::FileSource::SYSTEM_BUILD);
if (system_target_zip == "") {
LOG(ERROR) << "Unable to find system target zip file.";
return false;
diff --git a/host/commands/assemble_cvd/super_image_mixer.h b/host/commands/assemble_cvd/super_image_mixer.h
index 1b8c420..c612fd5 100644
--- a/host/commands/assemble_cvd/super_image_mixer.h
+++ b/host/commands/assemble_cvd/super_image_mixer.h
@@ -16,8 +16,8 @@
#include "host/libs/config/cuttlefish_config.h"
#include "host/libs/config/fetcher_config.h"
-bool SuperImageNeedsRebuilding(const cvd::FetcherConfig& fetcher_config,
+bool SuperImageNeedsRebuilding(const cuttlefish::FetcherConfig& fetcher_config,
const vsoc::CuttlefishConfig& config);
-bool RebuildSuperImage(const cvd::FetcherConfig& fetcher_config,
+bool RebuildSuperImage(const cuttlefish::FetcherConfig& fetcher_config,
const vsoc::CuttlefishConfig& config,
const std::string& output_path);
diff --git a/host/commands/config_server/main.cpp b/host/commands/config_server/main.cpp
index 639c342..4c68efc 100644
--- a/host/commands/config_server/main.cpp
+++ b/host/commands/config_server/main.cpp
@@ -27,21 +27,21 @@
"File descriptor to an already created vsock server. Must be specified.");
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
- auto device_config = cvd::DeviceConfig::Get();
+ auto device_config = cuttlefish::DeviceConfig::Get();
CHECK(device_config) << "Could not open device config";
- cvd::SharedFD server_fd = cvd::SharedFD::Dup(FLAGS_server_fd);
+ cuttlefish::SharedFD server_fd = cuttlefish::SharedFD::Dup(FLAGS_server_fd);
CHECK(server_fd->IsOpen()) << "Inheriting logcat server: "
<< server_fd->StrError();
// Server loop
while (true) {
- auto conn = cvd::SharedFD::Accept(*server_fd);
+ auto conn = cuttlefish::SharedFD::Accept(*server_fd);
LOG(DEBUG) << "Connection received on configuration server";
bool succeeded = device_config->SendRawData(conn);
diff --git a/host/commands/console_forwarder/main.cpp b/host/commands/console_forwarder/main.cpp
index d407c38..3ec9d36 100644
--- a/host/commands/console_forwarder/main.cpp
+++ b/host/commands/console_forwarder/main.cpp
@@ -46,10 +46,10 @@
// protected by a mutex.
class ConsoleForwarder {
public:
- ConsoleForwarder(cvd::SharedFD socket,
- cvd::SharedFD console_in,
- cvd::SharedFD console_out,
- cvd::SharedFD console_log) : socket_(socket),
+ ConsoleForwarder(cuttlefish::SharedFD socket,
+ cuttlefish::SharedFD console_in,
+ cuttlefish::SharedFD console_out,
+ cuttlefish::SharedFD console_log) : socket_(socket),
console_in_(console_in),
console_out_(console_out),
console_log_(console_log) {}
@@ -62,7 +62,7 @@
ReadLoop();
}
private:
- void EnqueueWrite(std::shared_ptr<std::vector<char>> buf_ptr, cvd::SharedFD fd) {
+ void EnqueueWrite(std::shared_ptr<std::vector<char>> buf_ptr, cuttlefish::SharedFD fd) {
std::lock_guard<std::mutex> lock(write_queue_mutex_);
write_queue_.emplace_back(fd, buf_ptr);
condvar_.notify_one();
@@ -72,7 +72,7 @@
while (true) {
while (!write_queue_.empty()) {
std::shared_ptr<std::vector<char>> buf_ptr;
- cvd::SharedFD fd;
+ cuttlefish::SharedFD fd;
{
std::lock_guard<std::mutex> lock(write_queue_mutex_);
auto& front = write_queue_.front();
@@ -109,16 +109,16 @@
}
[[noreturn]] void ReadLoop() {
- cvd::SharedFD client_fd;
+ cuttlefish::SharedFD client_fd;
while (true) {
- cvd::SharedFDSet read_set;
+ cuttlefish::SharedFDSet read_set;
if (client_fd->IsOpen()) {
read_set.Set(client_fd);
} else {
read_set.Set(socket_);
}
read_set.Set(console_out_);
- cvd::Select(&read_set, nullptr, nullptr, nullptr);
+ cuttlefish::Select(&read_set, nullptr, nullptr, nullptr);
if (read_set.IsSet(console_out_)) {
std::shared_ptr<std::vector<char>> buf_ptr = std::make_shared<std::vector<char>>(4096);
auto bytes_read = console_out_->Read(buf_ptr->data(), buf_ptr->size());
@@ -138,7 +138,7 @@
// socket_ will only be included in the select call (and therefore only
// present in the read set) if there is no client connected, so this
// assignment is safe.
- client_fd = cvd::SharedFD::Accept(*socket_);
+ client_fd = cuttlefish::SharedFD::Accept(*socket_);
if (!client_fd->IsOpen()) {
LOG(ERROR) << "Error accepting connection on socket: "
<< client_fd->StrError();
@@ -159,18 +159,18 @@
}
}
- cvd::SharedFD socket_;
- cvd::SharedFD console_in_;
- cvd::SharedFD console_out_;
- cvd::SharedFD console_log_;
+ cuttlefish::SharedFD socket_;
+ cuttlefish::SharedFD console_in_;
+ cuttlefish::SharedFD console_out_;
+ cuttlefish::SharedFD console_log_;
std::thread writer_thread_;
std::mutex write_queue_mutex_;
std::condition_variable condvar_;
- std::deque<std::pair<cvd::SharedFD, std::shared_ptr<std::vector<char>>>> write_queue_;
+ std::deque<std::pair<cuttlefish::SharedFD, std::shared_ptr<std::vector<char>>>> write_queue_;
};
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
::gflags::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_console_in_fd < 0 || FLAGS_console_out_fd < 0) {
@@ -179,7 +179,7 @@
return -1;
}
- auto console_in = cvd::SharedFD::Dup(FLAGS_console_in_fd);
+ auto console_in = cuttlefish::SharedFD::Dup(FLAGS_console_in_fd);
close(FLAGS_console_in_fd);
if (!console_in->IsOpen()) {
LOG(ERROR) << "Error dupping fd " << FLAGS_console_in_fd << ": "
@@ -188,7 +188,7 @@
}
close(FLAGS_console_in_fd);
- auto console_out = cvd::SharedFD::Dup(FLAGS_console_out_fd);
+ auto console_out = cuttlefish::SharedFD::Dup(FLAGS_console_out_fd);
close(FLAGS_console_out_fd);
if (!console_out->IsOpen()) {
LOG(ERROR) << "Error dupping fd " << FLAGS_console_out_fd << ": "
@@ -204,7 +204,7 @@
auto instance = config->ForDefaultInstance();
auto console_socket_name = instance.console_path();
- auto socket = cvd::SharedFD::SocketLocalServer(console_socket_name.c_str(),
+ auto socket = cuttlefish::SharedFD::SocketLocalServer(console_socket_name.c_str(),
false,
SOCK_STREAM,
0600);
@@ -215,7 +215,7 @@
}
auto console_log = instance.PerInstancePath("console_log");
- auto console_log_fd = cvd::SharedFD::Open(console_log.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666);
+ auto console_log_fd = cuttlefish::SharedFD::Open(console_log.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666);
ConsoleForwarder console_forwarder(socket, console_in, console_out, console_log_fd);
// Don't get a SIGPIPE from the clients
diff --git a/host/commands/cvd_status/cvd_status.cc b/host/commands/cvd_status/cvd_status.cc
index 7b2789a..9a90882 100644
--- a/host/commands/cvd_status/cvd_status.cc
+++ b/host/commands/cvd_status/cvd_status.cc
@@ -65,14 +65,14 @@
LOG(ERROR) << "No path to launcher monitor found";
return 2;
}
- auto monitor_socket = cvd::SharedFD::SocketLocalClient(monitor_path.c_str(),
+ auto monitor_socket = cuttlefish::SharedFD::SocketLocalClient(monitor_path.c_str(),
false, SOCK_STREAM);
if (!monitor_socket->IsOpen()) {
LOG(ERROR) << "Unable to connect to launcher monitor at " << monitor_path
<< ": " << monitor_socket->StrError();
return 3;
}
- auto request = cvd::LauncherAction::kStatus;
+ auto request = cuttlefish::LauncherAction::kStatus;
auto bytes_sent = monitor_socket->Send(&request, sizeof(request), 0);
if (bytes_sent < 0) {
LOG(ERROR) << "Error sending launcher monitor the status command: "
@@ -80,10 +80,10 @@
return 4;
}
// Perform a select with a timeout to guard against launcher hanging
- cvd::SharedFDSet read_set;
+ cuttlefish::SharedFDSet read_set;
read_set.Set(monitor_socket);
struct timeval timeout = {FLAGS_wait_for_launcher, 0};
- int selected = cvd::Select(&read_set, nullptr, nullptr,
+ int selected = cuttlefish::Select(&read_set, nullptr, nullptr,
FLAGS_wait_for_launcher <= 0 ? nullptr : &timeout);
if (selected < 0){
LOG(ERROR) << "Failed communication with the launcher monitor: "
@@ -94,14 +94,14 @@
LOG(ERROR) << "Timeout expired waiting for launcher monitor to respond";
return 6;
}
- cvd::LauncherResponse response;
+ cuttlefish::LauncherResponse response;
auto bytes_recv = monitor_socket->Recv(&response, sizeof(response), 0);
if (bytes_recv < 0) {
LOG(ERROR) << "Error receiving response from launcher monitor: "
<< monitor_socket->StrError();
return 7;
}
- if (response != cvd::LauncherResponse::kSuccess) {
+ if (response != cuttlefish::LauncherResponse::kSuccess) {
LOG(ERROR) << "Received '" << static_cast<char>(response)
<< "' response from launcher monitor";
return 8;
diff --git a/host/commands/fetcher/build_api.cc b/host/commands/fetcher/build_api.cc
index a83df58..70da96a 100644
--- a/host/commands/fetcher/build_api.cc
+++ b/host/commands/fetcher/build_api.cc
@@ -172,7 +172,7 @@
const std::string& destination) {
for (const auto& path : build.paths) {
auto source = path + "/" + artifact;
- if (!cvd::FileExists(source)) {
+ if (!cuttlefish::FileExists(source)) {
continue;
}
unlink(destination.c_str());
diff --git a/host/commands/fetcher/fetch_cvd.cc b/host/commands/fetcher/fetch_cvd.cc
index 8b1387a..e499cb6 100644
--- a/host/commands/fetcher/fetch_cvd.cc
+++ b/host/commands/fetcher/fetch_cvd.cc
@@ -52,7 +52,7 @@
"-target_files-*.zip file.");
DEFINE_string(credential_source, "", "Build API credential source");
-DEFINE_string(directory, cvd::CurrentDirectory(), "Target directory to fetch "
+DEFINE_string(directory, cuttlefish::CurrentDirectory(), "Target directory to fetch "
"files into");
DEFINE_bool(run_next_stage, false, "Continue running the device through the next stage.");
DEFINE_string(wait_retry_period, "20", "Retry period for pending builds given "
@@ -155,7 +155,7 @@
return {};
}
- cvd::Archive archive(local_path);
+ cuttlefish::Archive archive(local_path);
if (!archive.ExtractAll(target_directory)) {
LOG(ERROR) << "Could not extract " << local_path;
return {};
@@ -192,11 +192,11 @@
}
std::string otatools_dir = target_directory + OTA_TOOLS_DIR;
- if (!cvd::DirectoryExists(otatools_dir) && mkdir(otatools_dir.c_str(), 0777) != 0) {
+ if (!cuttlefish::DirectoryExists(otatools_dir) && mkdir(otatools_dir.c_str(), 0777) != 0) {
LOG(ERROR) << "Could not create " << otatools_dir;
return {};
}
- cvd::Archive archive(local_path);
+ cuttlefish::Archive archive(local_path);
if (!archive.ExtractAll(otatools_dir)) {
LOG(ERROR) << "Could not extract " << local_path;
return {};
@@ -209,14 +209,14 @@
return files;
}
-void AddFilesToConfig(cvd::FileSource purpose, const Build& build,
- const std::vector<std::string>& paths, cvd::FetcherConfig* config,
+void AddFilesToConfig(cuttlefish::FileSource purpose, const Build& build,
+ const std::vector<std::string>& paths, cuttlefish::FetcherConfig* config,
bool override_entry = false) {
for (const std::string& path : paths) {
// TODO(schuffelen): Do better for local builds here.
auto id = std::visit([](auto&& arg) { return arg.id; }, build);
auto target = std::visit([](auto&& arg) { return arg.target; }, build);
- cvd::CvdFile file(purpose, id, target, path);
+ cuttlefish::CvdFile file(purpose, id, target, path);
bool added = config->add_cvd_file(file, override_entry);
if (!added) {
LOG(ERROR) << "Duplicate file " << file;
@@ -242,11 +242,11 @@
gflags::SetUsageMessage(USAGE_MESSAGE);
gflags::ParseCommandLineFlags(&argc, &argv, true);
- cvd::FetcherConfig config;
+ cuttlefish::FetcherConfig config;
config.RecordFlags();
- std::string target_dir = cvd::AbsolutePath(FLAGS_directory);
- if (!cvd::DirectoryExists(target_dir) && mkdir(target_dir.c_str(), 0777) != 0) {
+ std::string target_dir = cuttlefish::AbsolutePath(FLAGS_directory);
+ if (!cuttlefish::DirectoryExists(target_dir) && mkdir(target_dir.c_str(), 0777) != 0) {
LOG(FATAL) << "Could not create " << target_dir;
}
std::chrono::seconds retry_period(std::stoi(FLAGS_wait_retry_period));
@@ -270,7 +270,7 @@
if (host_package_files.empty()) {
LOG(FATAL) << "Could not download host package for " << default_build;
}
- AddFilesToConfig(cvd::FileSource::DEFAULT_BUILD, default_build, host_package_files, &config);
+ AddFilesToConfig(cuttlefish::FileSource::DEFAULT_BUILD, default_build, host_package_files, &config);
if (FLAGS_system_build != "" || FLAGS_kernel_build != "" || FLAGS_otatools_build != "") {
auto ota_build = default_build;
@@ -283,7 +283,7 @@
if (ota_tools_files.empty()) {
LOG(FATAL) << "Could not download ota tools for " << ota_build;
}
- AddFilesToConfig(cvd::FileSource::DEFAULT_BUILD, default_build, ota_tools_files, &config);
+ AddFilesToConfig(cuttlefish::FileSource::DEFAULT_BUILD, default_build, ota_tools_files, &config);
}
if (FLAGS_download_img_zip) {
std::vector<std::string> image_files =
@@ -295,7 +295,7 @@
for (auto& file : image_files) {
LOG(INFO) << file;
}
- AddFilesToConfig(cvd::FileSource::DEFAULT_BUILD, default_build, image_files, &config);
+ AddFilesToConfig(cuttlefish::FileSource::DEFAULT_BUILD, default_build, image_files, &config);
}
if (FLAGS_system_build != "" || FLAGS_download_target_files_zip) {
std::string default_target_dir = target_dir + "/default";
@@ -308,7 +308,7 @@
LOG(FATAL) << "Could not download target files for " << default_build;
}
LOG(INFO) << "Adding target files for default build";
- AddFilesToConfig(cvd::FileSource::DEFAULT_BUILD, default_build, target_files, &config);
+ AddFilesToConfig(cuttlefish::FileSource::DEFAULT_BUILD, default_build, target_files, &config);
}
if (FLAGS_system_build != "") {
@@ -327,7 +327,7 @@
system_in_img_zip = false;
} else {
LOG(INFO) << "Adding img-zip files for system build";
- AddFilesToConfig(cvd::FileSource::SYSTEM_BUILD, system_build, image_files,
+ AddFilesToConfig(cuttlefish::FileSource::SYSTEM_BUILD, system_build, image_files,
&config, true);
}
}
@@ -341,7 +341,7 @@
LOG(FATAL) << "Could not download target files for " << system_build;
return -1;
}
- AddFilesToConfig(cvd::FileSource::SYSTEM_BUILD, system_build, target_files, &config);
+ AddFilesToConfig(cuttlefish::FileSource::SYSTEM_BUILD, system_build, target_files, &config);
if (!system_in_img_zip) {
std::vector<std::string> wanted_images = {"IMAGES/system.img", "IMAGES/product.img"};
auto images = ExtractImages(target_files[0], target_dir, wanted_images);
@@ -399,7 +399,7 @@
std::string local_path = target_dir + "/kernel";
if (build_api.ArtifactToFile(kernel_build, "bzImage", local_path)) {
- AddFilesToConfig(cvd::FileSource::KERNEL_BUILD, kernel_build, {local_path}, &config);
+ AddFilesToConfig(cuttlefish::FileSource::KERNEL_BUILD, kernel_build, {local_path}, &config);
} else {
LOG(FATAL) << "Could not download " << kernel_build << ":bzImage to "
<< local_path;
@@ -415,7 +415,7 @@
LOG(FATAL) << "Could not download " << kernel_build << ":initramfs.img to "
<< target_dir + "/initramfs.img";
}
- AddFilesToConfig(cvd::FileSource::KERNEL_BUILD, kernel_build,
+ AddFilesToConfig(cuttlefish::FileSource::KERNEL_BUILD, kernel_build,
{target_dir + "/initramfs.img"}, &config);
}
}
@@ -426,7 +426,7 @@
// their own build id. So it's unclear which build number fetch_cvd itself was built at.
// https://android.googlesource.com/platform/build/+/979c9f3/Changes.md#build_number
std::string fetcher_path = target_dir + "/fetcher_config.json";
- AddFilesToConfig(cvd::GENERATED, DeviceBuild("", ""), {fetcher_path}, &config);
+ AddFilesToConfig(cuttlefish::GENERATED, DeviceBuild("", ""), {fetcher_path}, &config);
config.SaveToFile(fetcher_path);
for (const auto& file : config.get_cvd_files()) {
@@ -440,15 +440,15 @@
// Ignore return code. We want to make sure there is no running instance,
// and stop_cvd will exit with an error code if there is already no running instance.
- cvd::Command stop_cmd(target_dir + "/bin/stop_cvd");
- stop_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut,
- cvd::Subprocess::StdIOChannel::kStdErr);
+ cuttlefish::Command stop_cmd(target_dir + "/bin/stop_cvd");
+ stop_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut,
+ cuttlefish::Subprocess::StdIOChannel::kStdErr);
stop_cmd.Start().Wait();
// gflags::ParseCommandLineFlags will remove fetch_cvd's flags from this.
// This depends the remove_flags argument (3rd) is "true".
- auto filelist_fd = cvd::SharedFD::MemfdCreate("files_list");
+ auto filelist_fd = cuttlefish::SharedFD::MemfdCreate("files_list");
if (!filelist_fd->IsOpen()) {
LOG(FATAL) << "Unable to create temp file to write file list. "
<< filelist_fd->StrError() << " (" << filelist_fd->GetErrno() << ")";
diff --git a/host/commands/fetcher/install_zip.cc b/host/commands/fetcher/install_zip.cc
index 7933000..624c419 100644
--- a/host/commands/fetcher/install_zip.cc
+++ b/host/commands/fetcher/install_zip.cc
@@ -29,7 +29,7 @@
std::vector<std::string> ExtractImages(const std::string& archive_file,
const std::string& target_directory,
const std::vector<std::string>& images) {
- cvd::Archive archive(archive_file);
+ cuttlefish::Archive archive(archive_file);
bool extracted =
images.size() > 0
? archive.ExtractFiles(images, target_directory)
diff --git a/host/commands/kernel_log_monitor/kernel_log_server.cc b/host/commands/kernel_log_monitor/kernel_log_server.cc
index 2bc037b..1f4f331 100644
--- a/host/commands/kernel_log_monitor/kernel_log_server.cc
+++ b/host/commands/kernel_log_monitor/kernel_log_server.cc
@@ -24,7 +24,7 @@
#include "common/libs/fs/shared_select.h"
#include "host/libs/config/cuttlefish_config.h"
-using cvd::SharedFD;
+using cuttlefish::SharedFD;
namespace {
static const std::map<std::string, std::string> kInformationalPatterns = {
@@ -66,18 +66,18 @@
} // namespace
namespace monitor {
-KernelLogServer::KernelLogServer(cvd::SharedFD pipe_fd,
+KernelLogServer::KernelLogServer(cuttlefish::SharedFD pipe_fd,
const std::string& log_name,
bool deprecated_boot_completed)
: pipe_fd_(pipe_fd),
- log_fd_(cvd::SharedFD::Open(log_name.c_str(), O_CREAT | O_RDWR, 0666)),
+ log_fd_(cuttlefish::SharedFD::Open(log_name.c_str(), O_CREAT | O_RDWR, 0666)),
deprecated_boot_completed_(deprecated_boot_completed) {}
-void KernelLogServer::BeforeSelect(cvd::SharedFDSet* fd_read) const {
+void KernelLogServer::BeforeSelect(cuttlefish::SharedFDSet* fd_read) const {
fd_read->Set(pipe_fd_);
}
-void KernelLogServer::AfterSelect(const cvd::SharedFDSet& fd_read) {
+void KernelLogServer::AfterSelect(const cuttlefish::SharedFDSet& fd_read) {
if (fd_read.IsSet(pipe_fd_)) {
HandleIncomingMessage();
}
diff --git a/host/commands/kernel_log_monitor/kernel_log_server.h b/host/commands/kernel_log_monitor/kernel_log_server.h
index f5709ee..8213e31 100644
--- a/host/commands/kernel_log_monitor/kernel_log_server.h
+++ b/host/commands/kernel_log_monitor/kernel_log_server.h
@@ -46,7 +46,7 @@
// one connection.
class KernelLogServer {
public:
- KernelLogServer(cvd::SharedFD pipe_fd,
+ KernelLogServer(cuttlefish::SharedFD pipe_fd,
const std::string& log_name,
bool deprecated_boot_completed);
@@ -54,11 +54,11 @@
// BeforeSelect is Called right before Select() to populate interesting
// SharedFDs.
- void BeforeSelect(cvd::SharedFDSet* fd_read) const;
+ void BeforeSelect(cuttlefish::SharedFDSet* fd_read) const;
// AfterSelect is Called right after Select() to detect and respond to changes
// on affected SharedFDs.
- void AfterSelect(const cvd::SharedFDSet& fd_read);
+ void AfterSelect(const cuttlefish::SharedFDSet& fd_read);
void SubscribeToBootEvents(BootEventCallback callback);
private:
@@ -66,8 +66,8 @@
// Returns false, if client disconnected.
bool HandleIncomingMessage();
- cvd::SharedFD pipe_fd_;
- cvd::SharedFD log_fd_;
+ cuttlefish::SharedFD pipe_fd_;
+ cuttlefish::SharedFD log_fd_;
std::string line_;
bool deprecated_boot_completed_;
std::vector<BootEventCallback> subscribers_;
diff --git a/host/commands/kernel_log_monitor/main.cc b/host/commands/kernel_log_monitor/main.cc
index 54611a8..4c4a7ba 100644
--- a/host/commands/kernel_log_monitor/main.cc
+++ b/host/commands/kernel_log_monitor/main.cc
@@ -38,7 +38,7 @@
"A comma separated list of file descriptors (most likely pipes) to"
" send boot events to.");
-std::vector<cvd::SharedFD> SubscribersFromCmdline() {
+std::vector<cuttlefish::SharedFD> SubscribersFromCmdline() {
// Validate the parameter
std::string fd_list = FLAGS_subscriber_fds;
for (auto c: fd_list) {
@@ -49,10 +49,10 @@
}
auto fds = android::base::Split(FLAGS_subscriber_fds, ",");
- std::vector<cvd::SharedFD> shared_fds;
+ std::vector<cuttlefish::SharedFD> shared_fds;
for (auto& fd_str: fds) {
auto fd = std::stoi(fd_str);
- auto shared_fd = cvd::SharedFD::Dup(fd);
+ auto shared_fd = cuttlefish::SharedFD::Dup(fd);
close(fd);
shared_fds.push_back(shared_fd);
}
@@ -61,7 +61,7 @@
}
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
auto config = vsoc::CuttlefishConfig::Get();
@@ -78,12 +78,12 @@
new_action.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &new_action, &old_action);
- cvd::SharedFD pipe;
+ cuttlefish::SharedFD pipe;
if (FLAGS_log_pipe_fd < 0) {
auto log_name = instance.kernel_log_pipe_name();
- pipe = cvd::SharedFD::Open(log_name.c_str(), O_RDONLY);
+ pipe = cuttlefish::SharedFD::Open(log_name.c_str(), O_RDONLY);
} else {
- pipe = cvd::SharedFD::Dup(FLAGS_log_pipe_fd);
+ pipe = cuttlefish::SharedFD::Dup(FLAGS_log_pipe_fd);
close(FLAGS_log_pipe_fd);
}
@@ -116,12 +116,12 @@
}
for (;;) {
- cvd::SharedFDSet fd_read;
+ cuttlefish::SharedFDSet fd_read;
fd_read.Zero();
klog.BeforeSelect(&fd_read);
- int ret = cvd::Select(&fd_read, nullptr, nullptr, nullptr);
+ int ret = cuttlefish::Select(&fd_read, nullptr, nullptr, nullptr);
if (ret <= 0) continue;
klog.AfterSelect(fd_read);
diff --git a/host/commands/launch/filesystem_explorer.cc b/host/commands/launch/filesystem_explorer.cc
index 12cd1ed..aac8ae6 100644
--- a/host/commands/launch/filesystem_explorer.cc
+++ b/host/commands/launch/filesystem_explorer.cc
@@ -28,10 +28,10 @@
#include "common/libs/utils/environment.h"
#include "host/libs/config/fetcher_config.h"
-cvd::FetcherConfig AvailableFilesReport() {
- std::string current_directory = cvd::AbsolutePath(cvd::CurrentDirectory());
- if (cvd::FileExists(current_directory + "/fetcher_config.json")) {
- cvd::FetcherConfig config;
+cuttlefish::FetcherConfig AvailableFilesReport() {
+ std::string current_directory = cuttlefish::AbsolutePath(cuttlefish::CurrentDirectory());
+ if (cuttlefish::FileExists(current_directory + "/fetcher_config.json")) {
+ cuttlefish::FetcherConfig config;
config.LoadFromFile(current_directory + "/fetcher_config.json");
return config;
}
@@ -39,16 +39,16 @@
std::set<std::string> files;
std::string psuedo_fetcher_dir =
- cvd::StringFromEnv("ANDROID_HOST_OUT",
- cvd::StringFromEnv("HOME", current_directory));
+ cuttlefish::StringFromEnv("ANDROID_HOST_OUT",
+ cuttlefish::StringFromEnv("HOME", current_directory));
std::string psuedo_fetcher_config =
psuedo_fetcher_dir + "/launcher_pseudo_fetcher_config.json";
files.insert(psuedo_fetcher_config);
- cvd::FetcherConfig config;
+ cuttlefish::FetcherConfig config;
config.RecordFlags();
for (const auto& file : files) {
- config.add_cvd_file(cvd::CvdFile(cvd::FileSource::LOCAL_FILE, "", "", file));
+ config.add_cvd_file(cuttlefish::CvdFile(cuttlefish::FileSource::LOCAL_FILE, "", "", file));
}
config.SaveToFile(psuedo_fetcher_config);
return config;
diff --git a/host/commands/launch/filesystem_explorer.h b/host/commands/launch/filesystem_explorer.h
index 3290ebd..ceae504 100644
--- a/host/commands/launch/filesystem_explorer.h
+++ b/host/commands/launch/filesystem_explorer.h
@@ -17,4 +17,4 @@
#include "host/libs/config/fetcher_config.h"
-cvd::FetcherConfig AvailableFilesReport();
+cuttlefish::FetcherConfig AvailableFilesReport();
diff --git a/host/commands/launch/flag_forwarder.cc b/host/commands/launch/flag_forwarder.cc
index 8dc92d0..692e453 100644
--- a/host/commands/launch/flag_forwarder.cc
+++ b/host/commands/launch/flag_forwarder.cc
@@ -234,12 +234,12 @@
std::map<std::string, std::string> flag_to_type = CurrentFlagsToTypes();
for (const auto& subprocess : subprocesses_) {
- cvd::Command cmd(subprocess);
+ cuttlefish::Command cmd(subprocess);
cmd.AddParameter("--helpxml");
std::string helpxml_input, helpxml_output, helpxml_error;
- cvd::SubprocessOptions options;
+ cuttlefish::SubprocessOptions options;
options.Verbose(false);
- int helpxml_ret = cvd::RunWithManagedStdio(std::move(cmd), &helpxml_input,
+ int helpxml_ret = cuttlefish::RunWithManagedStdio(std::move(cmd), &helpxml_input,
&helpxml_output, &helpxml_error,
options);
if (helpxml_ret != 1) {
@@ -273,7 +273,7 @@
void FlagForwarder::UpdateFlagDefaults() const {
for (const auto& subprocess : subprocesses_) {
- cvd::Command cmd(subprocess);
+ cuttlefish::Command cmd(subprocess);
std::vector<std::string> invocation = {subprocess};
for (const auto& flag : ArgvForSubprocess(subprocess)) {
cmd.AddParameter(flag);
@@ -290,9 +290,9 @@
// Ensure this is set on by putting it at the end.
cmd.AddParameter("--helpxml");
std::string helpxml_input, helpxml_output, helpxml_error;
- cvd::SubprocessOptions options;
+ cuttlefish::SubprocessOptions options;
options.Verbose(false);
- int helpxml_ret = cvd::RunWithManagedStdio(std::move(cmd), &helpxml_input,
+ int helpxml_ret = cuttlefish::RunWithManagedStdio(std::move(cmd), &helpxml_input,
&helpxml_output, &helpxml_error,
options);
if (helpxml_ret != 1) {
diff --git a/host/commands/launch/launch_cvd.cc b/host/commands/launch/launch_cvd.cc
index 12cd801..1a077b4 100644
--- a/host/commands/launch/launch_cvd.cc
+++ b/host/commands/launch/launch_cvd.cc
@@ -56,37 +56,37 @@
std::string kAssemblerBin = vsoc::DefaultHostArtifactsPath("bin/assemble_cvd");
std::string kRunnerBin = vsoc::DefaultHostArtifactsPath("bin/run_cvd");
-cvd::Subprocess StartAssembler(cvd::SharedFD assembler_stdin,
- cvd::SharedFD assembler_stdout,
+cuttlefish::Subprocess StartAssembler(cuttlefish::SharedFD assembler_stdin,
+ cuttlefish::SharedFD assembler_stdout,
const std::vector<std::string>& argv) {
- cvd::Command assemble_cmd(kAssemblerBin);
+ cuttlefish::Command assemble_cmd(kAssemblerBin);
for (const auto& arg : argv) {
assemble_cmd.AddParameter(arg);
}
if (assembler_stdin->IsOpen()) {
- assemble_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdIn, assembler_stdin);
+ assemble_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdIn, assembler_stdin);
}
- assemble_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut, assembler_stdout);
+ assemble_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut, assembler_stdout);
return assemble_cmd.Start();
}
-cvd::Subprocess StartRunner(cvd::SharedFD runner_stdin,
+cuttlefish::Subprocess StartRunner(cuttlefish::SharedFD runner_stdin,
const std::vector<std::string>& argv) {
- cvd::Command run_cmd(kRunnerBin);
+ cuttlefish::Command run_cmd(kRunnerBin);
for (const auto& arg : argv) {
run_cmd.AddParameter(arg);
}
- run_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdIn, runner_stdin);
+ run_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdIn, runner_stdin);
return run_cmd.Start();
}
-void WriteFiles(cvd::FetcherConfig fetcher_config, cvd::SharedFD out) {
+void WriteFiles(cuttlefish::FetcherConfig fetcher_config, cuttlefish::SharedFD out) {
std::stringstream output_streambuf;
for (const auto& file : fetcher_config.get_cvd_files()) {
output_streambuf << file.first << "\n";
}
std::string output_string = output_streambuf.str();
- int written = cvd::WriteAll(out, output_string);
+ int written = cuttlefish::WriteAll(out, output_string);
if (written < 0) {
LOG(FATAL) << "Could not write file report (" << strerror(out->GetErrno())
<< ")";
@@ -158,13 +158,13 @@
auto use_metrics = FLAGS_report_anonymous_usage_stats;
FLAGS_report_anonymous_usage_stats = ValidateMetricsConfirmation(use_metrics);
- cvd::SharedFD assembler_stdout, assembler_stdout_capture;
- cvd::SharedFD::Pipe(&assembler_stdout_capture, &assembler_stdout);
+ cuttlefish::SharedFD assembler_stdout, assembler_stdout_capture;
+ cuttlefish::SharedFD::Pipe(&assembler_stdout_capture, &assembler_stdout);
- cvd::SharedFD launcher_report, assembler_stdin;
+ cuttlefish::SharedFD launcher_report, assembler_stdin;
bool should_generate_report = FLAGS_run_file_discovery;
if (should_generate_report) {
- cvd::SharedFD::Pipe(&assembler_stdin, &launcher_report);
+ cuttlefish::SharedFD::Pipe(&assembler_stdin, &launcher_report);
}
auto instance_num_str = std::to_string(FLAGS_base_instance_num);
@@ -181,7 +181,7 @@
}
std::string assembler_output;
- if (cvd::ReadAll(assembler_stdout_capture, &assembler_output) < 0) {
+ if (cuttlefish::ReadAll(assembler_stdout_capture, &assembler_output) < 0) {
int error_num = errno;
LOG(ERROR) << "Read error getting output from assemble_cvd: " << strerror(error_num);
return -1;
@@ -195,17 +195,17 @@
LOG(DEBUG) << "assemble_cvd exited successfully.";
}
- std::vector<cvd::Subprocess> runners;
+ std::vector<cuttlefish::Subprocess> runners;
for (int i = 0; i < FLAGS_num_instances; i++) {
- cvd::SharedFD runner_stdin_in, runner_stdin_out;
- cvd::SharedFD::Pipe(&runner_stdin_out, &runner_stdin_in);
+ cuttlefish::SharedFD runner_stdin_in, runner_stdin_out;
+ cuttlefish::SharedFD::Pipe(&runner_stdin_out, &runner_stdin_in);
std::string instance_name = std::to_string(i + FLAGS_base_instance_num);
setenv("CUTTLEFISH_INSTANCE", instance_name.c_str(), /* overwrite */ 1);
auto run_proc = StartRunner(std::move(runner_stdin_out),
forwarder.ArgvForSubprocess(kRunnerBin));
runners.push_back(std::move(run_proc));
- if (cvd::WriteAll(runner_stdin_in, assembler_output) < 0) {
+ if (cuttlefish::WriteAll(runner_stdin_in, assembler_output) < 0) {
int error_num = errno;
LOG(ERROR) << "Could not write to run_cvd: " << strerror(error_num);
return -1;
diff --git a/host/commands/log_tee/log_tee.cpp b/host/commands/log_tee/log_tee.cpp
index c1b3ba0..783329c 100644
--- a/host/commands/log_tee/log_tee.cpp
+++ b/host/commands/log_tee/log_tee.cpp
@@ -38,13 +38,13 @@
if (config->run_as_daemon()) {
android::base::SetLogger(
- cvd::LogToFiles({instance.launcher_log_path()}));
+ cuttlefish::LogToFiles({instance.launcher_log_path()}));
} else {
android::base::SetLogger(
- cvd::LogToStderrAndFiles({instance.launcher_log_path()}));
+ cuttlefish::LogToStderrAndFiles({instance.launcher_log_path()}));
}
- auto log_fd = cvd::SharedFD::Dup(FLAGS_log_fd_in);
+ auto log_fd = cuttlefish::SharedFD::Dup(FLAGS_log_fd_in);
CHECK(log_fd->IsOpen()) << "Failed to dup log_fd_in: " << log_fd->StrError();
close(FLAGS_log_fd_in);
diff --git a/host/commands/logcat_receiver/main.cpp b/host/commands/logcat_receiver/main.cpp
index c4a0a9a..189e0a0 100644
--- a/host/commands/logcat_receiver/main.cpp
+++ b/host/commands/logcat_receiver/main.cpp
@@ -26,7 +26,7 @@
"File descriptor to an already created vsock server. Must be specified.");
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
auto config = vsoc::CuttlefishConfig::Get();
@@ -34,11 +34,11 @@
auto instance = config->ForDefaultInstance();
auto path = instance.logcat_path();
auto logcat_file =
- cvd::SharedFD::Open(path.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666);
+ cuttlefish::SharedFD::Open(path.c_str(), O_CREAT | O_APPEND | O_WRONLY, 0666);
CHECK(logcat_file->IsOpen())
<< "Unable to open logcat file: " << logcat_file->StrError();
- cvd::SharedFD server_fd = cvd::SharedFD::Dup(FLAGS_server_fd);
+ cuttlefish::SharedFD server_fd = cuttlefish::SharedFD::Dup(FLAGS_server_fd);
close(FLAGS_server_fd);
CHECK(server_fd->IsOpen()) << "Error creating or inheriting logcat server: "
@@ -46,7 +46,7 @@
// Server loop
while (true) {
- auto conn = cvd::SharedFD::Accept(*server_fd);
+ auto conn = cuttlefish::SharedFD::Accept(*server_fd);
while (true) {
char buff[1024];
diff --git a/host/commands/metrics/metrics.cc b/host/commands/metrics/metrics.cc
index 1ca67b2..3ddeb11 100644
--- a/host/commands/metrics/metrics.cc
+++ b/host/commands/metrics/metrics.cc
@@ -21,7 +21,7 @@
#include "host/commands/metrics/metrics_defs.h"
#include "host/libs/config/cuttlefish_config.h"
-using cvd::MetricsExitCodes;
+using cuttlefish::MetricsExitCodes;
int main(int argc, char** argv) {
::android::base::InitLogging(argv, android::base::StderrLogger);
@@ -36,21 +36,21 @@
if (config->run_as_daemon()) {
android::base::SetLogger(
- cvd::LogToFiles({metrics_log_path, instance.launcher_log_path()}));
+ cuttlefish::LogToFiles({metrics_log_path, instance.launcher_log_path()}));
} else {
android::base::SetLogger(
- cvd::LogToStderrAndFiles(
+ cuttlefish::LogToStderrAndFiles(
{metrics_log_path, instance.launcher_log_path()}));
}
if (config->enable_metrics() != vsoc::CuttlefishConfig::kYes) {
LOG(ERROR) << "metrics not enabled, but metrics were launched.";
- return cvd::MetricsExitCodes::kInvalidHostConfiguration;
+ return cuttlefish::MetricsExitCodes::kInvalidHostConfiguration;
}
while (true) {
// do nothing
sleep(std::numeric_limits<unsigned int>::max());
}
- return cvd::MetricsExitCodes::kMetricsError;
+ return cuttlefish::MetricsExitCodes::kMetricsError;
}
diff --git a/host/commands/metrics/metrics_defs.h b/host/commands/metrics/metrics_defs.h
index 189d13b..f36b3a0 100644
--- a/host/commands/metrics/metrics_defs.h
+++ b/host/commands/metrics/metrics_defs.h
@@ -15,7 +15,7 @@
*/
#pragma once
-namespace cvd {
+namespace cuttlefish {
enum MetricsExitCodes : int {
kSuccess=0,
@@ -23,4 +23,4 @@
kInvalidHostConfiguration=2,
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/run_cvd/launch.cc b/host/commands/run_cvd/launch.cc
index 7353d53..1fa2da6 100644
--- a/host/commands/run_cvd/launch.cc
+++ b/host/commands/run_cvd/launch.cc
@@ -13,8 +13,8 @@
#include "host/libs/vm_manager/crosvm_manager.h"
#include "host/libs/vm_manager/qemu_manager.h"
-using cvd::MonitorEntry;
-using cvd::RunnerExitCodes;
+using cuttlefish::MonitorEntry;
+using cuttlefish::RunnerExitCodes;
namespace {
@@ -56,21 +56,21 @@
AdbModeEnabled(config, vsoc::AdbMode::NativeVsock);
}
-cvd::OnSocketReadyCb GetOnSubprocessExitCallback(
+cuttlefish::OnSocketReadyCb GetOnSubprocessExitCallback(
const vsoc::CuttlefishConfig& config) {
if (config.restart_subprocesses()) {
- return cvd::ProcessMonitor::RestartOnExitCb;
+ return cuttlefish::ProcessMonitor::RestartOnExitCb;
} else {
- return cvd::ProcessMonitor::DoNotMonitorCb;
+ return cuttlefish::ProcessMonitor::DoNotMonitorCb;
}
}
-cvd::SharedFD CreateUnixInputServer(const std::string& path) {
+cuttlefish::SharedFD CreateUnixInputServer(const std::string& path) {
auto server =
- cvd::SharedFD::SocketLocalServer(path.c_str(), false, SOCK_STREAM, 0666);
+ cuttlefish::SharedFD::SocketLocalServer(path.c_str(), false, SOCK_STREAM, 0666);
if (!server->IsOpen()) {
LOG(ERROR) << "Unable to create unix input server: " << server->StrError();
- return cvd::SharedFD();
+ return cuttlefish::SharedFD();
}
return server;
}
@@ -78,19 +78,19 @@
// Creates the frame and input sockets and add the relevant arguments to the vnc
// server and webrtc commands
StreamerLaunchResult CreateStreamerServers(
- cvd::Command* cmd, const vsoc::CuttlefishConfig& config) {
+ cuttlefish::Command* cmd, const vsoc::CuttlefishConfig& config) {
StreamerLaunchResult server_ret;
- cvd::SharedFD touch_server;
- cvd::SharedFD keyboard_server;
+ cuttlefish::SharedFD touch_server;
+ cuttlefish::SharedFD keyboard_server;
auto instance = config.ForDefaultInstance();
if (config.vm_manager() == vm_manager::QemuManager::name()) {
cmd->AddParameter("-write_virtio_input");
- touch_server = cvd::SharedFD::VsockServer(instance.touch_server_port(),
+ touch_server = cuttlefish::SharedFD::VsockServer(instance.touch_server_port(),
SOCK_STREAM);
keyboard_server =
- cvd::SharedFD::VsockServer(instance.keyboard_server_port(),
+ cuttlefish::SharedFD::VsockServer(instance.keyboard_server_port(),
SOCK_STREAM);
} else {
touch_server = CreateUnixInputServer(instance.touch_socket_path());
@@ -109,12 +109,12 @@
}
cmd->AddParameter("-keyboard_fd=", keyboard_server);
- cvd::SharedFD frames_server;
+ cuttlefish::SharedFD frames_server;
if (config.gpu_mode() == vsoc::kGpuModeDrmVirgl ||
config.gpu_mode() == vsoc::kGpuModeGfxStream) {
frames_server = CreateUnixInputServer(instance.frames_socket_path());
} else {
- frames_server = cvd::SharedFD::VsockServer(instance.frames_server_port(),
+ frames_server = cuttlefish::SharedFD::VsockServer(instance.frames_server_port(),
SOCK_STREAM);
}
if (!frames_server->IsOpen()) {
@@ -128,11 +128,11 @@
} // namespace
bool LogcatReceiverEnabled(const vsoc::CuttlefishConfig& config) {
- return config.logcat_mode() == cvd::kLogcatVsockMode;
+ return config.logcat_mode() == cuttlefish::kLogcatVsockMode;
}
-std::vector<cvd::SharedFD> LaunchKernelLogMonitor(
- const vsoc::CuttlefishConfig& config, cvd::ProcessMonitor* process_monitor,
+std::vector<cuttlefish::SharedFD> LaunchKernelLogMonitor(
+ const vsoc::CuttlefishConfig& config, cuttlefish::ProcessMonitor* process_monitor,
unsigned int number_of_event_pipes) {
auto instance = config.ForDefaultInstance();
auto log_name = instance.kernel_log_pipe_name();
@@ -142,22 +142,22 @@
return {};
}
- cvd::SharedFD pipe;
+ cuttlefish::SharedFD pipe;
// Open the pipe here (from the launcher) to ensure the pipe is not deleted
// due to the usage counters in the kernel reaching zero. If this is not done
// and the kernel_log_monitor crashes for some reason the VMM may get SIGPIPE.
- pipe = cvd::SharedFD::Open(log_name.c_str(), O_RDWR);
- cvd::Command command(config.kernel_log_monitor_binary());
+ pipe = cuttlefish::SharedFD::Open(log_name.c_str(), O_RDWR);
+ cuttlefish::Command command(config.kernel_log_monitor_binary());
command.AddParameter("-log_pipe_fd=", pipe);
- std::vector<cvd::SharedFD> ret;
+ std::vector<cuttlefish::SharedFD> ret;
if (number_of_event_pipes > 0) {
auto param_builder = command.GetParameterBuilder();
param_builder << "-subscriber_fds=";
for (unsigned int i = 0; i < number_of_event_pipes; ++i) {
- cvd::SharedFD event_pipe_write_end, event_pipe_read_end;
- if (!cvd::SharedFD::Pipe(&event_pipe_read_end, &event_pipe_write_end)) {
+ cuttlefish::SharedFD event_pipe_write_end, event_pipe_read_end;
+ if (!cuttlefish::SharedFD::Pipe(&event_pipe_read_end, &event_pipe_write_end)) {
LOG(ERROR) << "Unable to create boot events pipe: " << strerror(errno);
std::exit(RunnerExitCodes::kPipeIOError);
}
@@ -177,19 +177,19 @@
}
void LaunchLogcatReceiverIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor) {
+ cuttlefish::ProcessMonitor* process_monitor) {
if (!LogcatReceiverEnabled(config)) {
return;
}
auto instance = config.ForDefaultInstance();
auto port = instance.logcat_port();
- auto socket = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
+ auto socket = cuttlefish::SharedFD::VsockServer(port, SOCK_STREAM);
if (!socket->IsOpen()) {
LOG(ERROR) << "Unable to create logcat server socket: "
<< socket->StrError();
std::exit(RunnerExitCodes::kLogcatServerError);
}
- cvd::Command cmd(config.logcat_receiver_binary());
+ cuttlefish::Command cmd(config.logcat_receiver_binary());
cmd.AddParameter("-server_fd=", socket);
process_monitor->StartSubprocess(std::move(cmd),
GetOnSubprocessExitCallback(config));
@@ -197,16 +197,16 @@
}
void LaunchConfigServer(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor) {
+ cuttlefish::ProcessMonitor* process_monitor) {
auto instance = config.ForDefaultInstance();
auto port = instance.config_server_port();
- auto socket = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
+ auto socket = cuttlefish::SharedFD::VsockServer(port, SOCK_STREAM);
if (!socket->IsOpen()) {
LOG(ERROR) << "Unable to create configuration server socket: "
<< socket->StrError();
std::exit(RunnerExitCodes::kConfigServerError);
}
- cvd::Command cmd(config.config_server_binary());
+ cuttlefish::Command cmd(config.config_server_binary());
cmd.AddParameter("-server_fd=", socket);
process_monitor->StartSubprocess(std::move(cmd),
GetOnSubprocessExitCallback(config));
@@ -214,14 +214,14 @@
}
void LaunchTombstoneReceiverIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor) {
+ cuttlefish::ProcessMonitor* process_monitor) {
if (!config.enable_tombstone_receiver()) {
return;
}
auto instance = config.ForDefaultInstance();
std::string tombstoneDir = instance.PerInstancePath("tombstones");
- if (!cvd::DirectoryExists(tombstoneDir.c_str())) {
+ if (!cuttlefish::DirectoryExists(tombstoneDir.c_str())) {
LOG(DEBUG) << "Setting up " << tombstoneDir;
if (mkdir(tombstoneDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) <
0) {
@@ -233,14 +233,14 @@
}
auto port = instance.tombstone_receiver_port();
- auto socket = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
+ auto socket = cuttlefish::SharedFD::VsockServer(port, SOCK_STREAM);
if (!socket->IsOpen()) {
LOG(ERROR) << "Unable to create tombstone server socket: "
<< socket->StrError();
std::exit(RunnerExitCodes::kTombstoneServerError);
return;
}
- cvd::Command cmd(config.tombstone_receiver_binary());
+ cuttlefish::Command cmd(config.tombstone_receiver_binary());
cmd.AddParameter("-server_fd=", socket);
cmd.AddParameter("-tombstone_dir=", tombstoneDir);
@@ -250,12 +250,12 @@
}
StreamerLaunchResult LaunchVNCServer(
- const vsoc::CuttlefishConfig& config, cvd::ProcessMonitor* process_monitor,
+ const vsoc::CuttlefishConfig& config, cuttlefish::ProcessMonitor* process_monitor,
std::function<bool(MonitorEntry*)> callback) {
auto instance = config.ForDefaultInstance();
// Launch the vnc server, don't wait for it to complete
auto port_options = "-port=" + std::to_string(instance.vnc_server_port());
- cvd::Command vnc_server(config.vnc_server_binary());
+ cuttlefish::Command vnc_server(config.vnc_server_binary());
vnc_server.AddParameter(port_options);
auto server_ret = CreateStreamerServers(&vnc_server, config);
@@ -265,10 +265,10 @@
return server_ret;
}
-void LaunchAdbConnectorIfEnabled(cvd::ProcessMonitor* process_monitor,
+void LaunchAdbConnectorIfEnabled(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config,
- cvd::SharedFD adbd_events_pipe) {
- cvd::Command adb_connector(config.adb_connector_binary());
+ cuttlefish::SharedFD adbd_events_pipe) {
+ cuttlefish::Command adb_connector(config.adb_connector_binary());
adb_connector.AddParameter("-adbd_events_fd=", adbd_events_pipe);
std::set<std::string> addresses;
@@ -291,10 +291,10 @@
}
}
-StreamerLaunchResult LaunchWebRTC(cvd::ProcessMonitor* process_monitor,
+StreamerLaunchResult LaunchWebRTC(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
if (config.ForDefaultInstance().start_webrtc_sig_server()) {
- cvd::Command sig_server(config.sig_server_binary());
+ cuttlefish::Command sig_server(config.sig_server_binary());
sig_server.AddParameter("-assets_dir=", config.webrtc_assets_dir());
if (!config.webrtc_certs_dir().empty()) {
sig_server.AddParameter("-certs_dir=", config.webrtc_certs_dir());
@@ -312,7 +312,7 @@
// when connecting to the websocket, so it shouldn't be an issue most of the
// time.
- cvd::Command webrtc(config.webrtc_binary());
+ cuttlefish::Command webrtc(config.webrtc_binary());
webrtc.AddParameter("-public_ip=", config.webrtc_public_ip());
auto server_ret = CreateStreamerServers(&webrtc, config);
@@ -330,11 +330,11 @@
return server_ret;
}
-void LaunchSocketVsockProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
+void LaunchSocketVsockProxyIfEnabled(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
auto instance = config.ForDefaultInstance();
if (AdbVsockTunnelEnabled(config)) {
- cvd::Command adb_tunnel(config.socket_vsock_proxy_binary());
+ cuttlefish::Command adb_tunnel(config.socket_vsock_proxy_binary());
adb_tunnel.AddParameter("--server=tcp");
adb_tunnel.AddParameter("--vsock_port=6520");
adb_tunnel.AddParameter(std::string{"--tcp_port="} +
@@ -345,7 +345,7 @@
GetOnSubprocessExitCallback(config));
}
if (AdbVsockHalfTunnelEnabled(config)) {
- cvd::Command adb_tunnel(config.socket_vsock_proxy_binary());
+ cuttlefish::Command adb_tunnel(config.socket_vsock_proxy_binary());
adb_tunnel.AddParameter("--server=tcp");
adb_tunnel.AddParameter("--vsock_port=5555");
adb_tunnel.AddParameter(std::string{"--tcp_port="} +
@@ -357,18 +357,18 @@
}
}
-void LaunchTpmSimulator(cvd::ProcessMonitor* process_monitor,
+void LaunchTpmSimulator(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
auto instance = config.ForDefaultInstance();
auto port = instance.tpm_port();
- auto socket = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
- cvd::Command tpm_command(
+ auto socket = cuttlefish::SharedFD::VsockServer(port, SOCK_STREAM);
+ cuttlefish::Command tpm_command(
vsoc::DefaultHostArtifactsPath("bin/tpm_simulator_manager"));
tpm_command.AddParameter("-port=", port);
process_monitor->StartSubprocess(std::move(tpm_command),
GetOnSubprocessExitCallback(config));
- cvd::Command proxy_command(config.socket_vsock_proxy_binary());
+ cuttlefish::Command proxy_command(config.socket_vsock_proxy_binary());
proxy_command.AddParameter("--server=vsock");
proxy_command.AddParameter("--tcp_port=", port);
proxy_command.AddParameter("--vsock_port=", port);
@@ -376,23 +376,23 @@
GetOnSubprocessExitCallback(config));
}
-void LaunchMetrics(cvd::ProcessMonitor* process_monitor,
+void LaunchMetrics(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
- cvd::Command metrics(config.metrics_binary());
+ cuttlefish::Command metrics(config.metrics_binary());
process_monitor->StartSubprocess(std::move(metrics),
GetOnSubprocessExitCallback(config));
}
-void LaunchTpmPassthrough(cvd::ProcessMonitor* process_monitor,
+void LaunchTpmPassthrough(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
- auto server = cvd::SharedFD::VsockServer(SOCK_STREAM);
+ auto server = cuttlefish::SharedFD::VsockServer(SOCK_STREAM);
if (!server->IsOpen()) {
LOG(ERROR) << "Unable to create tpm passthrough server: "
<< server->StrError();
std::exit(RunnerExitCodes::kTpmPassthroughError);
}
- cvd::Command tpm_command(
+ cuttlefish::Command tpm_command(
vsoc::DefaultHostArtifactsPath("bin/vtpm_passthrough"));
tpm_command.AddParameter("-server_fd=", server);
tpm_command.AddParameter("-device=", config.tpm_device());
@@ -401,7 +401,7 @@
GetOnSubprocessExitCallback(config));
}
-void LaunchTpm(cvd::ProcessMonitor* process_monitor,
+void LaunchTpm(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
if (config.tpm_device() != "") {
if (config.tpm_binary() != "") {
@@ -414,31 +414,31 @@
}
}
-void LaunchSecureEnvironment(cvd::ProcessMonitor* process_monitor,
+void LaunchSecureEnvironment(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config) {
auto port = config.ForDefaultInstance().keymaster_vsock_port();
- auto server = cvd::SharedFD::VsockServer(port, SOCK_STREAM);
- cvd::Command command(vsoc::DefaultHostArtifactsPath("bin/secure_env"));
+ auto server = cuttlefish::SharedFD::VsockServer(port, SOCK_STREAM);
+ cuttlefish::Command command(vsoc::DefaultHostArtifactsPath("bin/secure_env"));
command.AddParameter("-keymaster_fd=", server);
process_monitor->StartSubprocess(std::move(command),
GetOnSubprocessExitCallback(config));
}
void LaunchVerhicleHalServerIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor) {
+ cuttlefish::ProcessMonitor* process_monitor) {
if (!config.enable_vehicle_hal_grpc_server()) {
return;
}
- cvd::Command grpc_server(config.vehicle_hal_grpc_server_binary());
+ cuttlefish::Command grpc_server(config.vehicle_hal_grpc_server_binary());
auto instance = config.ForDefaultInstance();
const unsigned vhal_server_cid = 2;
const unsigned vhal_server_port = instance.vehicle_hal_server_port();
const std::string vhal_server_power_state_file =
- cvd::AbsolutePath(instance.PerInstancePath("power_state"));
+ cuttlefish::AbsolutePath(instance.PerInstancePath("power_state"));
const std::string vhal_server_power_state_socket =
- cvd::AbsolutePath(instance.PerInstancePath("power_state_socket"));
+ cuttlefish::AbsolutePath(instance.PerInstancePath("power_state_socket"));
grpc_server.AddParameter("--server_cid=", vhal_server_cid);
grpc_server.AddParameter("--server_port=", vhal_server_port);
diff --git a/host/commands/run_cvd/launch.h b/host/commands/run_cvd/launch.h
index 9dc6aae..e5fca9b 100644
--- a/host/commands/run_cvd/launch.h
+++ b/host/commands/run_cvd/launch.h
@@ -9,14 +9,14 @@
#include "host/commands/run_cvd/process_monitor.h"
#include "host/libs/config/cuttlefish_config.h"
-std::vector <cvd::SharedFD> LaunchKernelLogMonitor(
+std::vector <cuttlefish::SharedFD> LaunchKernelLogMonitor(
const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor,
+ cuttlefish::ProcessMonitor* process_monitor,
unsigned int number_of_event_pipes);
-void LaunchAdbConnectorIfEnabled(cvd::ProcessMonitor* process_monitor,
+void LaunchAdbConnectorIfEnabled(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config,
- cvd::SharedFD adbd_events_pipe);
-void LaunchSocketVsockProxyIfEnabled(cvd::ProcessMonitor* process_monitor,
+ cuttlefish::SharedFD adbd_events_pipe);
+void LaunchSocketVsockProxyIfEnabled(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config);
struct StreamerLaunchResult {
@@ -24,27 +24,27 @@
};
StreamerLaunchResult LaunchVNCServer(
const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor,
- std::function<bool(cvd::MonitorEntry*)> callback);
+ cuttlefish::ProcessMonitor* process_monitor,
+ std::function<bool(cuttlefish::MonitorEntry*)> callback);
void LaunchTombstoneReceiverIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor);
+ cuttlefish::ProcessMonitor* process_monitor);
void LaunchLogcatReceiverIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor);
+ cuttlefish::ProcessMonitor* process_monitor);
void LaunchConfigServer(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor);
+ cuttlefish::ProcessMonitor* process_monitor);
-StreamerLaunchResult LaunchWebRTC(cvd::ProcessMonitor* process_monitor,
+StreamerLaunchResult LaunchWebRTC(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config);
-void LaunchTpm(cvd::ProcessMonitor* process_monitor,
+void LaunchTpm(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config);
-void LaunchMetrics(cvd::ProcessMonitor* process_monitor,
+void LaunchMetrics(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config);
-void LaunchSecureEnvironment(cvd::ProcessMonitor* process_monitor,
+void LaunchSecureEnvironment(cuttlefish::ProcessMonitor* process_monitor,
const vsoc::CuttlefishConfig& config);
void LaunchVerhicleHalServerIfEnabled(const vsoc::CuttlefishConfig& config,
- cvd::ProcessMonitor* process_monitor);
+ cuttlefish::ProcessMonitor* process_monitor);
diff --git a/host/commands/run_cvd/main.cc b/host/commands/run_cvd/main.cc
index 0e53c39..b55b3e3 100644
--- a/host/commands/run_cvd/main.cc
+++ b/host/commands/run_cvd/main.cc
@@ -59,16 +59,16 @@
#include "host/libs/vm_manager/qemu_manager.h"
using vsoc::ForCurrentInstance;
-using cvd::RunnerExitCodes;
+using cuttlefish::RunnerExitCodes;
namespace {
-cvd::OnSocketReadyCb GetOnSubprocessExitCallback(
+cuttlefish::OnSocketReadyCb GetOnSubprocessExitCallback(
const vsoc::CuttlefishConfig& config) {
if (config.restart_subprocesses()) {
- return cvd::ProcessMonitor::RestartOnExitCb;
+ return cuttlefish::ProcessMonitor::RestartOnExitCb;
} else {
- return cvd::ProcessMonitor::DoNotMonitorCb;
+ return cuttlefish::ProcessMonitor::DoNotMonitorCb;
}
}
@@ -77,11 +77,11 @@
// launcher process
class CvdBootStateMachine {
public:
- CvdBootStateMachine(cvd::SharedFD fg_launcher_pipe)
+ CvdBootStateMachine(cuttlefish::SharedFD fg_launcher_pipe)
: fg_launcher_pipe_(fg_launcher_pipe), state_(kBootStarted) {}
// Returns true if the machine is left in a final state
- bool OnBootEvtReceived(cvd::SharedFD boot_events_pipe) {
+ bool OnBootEvtReceived(cuttlefish::SharedFD boot_events_pipe) {
monitor::BootEvent evt;
auto bytes_read = boot_events_pipe->Read(&evt, sizeof(evt));
if (bytes_read != sizeof(evt)) {
@@ -108,7 +108,7 @@
}
private:
- void SendExitCode(cvd::RunnerExitCodes exit_code) {
+ void SendExitCode(cuttlefish::RunnerExitCodes exit_code) {
fg_launcher_pipe_->Write(&exit_code, sizeof(exit_code));
// The foreground process will exit after receiving the exit code, if we try
// to write again we'll get a SIGPIPE
@@ -117,9 +117,9 @@
bool MaybeWriteToForegroundLauncher() {
if (fg_launcher_pipe_->IsOpen()) {
if (BootCompleted()) {
- SendExitCode(cvd::RunnerExitCodes::kSuccess);
+ SendExitCode(cuttlefish::RunnerExitCodes::kSuccess);
} else if (state_ & kGuestBootFailed) {
- SendExitCode(cvd::RunnerExitCodes::kVirtualDeviceBootFailed);
+ SendExitCode(cuttlefish::RunnerExitCodes::kVirtualDeviceBootFailed);
} else {
// No final state was reached
return false;
@@ -130,7 +130,7 @@
return true;
}
- cvd::SharedFD fg_launcher_pipe_;
+ cuttlefish::SharedFD fg_launcher_pipe_;
int state_;
static const int kBootStarted = 0;
static const int kGuestBootCompleted = 1 << 0;
@@ -139,21 +139,21 @@
// Abuse the process monitor to make it call us back when boot events are ready
void SetUpHandlingOfBootEvents(
- cvd::ProcessMonitor* process_monitor, cvd::SharedFD boot_events_pipe,
+ cuttlefish::ProcessMonitor* process_monitor, cuttlefish::SharedFD boot_events_pipe,
std::shared_ptr<CvdBootStateMachine> state_machine) {
process_monitor->MonitorExistingSubprocess(
// A dummy command, so logs are desciptive
- cvd::Command("boot_events_listener"),
+ cuttlefish::Command("boot_events_listener"),
// A dummy subprocess, with the boot events pipe as control socket
- cvd::Subprocess(-1, boot_events_pipe),
- [boot_events_pipe, state_machine](cvd::MonitorEntry*) {
+ cuttlefish::Subprocess(-1, boot_events_pipe),
+ [boot_events_pipe, state_machine](cuttlefish::MonitorEntry*) {
auto sent_code = state_machine->OnBootEvtReceived(boot_events_pipe);
return !sent_code;
});
}
bool WriteCuttlefishEnvironment(const vsoc::CuttlefishConfig& config) {
- auto env = cvd::SharedFD::Open(config.cuttlefish_env_path().c_str(),
+ auto env = cuttlefish::SharedFD::Open(config.cuttlefish_env_path().c_str(),
O_CREAT | O_RDWR, 0755);
if (!env->IsOpen()) {
LOG(ERROR) << "Unable to create cuttlefish.env file";
@@ -169,12 +169,12 @@
// Forks and returns the write end of a pipe to the child process. The parent
// process waits for boot events to come through the pipe and exits accordingly.
-cvd::SharedFD DaemonizeLauncher(const vsoc::CuttlefishConfig& config) {
+cuttlefish::SharedFD DaemonizeLauncher(const vsoc::CuttlefishConfig& config) {
auto instance = config.ForDefaultInstance();
- cvd::SharedFD read_end, write_end;
- if (!cvd::SharedFD::Pipe(&read_end, &write_end)) {
+ cuttlefish::SharedFD read_end, write_end;
+ if (!cuttlefish::SharedFD::Pipe(&read_end, &write_end)) {
LOG(ERROR) << "Unable to create pipe";
- return cvd::SharedFD(); // a closed FD
+ return cuttlefish::SharedFD(); // a closed FD
}
auto pid = fork();
if (pid) {
@@ -209,16 +209,16 @@
// Redirect standard I/O
auto log_path = instance.launcher_log_path();
auto log =
- cvd::SharedFD::Open(log_path.c_str(), O_CREAT | O_WRONLY | O_APPEND,
+ cuttlefish::SharedFD::Open(log_path.c_str(), O_CREAT | O_WRONLY | O_APPEND,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
if (!log->IsOpen()) {
LOG(ERROR) << "Failed to create launcher log file: " << log->StrError();
std::exit(RunnerExitCodes::kDaemonizationError);
}
- ::android::base::SetLogger(cvd::TeeLogger({
- {cvd::LogFileSeverity(), log},
+ ::android::base::SetLogger(cuttlefish::TeeLogger({
+ {cuttlefish::LogFileSeverity(), log},
}));
- auto dev_null = cvd::SharedFD::Open("/dev/null", O_RDONLY);
+ auto dev_null = cuttlefish::SharedFD::Open("/dev/null", O_RDONLY);
if (!dev_null->IsOpen()) {
LOG(ERROR) << "Failed to open /dev/null: " << dev_null->StrError();
std::exit(RunnerExitCodes::kDaemonizationError);
@@ -241,34 +241,34 @@
}
}
-void ServerLoop(cvd::SharedFD server,
- cvd::ProcessMonitor* process_monitor) {
+void ServerLoop(cuttlefish::SharedFD server,
+ cuttlefish::ProcessMonitor* process_monitor) {
while (true) {
// TODO: use select to handle simultaneous connections.
- auto client = cvd::SharedFD::Accept(*server);
- cvd::LauncherAction action;
+ auto client = cuttlefish::SharedFD::Accept(*server);
+ cuttlefish::LauncherAction action;
while (client->IsOpen() && client->Read(&action, sizeof(action)) > 0) {
switch (action) {
- case cvd::LauncherAction::kStop:
+ case cuttlefish::LauncherAction::kStop:
if (process_monitor->StopMonitoredProcesses()) {
- auto response = cvd::LauncherResponse::kSuccess;
+ auto response = cuttlefish::LauncherResponse::kSuccess;
client->Write(&response, sizeof(response));
std::exit(0);
} else {
- auto response = cvd::LauncherResponse::kError;
+ auto response = cuttlefish::LauncherResponse::kError;
client->Write(&response, sizeof(response));
}
break;
- case cvd::LauncherAction::kStatus: {
+ case cuttlefish::LauncherAction::kStatus: {
// TODO(schuffelen): Return more information on a side channel
- auto response = cvd::LauncherResponse::kSuccess;
+ auto response = cuttlefish::LauncherResponse::kSuccess;
client->Write(&response, sizeof(response));
break;
}
default:
LOG(ERROR) << "Unrecognized launcher action: "
<< static_cast<char>(action);
- auto response = cvd::LauncherResponse::kError;
+ auto response = cuttlefish::LauncherResponse::kError;
client->Write(&response, sizeof(response));
}
}
@@ -290,20 +290,20 @@
if (isatty(0)) {
LOG(FATAL) << "stdin was a tty, expected to be passed the output of a previous stage. "
<< "Did you mean to run launch_cvd?";
- return cvd::RunnerExitCodes::kInvalidHostConfiguration;
+ return cuttlefish::RunnerExitCodes::kInvalidHostConfiguration;
} else {
int error_num = errno;
if (error_num == EBADF) {
LOG(FATAL) << "stdin was not a valid file descriptor, expected to be passed the output "
<< "of assemble_cvd. Did you mean to run launch_cvd?";
- return cvd::RunnerExitCodes::kInvalidHostConfiguration;
+ return cuttlefish::RunnerExitCodes::kInvalidHostConfiguration;
}
}
std::string input_files_str;
{
- auto input_fd = cvd::SharedFD::Dup(0);
- auto bytes_read = cvd::ReadAll(input_fd, &input_files_str);
+ auto input_fd = cuttlefish::SharedFD::Dup(0);
+ auto bytes_read = cuttlefish::ReadAll(input_fd, &input_files_str);
if (bytes_read < 0) {
LOG(FATAL) << "Failed to read input files. Error was \"" << input_fd->StrError() << "\"";
}
@@ -327,10 +327,10 @@
{
std::ofstream launcher_log_ofstream(log_path.c_str());
- auto assemble_log = cvd::ReadFile(config->AssemblyPath("assemble_cvd.log"));
+ auto assemble_log = cuttlefish::ReadFile(config->AssemblyPath("assemble_cvd.log"));
launcher_log_ofstream << assemble_log;
}
- ::android::base::SetLogger(cvd::LogToStderrAndFiles({log_path}));
+ ::android::base::SetLogger(cuttlefish::LogToStderrAndFiles({log_path}));
// Change working directory to the instance directory as early as possible to
// ensure all host processes have the same working dir. This helps stop_cvd
@@ -344,7 +344,7 @@
return RunnerExitCodes::kInstanceDirCreationError;
}
- auto used_tap_devices = cvd::TapInterfacesInUse();
+ auto used_tap_devices = cuttlefish::TapInterfacesInUse();
if (used_tap_devices.count(instance.wifi_tap_name())) {
LOG(ERROR) << "Wifi TAP device already in use";
return RunnerExitCodes::kTapDeviceInUse;
@@ -384,14 +384,14 @@
<< instance.console_path();
auto launcher_monitor_path = instance.launcher_monitor_socket_path();
- auto launcher_monitor_socket = cvd::SharedFD::SocketLocalServer(
+ auto launcher_monitor_socket = cuttlefish::SharedFD::SocketLocalServer(
launcher_monitor_path.c_str(), false, SOCK_STREAM, 0666);
if (!launcher_monitor_socket->IsOpen()) {
LOG(ERROR) << "Error when opening launcher server: "
<< launcher_monitor_socket->StrError();
- return cvd::RunnerExitCodes::kMonitorCreationFailed;
+ return cuttlefish::RunnerExitCodes::kMonitorCreationFailed;
}
- cvd::SharedFD foreground_launcher_pipe;
+ cuttlefish::SharedFD foreground_launcher_pipe;
if (config->run_as_daemon()) {
foreground_launcher_pipe = DaemonizeLauncher(*config);
if (!foreground_launcher_pipe->IsOpen()) {
@@ -413,7 +413,7 @@
std::make_shared<CvdBootStateMachine>(foreground_launcher_pipe);
// Monitor and restart host processes supporting the CVD
- cvd::ProcessMonitor process_monitor;
+ cuttlefish::ProcessMonitor process_monitor;
if (config->enable_metrics() == vsoc::CuttlefishConfig::kYes) {
LaunchMetrics(&process_monitor, *config);
@@ -421,8 +421,8 @@
auto event_pipes =
LaunchKernelLogMonitor(*config, &process_monitor, 2);
- cvd::SharedFD boot_events_pipe = event_pipes[0];
- cvd::SharedFD adbd_events_pipe = event_pipes[1];
+ cuttlefish::SharedFD boot_events_pipe = event_pipes[0];
+ cuttlefish::SharedFD adbd_events_pipe = event_pipes[1];
event_pipes.clear();
SetUpHandlingOfBootEvents(&process_monitor, boot_events_pipe,
@@ -463,5 +463,5 @@
ServerLoop(launcher_monitor_socket, &process_monitor); // Should not return
LOG(ERROR) << "The server loop returned, it should never happen!!";
- return cvd::RunnerExitCodes::kServerError;
+ return cuttlefish::RunnerExitCodes::kServerError;
}
diff --git a/host/commands/run_cvd/process_monitor.cc b/host/commands/run_cvd/process_monitor.cc
index 938c48e..a3c4298 100644
--- a/host/commands/run_cvd/process_monitor.cc
+++ b/host/commands/run_cvd/process_monitor.cc
@@ -29,7 +29,7 @@
#include "common/libs/fs/shared_select.h"
#include "host/commands/run_cvd/process_monitor.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -68,7 +68,7 @@
}
void ProcessMonitor::StartSubprocess(Command cmd, OnSocketReadyCb callback) {
- cvd::SubprocessOptions options;
+ cuttlefish::SubprocessOptions options;
options.InGroup(true);
options.WithControlSocket(true);
auto proc = cmd.Start(options);
@@ -154,7 +154,7 @@
LOG(INFO) << "subprocess " << entry->cmd->GetShortName() << " (" << wait_ret
<< ") has exited for unknown reasons";
}
- cvd::SubprocessOptions options;
+ cuttlefish::SubprocessOptions options;
options.WithControlSocket(true);
entry->proc.reset(new Subprocess(entry->cmd->Start(options)));
return true;
@@ -182,7 +182,7 @@
// We can't call select while holding the lock as it would lead to a
// deadlock (restarter thread waiting for notifications from main thread,
// main thread waiting for the lock)
- int num_fds = cvd::Select(&read_set, nullptr, nullptr, nullptr);
+ int num_fds = cuttlefish::Select(&read_set, nullptr, nullptr, nullptr);
if (num_fds < 0) {
LOG(ERROR) << "Select call returned error on restarter thread: "
<< strerror(errno);
@@ -217,4 +217,4 @@
} while (true);
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/run_cvd/process_monitor.h b/host/commands/run_cvd/process_monitor.h
index 5683c61..2441860 100644
--- a/host/commands/run_cvd/process_monitor.h
+++ b/host/commands/run_cvd/process_monitor.h
@@ -22,7 +22,7 @@
#include <common/libs/utils/subprocess.h>
-namespace cvd {
+namespace cuttlefish {
struct MonitorEntry;
using OnSocketReadyCb = std::function<bool(MonitorEntry*)>;
@@ -57,9 +57,9 @@
std::vector<MonitorEntry> monitored_processes_;
// Used for communication with the restarter thread
- cvd::SharedFD thread_comm_main_, thread_comm_monitor_;
+ cuttlefish::SharedFD thread_comm_main_, thread_comm_monitor_;
std::thread monitor_thread_;
// Protects access to the monitored_processes_
std::mutex processes_mutex_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/run_cvd/runner_defs.h b/host/commands/run_cvd/runner_defs.h
index 6ee1460..efcb560 100644
--- a/host/commands/run_cvd/runner_defs.h
+++ b/host/commands/run_cvd/runner_defs.h
@@ -15,7 +15,7 @@
*/
#pragma once
-namespace cvd {
+namespace cuttlefish {
enum RunnerExitCodes : int {
kSuccess = 0,
@@ -57,4 +57,4 @@
kError = 'E',
kUnknownAction = 'U',
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/commands/secure_env/keymaster_responder.cpp b/host/commands/secure_env/keymaster_responder.cpp
index fed9ab9..5bfb358 100644
--- a/host/commands/secure_env/keymaster_responder.cpp
+++ b/host/commands/secure_env/keymaster_responder.cpp
@@ -19,7 +19,7 @@
#include <keymaster/android_keymaster_messages.h>
KeymasterResponder::KeymasterResponder(
- cvd::KeymasterChannel* channel, keymaster::AndroidKeymaster* keymaster)
+ cuttlefish::KeymasterChannel* channel, keymaster::AndroidKeymaster* keymaster)
: channel_(channel), keymaster_(keymaster) {
}
diff --git a/host/commands/secure_env/keymaster_responder.h b/host/commands/secure_env/keymaster_responder.h
index b30c6a4..1fc662e 100644
--- a/host/commands/secure_env/keymaster_responder.h
+++ b/host/commands/secure_env/keymaster_responder.h
@@ -21,10 +21,10 @@
class KeymasterResponder {
private:
- cvd::KeymasterChannel* channel_;
+ cuttlefish::KeymasterChannel* channel_;
keymaster::AndroidKeymaster* keymaster_;
public:
- KeymasterResponder(cvd::KeymasterChannel* channel,
+ KeymasterResponder(cuttlefish::KeymasterChannel* channel,
keymaster::AndroidKeymaster* keymaster);
bool ProcessMessage();
diff --git a/host/commands/secure_env/secure_env.cpp b/host/commands/secure_env/secure_env.cpp
index 1db8144..2e5dec9 100644
--- a/host/commands/secure_env/secure_env.cpp
+++ b/host/commands/secure_env/secure_env.cpp
@@ -29,7 +29,7 @@
DEFINE_int32(keymaster_fd, -1, "A file descriptor for keymaster communication");
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
keymaster::PureSoftKeymasterContext keymaster_context{
KM_SECURITY_LEVEL_SOFTWARE};
@@ -37,12 +37,12 @@
CHECK(FLAGS_keymaster_fd != -1)
<< "TODO(schuffelen): Add keymaster_fd alternative";
- auto server = cvd::SharedFD::Dup(FLAGS_keymaster_fd);
+ auto server = cuttlefish::SharedFD::Dup(FLAGS_keymaster_fd);
CHECK(server->IsOpen()) << "Could not dup server fd: " << server->StrError();
close(FLAGS_keymaster_fd);
- auto conn = cvd::SharedFD::Accept(*server);
+ auto conn = cuttlefish::SharedFD::Accept(*server);
CHECK(conn->IsOpen()) << "Unable to open connection: " << conn->StrError();
- cvd::KeymasterChannel keymaster_channel(conn);
+ cuttlefish::KeymasterChannel keymaster_channel(conn);
KeymasterResponder keymaster_responder(&keymaster_channel, &keymaster);
diff --git a/host/commands/stop_cvd/main.cc b/host/commands/stop_cvd/main.cc
index 5736561..ad0b524 100644
--- a/host/commands/stop_cvd/main.cc
+++ b/host/commands/stop_cvd/main.cc
@@ -55,7 +55,7 @@
std::set<std::string> FallbackPaths() {
std::set<std::string> paths;
- std::string parent_path = cvd::StringFromEnv("HOME", ".");
+ std::string parent_path = cuttlefish::StringFromEnv("HOME", ".");
paths.insert(parent_path + "/cuttlefish_assembly");
paths.insert(parent_path + "/cuttlefish_assembly/*");
@@ -144,14 +144,14 @@
LOG(ERROR) << "No path to launcher monitor found";
return false;
}
- auto monitor_socket = cvd::SharedFD::SocketLocalClient(monitor_path.c_str(),
+ auto monitor_socket = cuttlefish::SharedFD::SocketLocalClient(monitor_path.c_str(),
false, SOCK_STREAM);
if (!monitor_socket->IsOpen()) {
LOG(ERROR) << "Unable to connect to launcher monitor at " << monitor_path
<< ": " << monitor_socket->StrError();
return false;
}
- auto request = cvd::LauncherAction::kStop;
+ auto request = cuttlefish::LauncherAction::kStop;
auto bytes_sent = monitor_socket->Send(&request, sizeof(request), 0);
if (bytes_sent < 0) {
LOG(ERROR) << "Error sending launcher monitor the stop command: "
@@ -159,10 +159,10 @@
return false;
}
// Perform a select with a timeout to guard against launcher hanging
- cvd::SharedFDSet read_set;
+ cuttlefish::SharedFDSet read_set;
read_set.Set(monitor_socket);
struct timeval timeout = {FLAGS_wait_for_launcher, 0};
- int selected = cvd::Select(&read_set, nullptr, nullptr,
+ int selected = cuttlefish::Select(&read_set, nullptr, nullptr,
FLAGS_wait_for_launcher <= 0 ? nullptr : &timeout);
if (selected < 0){
LOG(ERROR) << "Failed communication with the launcher monitor: "
@@ -173,14 +173,14 @@
LOG(ERROR) << "Timeout expired waiting for launcher monitor to respond";
return false;
}
- cvd::LauncherResponse response;
+ cuttlefish::LauncherResponse response;
auto bytes_recv = monitor_socket->Recv(&response, sizeof(response), 0);
if (bytes_recv < 0) {
LOG(ERROR) << "Error receiving response from launcher monitor: "
<< monitor_socket->StrError();
return false;
}
- if (response != cvd::LauncherResponse::kSuccess) {
+ if (response != cuttlefish::LauncherResponse::kSuccess) {
LOG(ERROR) << "Received '" << static_cast<char>(response)
<< "' response from launcher monitor";
return false;
diff --git a/host/commands/tombstone_receiver/main.cpp b/host/commands/tombstone_receiver/main.cpp
index e6c8fe1..2e0ea69 100644
--- a/host/commands/tombstone_receiver/main.cpp
+++ b/host/commands/tombstone_receiver/main.cpp
@@ -56,10 +56,10 @@
#define CHUNK_RECV_MAX_LEN (1024)
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
- cvd::SharedFD server_fd = cvd::SharedFD::Dup(FLAGS_server_fd);
+ cuttlefish::SharedFD server_fd = cuttlefish::SharedFD::Dup(FLAGS_server_fd);
close(FLAGS_server_fd);
CHECK(server_fd->IsOpen()) << "Error inheriting tombstone server: "
@@ -69,7 +69,7 @@
// Server loop
while (true) {
- auto conn = cvd::SharedFD::Accept(*server_fd);
+ auto conn = cuttlefish::SharedFD::Accept(*server_fd);
std::ofstream file(next_tombstone_path(),
std::ofstream::out | std::ofstream::binary);
diff --git a/host/commands/tpm_simulator_manager/tpm_simulator_manager.cpp b/host/commands/tpm_simulator_manager/tpm_simulator_manager.cpp
index 2c946e7..238b092 100644
--- a/host/commands/tpm_simulator_manager/tpm_simulator_manager.cpp
+++ b/host/commands/tpm_simulator_manager/tpm_simulator_manager.cpp
@@ -43,7 +43,7 @@
} // namespace
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
CHECK(FLAGS_port > 0) << "A port must be set";
@@ -51,15 +51,15 @@
CHECK(config) << "Unable to get config object";
// Assumes linked on the host with glibc
- cvd::Command simulator_cmd("/usr/bin/stdbuf");
+ cuttlefish::Command simulator_cmd("/usr/bin/stdbuf");
simulator_cmd.AddParameter("-oL");
simulator_cmd.AddParameter(config->tpm_binary());
simulator_cmd.AddParameter(FLAGS_port);
- cvd::SharedFD sim_stdout_in, sim_stdout_out;
- CHECK(cvd::SharedFD::Pipe(&sim_stdout_out, &sim_stdout_in))
+ cuttlefish::SharedFD sim_stdout_in, sim_stdout_out;
+ CHECK(cuttlefish::SharedFD::Pipe(&sim_stdout_out, &sim_stdout_in))
<< "Unable to open pipe for stdout: " << strerror(errno);
- simulator_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut, sim_stdout_in);
+ simulator_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut, sim_stdout_in);
auto tpm_subprocess = simulator_cmd.Start();
@@ -73,7 +73,7 @@
bool platform_server = false;
bool sent_init = false;
- cvd::SharedFD client; // Hold this connection open for the process lifetime.
+ cuttlefish::SharedFD client; // Hold this connection open for the process lifetime.
char* lineptr = nullptr;
size_t size = 0;
@@ -87,18 +87,18 @@
platform_server = true;
}
if (command_server && platform_server && !sent_init) {
- client = cvd::SharedFD::SocketLocalClient(FLAGS_port + 1, SOCK_STREAM);
+ client = cuttlefish::SharedFD::SocketLocalClient(FLAGS_port + 1, SOCK_STREAM);
std::uint32_t command = htobe32(1); // TPM_SIGNAL_POWER_ON
- CHECK(cvd::WriteAllBinary(client, &command) == 4)
+ CHECK(cuttlefish::WriteAllBinary(client, &command) == 4)
<< "Could not send TPM_SIGNAL_POWER_ON";
std::uint32_t response;
- CHECK(cvd::ReadExactBinary(client, &response) == 4)
+ CHECK(cuttlefish::ReadExactBinary(client, &response) == 4)
<< "Could not read parity response";
command = htobe32(11); // TPM_SIGNAL_NV_ON
- CHECK(cvd::WriteAllBinary(client, &command) == 4)
+ CHECK(cuttlefish::WriteAllBinary(client, &command) == 4)
<< "Could not send TPM_SIGNAL_NV_ON";
- CHECK(cvd::ReadExactBinary(client, &response) == 4)
+ CHECK(cuttlefish::ReadExactBinary(client, &response) == 4)
<< "Could not read parity response";
sent_init = true;
diff --git a/host/commands/vtpm_passthrough/vtpm_passthrough.cpp b/host/commands/vtpm_passthrough/vtpm_passthrough.cpp
index d3bd12d..2084987 100644
--- a/host/commands/vtpm_passthrough/vtpm_passthrough.cpp
+++ b/host/commands/vtpm_passthrough/vtpm_passthrough.cpp
@@ -31,36 +31,36 @@
namespace {
-void HandleClient(cvd::SharedFD client, cvd::SharedFD device) {
+void HandleClient(cuttlefish::SharedFD client, cuttlefish::SharedFD device) {
while (true) {
// TPM2 simulator command protocol.
std::vector<char> command_bytes(4, 0);
- CHECK(cvd::ReadExact(client, &command_bytes) == 4) << "Could not receive TPM_SEND_COMMAND";
+ CHECK(cuttlefish::ReadExact(client, &command_bytes) == 4) << "Could not receive TPM_SEND_COMMAND";
std::uint32_t command_received =
betoh32(*reinterpret_cast<std::uint32_t*>(command_bytes.data()));
CHECK(command_received == 8)
<< "Command received was not TPM_SEND_COMMAND, instead got " << command_received;
std::vector<char> locality {0};
- CHECK(cvd::ReadExact(client, &locality) == 1) << "Could not receive locality";
+ CHECK(cuttlefish::ReadExact(client, &locality) == 1) << "Could not receive locality";
std::vector<char> length_bytes(4, 0);
- CHECK(cvd::ReadExact(client, &length_bytes) == 4) << "Could not receive command length";
+ CHECK(cuttlefish::ReadExact(client, &length_bytes) == 4) << "Could not receive command length";
std::vector<char> command(betoh32(*reinterpret_cast<std::uint32_t*>(length_bytes.data())), 0);
- CHECK(cvd::ReadExact(client, &command) == command.size()) << "Could not read TPM message";
+ CHECK(cuttlefish::ReadExact(client, &command) == command.size()) << "Could not read TPM message";
CHECK(device->Write(command.data(), command.size()) == command.size())
<< "Could not write TPM command to host device: " << device->StrError();
std::string tpm_response;
- CHECK(cvd::ReadAll(device, &tpm_response) >= 0)
+ CHECK(cuttlefish::ReadAll(device, &tpm_response) >= 0)
<< "host TPM gave an IO error: " << device->StrError();
*reinterpret_cast<std::uint32_t*>(length_bytes.data()) = htobe32(tpm_response.size());
- CHECK(cvd::WriteAll(client, length_bytes) == 4)
+ CHECK(cuttlefish::WriteAll(client, length_bytes) == 4)
<< "Could not send response length: " << client->StrError();
- CHECK(cvd::WriteAll(client, tpm_response) == tpm_response.size())
+ CHECK(cuttlefish::WriteAll(client, tpm_response) == tpm_response.size())
<< "Could not send response message: " << client->StrError();
std::vector<char> parity = {0, 0, 0, 0};
- CHECK(cvd::WriteAll(client, parity) == 4)
+ CHECK(cuttlefish::WriteAll(client, parity) == 4)
<< "Could not send parity bytes: " << client->StrError();
}
}
@@ -68,21 +68,21 @@
} // namespace
int main(int argc, char** argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
CHECK(!FLAGS_device.empty()) << "A device must be set.";
CHECK(FLAGS_server_fd > -1) << "A server fd must be given.";
- auto server = cvd::SharedFD::Dup(FLAGS_server_fd);
+ auto server = cuttlefish::SharedFD::Dup(FLAGS_server_fd);
close(FLAGS_server_fd);
CHECK(server->IsOpen()) << "Could not dup vsock server fd: " << server->StrError();
- auto device = cvd::SharedFD::Open(FLAGS_device.c_str(), O_RDWR);
+ auto device = cuttlefish::SharedFD::Open(FLAGS_device.c_str(), O_RDWR);
CHECK(device->IsOpen()) << "Could not open " << FLAGS_device << ": " << device->StrError();
while (true) {
- auto client = cvd::SharedFD::Accept(*server);
+ auto client = cuttlefish::SharedFD::Accept(*server);
CHECK(client->IsOpen()) << "Could not accept TPM client: " << client->StrError();
HandleClient(client, device);
}
diff --git a/host/frontend/adb_connector/adb_connection_maintainer.cpp b/host/frontend/adb_connector/adb_connection_maintainer.cpp
index 317a49b..f1a029c 100644
--- a/host/frontend/adb_connector/adb_connection_maintainer.cpp
+++ b/host/frontend/adb_connector/adb_connection_maintainer.cpp
@@ -53,7 +53,7 @@
}
// returns true if successfully sent the whole message
-bool SendAll(cvd::SharedFD sock, const std::string& msg) {
+bool SendAll(cuttlefish::SharedFD sock, const std::string& msg) {
ssize_t total_written{};
while (total_written < static_cast<ssize_t>(msg.size())) {
if (!sock->IsOpen()) {
@@ -69,7 +69,7 @@
return true;
}
-std::string RecvAll(cvd::SharedFD sock, const size_t count) {
+std::string RecvAll(cuttlefish::SharedFD sock, const size_t count) {
size_t total_read{};
std::unique_ptr<char[]> data(new char[count]);
while (total_read < count) {
@@ -93,7 +93,7 @@
constexpr int kAdbDaemonPort = 5037;
-bool AdbSendMessage(cvd::SharedFD sock, const std::string& message) {
+bool AdbSendMessage(cuttlefish::SharedFD sock, const std::string& message) {
if (!sock->IsOpen()) {
return false;
}
@@ -105,7 +105,7 @@
}
bool AdbSendMessage(const std::string& message) {
- auto sock = cvd::SharedFD::SocketLocalClient(kAdbDaemonPort, SOCK_STREAM);
+ auto sock = cuttlefish::SharedFD::SocketLocalClient(kAdbDaemonPort, SOCK_STREAM);
return AdbSendMessage(sock, message);
}
@@ -123,7 +123,7 @@
}
// assumes the OKAY/FAIL status has already been read
-std::string RecvAdbResponse(cvd::SharedFD sock) {
+std::string RecvAdbResponse(cuttlefish::SharedFD sock) {
auto length_as_hex_str = RecvAll(sock, kAdbMessageLengthLength);
if (!IsInteger(length_as_hex_str)) {
return {};
@@ -134,7 +134,7 @@
// Returns a negative value if uptime result couldn't be read for
// any reason.
-int RecvUptimeResult(cvd::SharedFD sock) {
+int RecvUptimeResult(cuttlefish::SharedFD sock) {
std::vector<char> uptime_vec{};
std::vector<char> just_read(16);
do {
@@ -182,7 +182,7 @@
// sleeps stabilize the communication.
LOG(DEBUG) << "Watching for disconnect on " << address;
while (true) {
- auto sock = cvd::SharedFD::SocketLocalClient(kAdbDaemonPort, SOCK_STREAM);
+ auto sock = cuttlefish::SharedFD::SocketLocalClient(kAdbDaemonPort, SOCK_STREAM);
if (!AdbSendMessage(sock, MakeTransportMessage(address))) {
LOG(WARNING) << "transport message failed, response body: "
<< RecvAdbResponse(sock);
@@ -208,7 +208,7 @@
} // namespace
-[[noreturn]] void cvd::EstablishAndMaintainConnection(std::string address) {
+[[noreturn]] void cuttlefish::EstablishAndMaintainConnection(std::string address) {
while (true) {
EstablishConnection(address);
WaitForAdbDisconnection(address);
diff --git a/host/frontend/adb_connector/adb_connection_maintainer.h b/host/frontend/adb_connector/adb_connection_maintainer.h
index ca5584f..23a7b44 100644
--- a/host/frontend/adb_connector/adb_connection_maintainer.h
+++ b/host/frontend/adb_connector/adb_connection_maintainer.h
@@ -15,8 +15,8 @@
*/
#pragma once
-namespace cvd {
+namespace cuttlefish {
[[noreturn]] void EstablishAndMaintainConnection(std::string address);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/adb_connector/main.cpp b/host/frontend/adb_connector/main.cpp
index f71436e..bd1d1dd 100644
--- a/host/frontend/adb_connector/main.cpp
+++ b/host/frontend/adb_connector/main.cpp
@@ -40,7 +40,7 @@
namespace {
void LaunchConnectionMaintainerThread(const std::string& address) {
- std::thread(cvd::EstablishAndMaintainConnection, address).detach();
+ std::thread(cuttlefish::EstablishAndMaintainConnection, address).detach();
}
std::vector<std::string> ParseAddressList(std::string ports) {
@@ -57,7 +57,7 @@
}
void WaitForAdbdToBeStarted(int events_fd) {
- auto evt_shared_fd = cvd::SharedFD::Dup(events_fd);
+ auto evt_shared_fd = cuttlefish::SharedFD::Dup(events_fd);
close(events_fd);
while (evt_shared_fd->IsOpen()) {
monitor::BootEvent event;
@@ -78,7 +78,7 @@
} // namespace
int main(int argc, char* argv[]) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
gflags::ParseCommandLineFlags(&argc, &argv, true);
CHECK(!FLAGS_addresses.empty()) << "Must specify --addresses flag";
diff --git a/host/frontend/gcastv2/https/HTTPServer.cpp b/host/frontend/gcastv2/https/HTTPServer.cpp
index 6c4a5ff..3d9e99b 100644
--- a/host/frontend/gcastv2/https/HTTPServer.cpp
+++ b/host/frontend/gcastv2/https/HTTPServer.cpp
@@ -299,7 +299,7 @@
CHECK_EQ(res, 1);
std::string acceptKey;
- cvd::EncodeBase64(digest, sizeof(digest), &acceptKey);
+ cuttlefish::EncodeBase64(digest, sizeof(digest), &acceptKey);
(*responseHeaders)["Sec-WebSocket-Accept"] = acceptKey;
diff --git a/host/frontend/gcastv2/signaling_server/client_handler.cpp b/host/frontend/gcastv2/signaling_server/client_handler.cpp
index 3643528..ac53d00 100644
--- a/host/frontend/gcastv2/signaling_server/client_handler.cpp
+++ b/host/frontend/gcastv2/signaling_server/client_handler.cpp
@@ -20,7 +20,7 @@
#include "host/frontend/gcastv2/signaling_server/constants/signaling_constants.h"
#include "host/frontend/gcastv2/signaling_server/device_handler.h"
-namespace cvd {
+namespace cuttlefish {
ClientHandler::ClientHandler(DeviceRegistry* registry,
const ServerConfig& server_config)
@@ -102,4 +102,4 @@
return 0;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/client_handler.h b/host/frontend/gcastv2/signaling_server/client_handler.h
index afd3c7c..4edf335 100644
--- a/host/frontend/gcastv2/signaling_server/client_handler.h
+++ b/host/frontend/gcastv2/signaling_server/client_handler.h
@@ -25,7 +25,7 @@
#include "host/frontend/gcastv2/signaling_server/server_config.h"
#include "host/frontend/gcastv2/signaling_server/signal_handler.h"
-namespace cvd {
+namespace cuttlefish {
class DeviceHandler;
class ClientHandler : public SignalHandler,
public std::enable_shared_from_this<ClientHandler> {
@@ -45,4 +45,4 @@
// them.
size_t client_id_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/constants/signaling_constants.h b/host/frontend/gcastv2/signaling_server/constants/signaling_constants.h
index b3b2870..3f14778 100644
--- a/host/frontend/gcastv2/signaling_server/constants/signaling_constants.h
+++ b/host/frontend/gcastv2/signaling_server/constants/signaling_constants.h
@@ -15,7 +15,7 @@
#pragma once
-namespace cvd {
+namespace cuttlefish {
namespace webrtc_signaling {
constexpr auto kTypeField = "message_type";
@@ -39,4 +39,4 @@
constexpr auto kDeviceMessageType = "device_msg";
} // namespace webrtc_signaling
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_handler.cpp b/host/frontend/gcastv2/signaling_server/device_handler.cpp
index b48f6c9..e0cc916 100644
--- a/host/frontend/gcastv2/signaling_server/device_handler.cpp
+++ b/host/frontend/gcastv2/signaling_server/device_handler.cpp
@@ -20,7 +20,7 @@
#include "host/frontend/gcastv2/signaling_server/client_handler.h"
#include "host/frontend/gcastv2/signaling_server/constants/signaling_constants.h"
-namespace cvd {
+namespace cuttlefish {
DeviceHandler::DeviceHandler(DeviceRegistry* registry,
const ServerConfig& server_config)
@@ -112,4 +112,4 @@
Reply(msg);
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_handler.h b/host/frontend/gcastv2/signaling_server/device_handler.h
index b94a38a..ba2a000 100644
--- a/host/frontend/gcastv2/signaling_server/device_handler.h
+++ b/host/frontend/gcastv2/signaling_server/device_handler.h
@@ -26,7 +26,7 @@
#include "host/frontend/gcastv2/signaling_server/server_config.h"
#include "host/frontend/gcastv2/signaling_server/signal_handler.h"
-namespace cvd {
+namespace cuttlefish {
class ClientHandler;
@@ -53,4 +53,4 @@
Json::Value device_info_;
std::vector<std::weak_ptr<ClientHandler>> clients_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_list_handler.cpp b/host/frontend/gcastv2/signaling_server/device_list_handler.cpp
index ac946ae..84c8e49 100644
--- a/host/frontend/gcastv2/signaling_server/device_list_handler.cpp
+++ b/host/frontend/gcastv2/signaling_server/device_list_handler.cpp
@@ -15,7 +15,7 @@
#include "host/frontend/gcastv2/signaling_server/device_list_handler.h"
-namespace cvd {
+namespace cuttlefish {
DeviceListHandler::DeviceListHandler(const DeviceRegistry& registry)
: registry_(registry) {}
@@ -35,4 +35,4 @@
return -1; // disconnect
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_list_handler.h b/host/frontend/gcastv2/signaling_server/device_list_handler.h
index 0d099f1..2b41609 100644
--- a/host/frontend/gcastv2/signaling_server/device_list_handler.h
+++ b/host/frontend/gcastv2/signaling_server/device_list_handler.h
@@ -23,7 +23,7 @@
#include "host/frontend/gcastv2/https/include/https/WebSocketHandler.h"
#include "host/frontend/gcastv2/signaling_server/device_registry.h"
-namespace cvd {
+namespace cuttlefish {
class DeviceListHandler : public WebSocketHandler {
public:
@@ -35,4 +35,4 @@
private:
const DeviceRegistry& registry_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_registry.cpp b/host/frontend/gcastv2/signaling_server/device_registry.cpp
index f5dc362..9a87043 100644
--- a/host/frontend/gcastv2/signaling_server/device_registry.cpp
+++ b/host/frontend/gcastv2/signaling_server/device_registry.cpp
@@ -19,7 +19,7 @@
#include "host/frontend/gcastv2/signaling_server/device_handler.h"
-namespace cvd {
+namespace cuttlefish {
bool DeviceRegistry::RegisterDevice(
const std::string& device_id,
@@ -68,4 +68,4 @@
return ret;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/device_registry.h b/host/frontend/gcastv2/signaling_server/device_registry.h
index 0d2a46b..8cccb90 100644
--- a/host/frontend/gcastv2/signaling_server/device_registry.h
+++ b/host/frontend/gcastv2/signaling_server/device_registry.h
@@ -24,7 +24,7 @@
#include <json/json.h>
-namespace cvd {
+namespace cuttlefish {
class DeviceHandler;
@@ -42,4 +42,4 @@
std::map<std::string, std::weak_ptr<DeviceHandler>> devices_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/server.cpp b/host/frontend/gcastv2/signaling_server/server.cpp
index feb7159..ac6cb8c 100644
--- a/host/frontend/gcastv2/signaling_server/server.cpp
+++ b/host/frontend/gcastv2/signaling_server/server.cpp
@@ -73,7 +73,7 @@
} // namespace
int main(int argc, char **argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
::gflags::ParseCommandLineFlags(&argc, &argv, true);
InitSSL();
@@ -95,18 +95,18 @@
ServeStaticFiles(httpd);
- cvd::ServerConfig server_config({FLAGS_stun_server});
- cvd::DeviceRegistry device_registry;
+ cuttlefish::ServerConfig server_config({FLAGS_stun_server});
+ cuttlefish::DeviceRegistry device_registry;
httpd->addWebSocketHandlerFactory(
"/register_device", [&device_registry, &server_config] {
- return std::make_pair(0, std::make_shared<cvd::DeviceHandler>(
+ return std::make_pair(0, std::make_shared<cuttlefish::DeviceHandler>(
&device_registry, server_config));
});
httpd->addWebSocketHandlerFactory(
"/connect_client", [&device_registry, &server_config] {
- return std::make_pair(0, std::make_shared<cvd::ClientHandler>(
+ return std::make_pair(0, std::make_shared<cuttlefish::ClientHandler>(
&device_registry, server_config));
});
@@ -114,7 +114,7 @@
// obtain the ids of registered devices.
httpd->addWebSocketHandlerFactory("/list_devices", [&device_registry] {
return std::make_pair(
- 0, std::make_shared<cvd::DeviceListHandler>(device_registry));
+ 0, std::make_shared<cuttlefish::DeviceListHandler>(device_registry));
});
httpd->run();
diff --git a/host/frontend/gcastv2/signaling_server/server_config.cpp b/host/frontend/gcastv2/signaling_server/server_config.cpp
index 6fa880a..be419ae 100644
--- a/host/frontend/gcastv2/signaling_server/server_config.cpp
+++ b/host/frontend/gcastv2/signaling_server/server_config.cpp
@@ -19,7 +19,7 @@
using android::base::StartsWith;
-namespace cvd {
+namespace cuttlefish {
namespace {
constexpr auto kStunPrefix = "stun:";
@@ -40,4 +40,4 @@
return server_config;
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/server_config.h b/host/frontend/gcastv2/signaling_server/server_config.h
index d4a42a5..1983128 100644
--- a/host/frontend/gcastv2/signaling_server/server_config.h
+++ b/host/frontend/gcastv2/signaling_server/server_config.h
@@ -20,7 +20,7 @@
#include <json/json.h>
-namespace cvd {
+namespace cuttlefish {
class ServerConfig {
public:
ServerConfig(const std::vector<std::string>& stuns);
@@ -30,4 +30,4 @@
private:
std::vector<std::string> stun_servers_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/signal_handler.cpp b/host/frontend/gcastv2/signaling_server/signal_handler.cpp
index 1df26cc..24e1f0f 100644
--- a/host/frontend/gcastv2/signaling_server/signal_handler.cpp
+++ b/host/frontend/gcastv2/signaling_server/signal_handler.cpp
@@ -20,7 +20,7 @@
#include "host/frontend/gcastv2/signaling_server/constants/signaling_constants.h"
-namespace cvd {
+namespace cuttlefish {
SignalHandler::SignalHandler(DeviceRegistry* registry,
const ServerConfig& server_config)
@@ -76,4 +76,4 @@
sendMessage(replyAsString.c_str(), replyAsString.size());
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/signaling_server/signal_handler.h b/host/frontend/gcastv2/signaling_server/signal_handler.h
index c0bf96f..421b224 100644
--- a/host/frontend/gcastv2/signaling_server/signal_handler.h
+++ b/host/frontend/gcastv2/signaling_server/signal_handler.h
@@ -24,7 +24,7 @@
#include "host/frontend/gcastv2/signaling_server/device_registry.h"
#include "host/frontend/gcastv2/signaling_server/server_config.h"
-namespace cvd {
+namespace cuttlefish {
class SignalHandler : public WebSocketHandler {
protected:
@@ -44,4 +44,4 @@
DeviceRegistry* registry_;
const ServerConfig& server_config_;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/gcastv2/webrtc/ServerState.cpp b/host/frontend/gcastv2/webrtc/ServerState.cpp
index 144c4d6..82ed684 100644
--- a/host/frontend/gcastv2/webrtc/ServerState.cpp
+++ b/host/frontend/gcastv2/webrtc/ServerState.cpp
@@ -61,8 +61,8 @@
static_cast<android::FrameBufferSource *>(
mFrameBufferSource.get())->setScreenParams(screenParams);
- mScreenConnector = std::shared_ptr<cvd::ScreenConnector>(
- cvd::ScreenConnector::Get(FLAGS_frame_server_fd));
+ mScreenConnector = std::shared_ptr<cuttlefish::ScreenConnector>(
+ cuttlefish::ScreenConnector::Get(FLAGS_frame_server_fd));
mScreenConnectorMonitor.reset(
new std::thread([this]() { MonitorScreenConnector(); }));
@@ -94,7 +94,7 @@
std::uint8_t *data) {
mRunLoop->postAndAwait([this, data]() {
static_cast<android::FrameBufferSource *>(mFrameBufferSource.get())
- ->injectFrame(data, cvd::ScreenConnector::ScreenSizeInBytes());
+ ->injectFrame(data, cuttlefish::ScreenConnector::ScreenSizeInBytes());
});
last_frame = frame_num;
});
diff --git a/host/frontend/gcastv2/webrtc/client_handler.cpp b/host/frontend/gcastv2/webrtc/client_handler.cpp
index 703cdf7..9eff97c 100644
--- a/host/frontend/gcastv2/webrtc/client_handler.cpp
+++ b/host/frontend/gcastv2/webrtc/client_handler.cpp
@@ -78,7 +78,7 @@
new AdbHandler(mRunLoop, config->ForDefaultInstance().adb_ip_and_port(),
[this](const uint8_t *msg, size_t length) {
std::string base64_msg;
- cvd::EncodeBase64(msg, length, &base64_msg);
+ cuttlefish::EncodeBase64(msg, length, &base64_msg);
Json::Value reply;
reply["type"] = "adb-message";
reply["payload"] = base64_msg;
@@ -161,7 +161,7 @@
}
auto base64_msg = message["payload"].asString();
std::vector<uint8_t> raw_msg;
- if (!cvd::DecodeBase64(base64_msg, &raw_msg)) {
+ if (!cuttlefish::DecodeBase64(base64_msg, &raw_msg)) {
LOG(ERROR) << "Invalid base64 string in adb-message";
return;
}
diff --git a/host/frontend/gcastv2/webrtc/include/webrtc/ServerState.h b/host/frontend/gcastv2/webrtc/include/webrtc/ServerState.h
index fbda93a..2a2da0cbd 100644
--- a/host/frontend/gcastv2/webrtc/include/webrtc/ServerState.h
+++ b/host/frontend/gcastv2/webrtc/include/webrtc/ServerState.h
@@ -70,7 +70,7 @@
std::shared_ptr<StreamingSource> mAudioSource;
- std::shared_ptr<cvd::ScreenConnector> mScreenConnector;
+ std::shared_ptr<cuttlefish::ScreenConnector> mScreenConnector;
std::shared_ptr<std::thread> mScreenConnectorMonitor;
std::shared_ptr<TouchSink> mTouchSink;
diff --git a/host/frontend/gcastv2/webrtc/sig_server_handler.cpp b/host/frontend/gcastv2/webrtc/sig_server_handler.cpp
index 5f2d1c4..9b2b6c4 100644
--- a/host/frontend/gcastv2/webrtc/sig_server_handler.cpp
+++ b/host/frontend/gcastv2/webrtc/sig_server_handler.cpp
@@ -106,17 +106,17 @@
}
std::string StunServerFromConfig(const Json::Value &server_config) {
- if (!server_config.isMember(cvd::webrtc_signaling::kServersField) ||
- !server_config[cvd::webrtc_signaling::kServersField].isArray()) {
+ if (!server_config.isMember(cuttlefish::webrtc_signaling::kServersField) ||
+ !server_config[cuttlefish::webrtc_signaling::kServersField].isArray()) {
return "";
}
- auto ice_servers = server_config[cvd::webrtc_signaling::kServersField];
+ auto ice_servers = server_config[cuttlefish::webrtc_signaling::kServersField];
for (Json::ArrayIndex i = 0; i < ice_servers.size(); ++i) {
- if (!ice_servers[i].isMember(cvd::webrtc_signaling::kUrlsField)) {
+ if (!ice_servers[i].isMember(cuttlefish::webrtc_signaling::kUrlsField)) {
LOG(WARNING) << "Ice server received without a urls field";
continue;
}
- auto url = ice_servers[i][cvd::webrtc_signaling::kUrlsField];
+ auto url = ice_servers[i][cuttlefish::webrtc_signaling::kUrlsField];
if (url.isArray()) {
if (url.size() == 0) {
LOG(WARNING) << "Ice server received with empty urls field";
@@ -172,9 +172,9 @@
void SigServerHandler::OnOpen() {
auto config = vsoc::CuttlefishConfig::Get();
Json::Value register_obj;
- register_obj[cvd::webrtc_signaling::kTypeField] =
- cvd::webrtc_signaling::kRegisterType;
- register_obj[cvd::webrtc_signaling::kDeviceIdField] =
+ register_obj[cuttlefish::webrtc_signaling::kTypeField] =
+ cuttlefish::webrtc_signaling::kRegisterType;
+ register_obj[cuttlefish::webrtc_signaling::kDeviceIdField] =
device_id_.empty() ? config->ForDefaultInstance().instance_name()
: device_id_;
Json::Value device_info;
@@ -189,7 +189,7 @@
displays.append(main_display);
device_info[kDisplaysField] = displays;
- register_obj[cvd::webrtc_signaling::kDeviceInfoField] = device_info;
+ register_obj[cuttlefish::webrtc_signaling::kDeviceInfoField] = device_info;
SendJson(server_connection_, register_obj);
}
@@ -211,38 +211,38 @@
<< "'";
return;
}
- if (!server_message.isMember(cvd::webrtc_signaling::kTypeField) ||
- !server_message[cvd::webrtc_signaling::kTypeField].isString()) {
+ if (!server_message.isMember(cuttlefish::webrtc_signaling::kTypeField) ||
+ !server_message[cuttlefish::webrtc_signaling::kTypeField].isString()) {
LOG(ERROR) << "No message_type field from server";
return;
}
- auto type = server_message[cvd::webrtc_signaling::kTypeField].asString();
- if (type == cvd::webrtc_signaling::kConfigType) {
+ auto type = server_message[cuttlefish::webrtc_signaling::kTypeField].asString();
+ if (type == cuttlefish::webrtc_signaling::kConfigType) {
auto stun_server = StunServerFromConfig(server_message);
auto public_ip =
stun_server.empty() ? FLAGS_public_ip : FigureOutPublicIp(stun_server);
server_state_->SetPublicIp(public_ip);
- } else if (type == cvd::webrtc_signaling::kClientMessageType) {
- if (!server_message.isMember(cvd::webrtc_signaling::kClientIdField) ||
- !server_message[cvd::webrtc_signaling::kClientIdField].isInt()) {
+ } else if (type == cuttlefish::webrtc_signaling::kClientMessageType) {
+ if (!server_message.isMember(cuttlefish::webrtc_signaling::kClientIdField) ||
+ !server_message[cuttlefish::webrtc_signaling::kClientIdField].isInt()) {
LOG(ERROR) << "Client message received without valid client id";
return;
}
auto client_id =
- server_message[cvd::webrtc_signaling::kClientIdField].asInt();
- if (!server_message.isMember(cvd::webrtc_signaling::kPayloadField)) {
+ server_message[cuttlefish::webrtc_signaling::kClientIdField].asInt();
+ if (!server_message.isMember(cuttlefish::webrtc_signaling::kPayloadField)) {
LOG(ERROR) << "Received empty client message";
return;
}
- auto client_message = server_message[cvd::webrtc_signaling::kPayloadField];
+ auto client_message = server_message[cuttlefish::webrtc_signaling::kPayloadField];
if (clients_.count(client_id) == 0) {
clients_[client_id].reset(new ClientHandler(
server_state_, [this, client_id](const Json::Value &msg) {
Json::Value wrapper;
- wrapper[cvd::webrtc_signaling::kPayloadField] = msg;
- wrapper[cvd::webrtc_signaling::kTypeField] =
- cvd::webrtc_signaling::kForwardType;
- wrapper[cvd::webrtc_signaling::kClientIdField] = client_id;
+ wrapper[cuttlefish::webrtc_signaling::kPayloadField] = msg;
+ wrapper[cuttlefish::webrtc_signaling::kTypeField] =
+ cuttlefish::webrtc_signaling::kForwardType;
+ wrapper[cuttlefish::webrtc_signaling::kClientIdField] = client_id;
// This is safe to call from the webrtc runloop because
// WsConnection is thread safe
SendJson(server_connection_, wrapper);
diff --git a/host/frontend/gcastv2/webrtc/webRTC.cpp b/host/frontend/gcastv2/webrtc/webRTC.cpp
index 09b7832..d189f30 100644
--- a/host/frontend/gcastv2/webrtc/webRTC.cpp
+++ b/host/frontend/gcastv2/webrtc/webRTC.cpp
@@ -53,7 +53,7 @@
DEFINE_string(adb, "", "Interface:port of local adb service.");
int main(int argc, char **argv) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
::gflags::ParseCommandLineFlags(&argc, &argv, true);
SSLSocket::Init();
diff --git a/host/frontend/vnc_server/blackboard.cpp b/host/frontend/vnc_server/blackboard.cpp
index 0790b49..91a8d1e 100644
--- a/host/frontend/vnc_server/blackboard.cpp
+++ b/host/frontend/vnc_server/blackboard.cpp
@@ -29,10 +29,10 @@
#define DLOG(LEVEL) \
if (FLAGS_debug_blackboard) LOG(LEVEL)
-using cvd::vnc::BlackBoard;
-using cvd::vnc::Stripe;
+using cuttlefish::vnc::BlackBoard;
+using cuttlefish::vnc::Stripe;
-cvd::vnc::SeqNumberVec cvd::vnc::MakeSeqNumberVec() {
+cuttlefish::vnc::SeqNumberVec cuttlefish::vnc::MakeSeqNumberVec() {
return SeqNumberVec(FrameBufferWatcher::StripesPerFrame());
}
@@ -75,7 +75,7 @@
return true;
}
-cvd::vnc::StripePtrVec BlackBoard::WaitForSenderWork(
+cuttlefish::vnc::StripePtrVec BlackBoard::WaitForSenderWork(
const VncClientConnection* conn) {
std::unique_lock<std::mutex> guard(m_);
auto& state = GetStateForClient(conn);
@@ -139,7 +139,7 @@
}
void BlackBoard::set_frame_buffer_watcher(
- cvd::vnc::FrameBufferWatcher* frame_buffer_watcher) {
+ cuttlefish::vnc::FrameBufferWatcher* frame_buffer_watcher) {
std::lock_guard<std::mutex> guard(m_);
frame_buffer_watcher_ = frame_buffer_watcher;
}
diff --git a/host/frontend/vnc_server/blackboard.h b/host/frontend/vnc_server/blackboard.h
index 1119dd3..261774e 100644
--- a/host/frontend/vnc_server/blackboard.h
+++ b/host/frontend/vnc_server/blackboard.h
@@ -25,7 +25,7 @@
#include "common/libs/threads/thread_annotations.h"
#include "host/frontend/vnc_server/vnc_utils.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class VncClientConnection;
@@ -110,4 +110,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/frame_buffer_watcher.cpp b/host/frontend/vnc_server/frame_buffer_watcher.cpp
index 02f1d6e..f195821 100644
--- a/host/frontend/vnc_server/frame_buffer_watcher.cpp
+++ b/host/frontend/vnc_server/frame_buffer_watcher.cpp
@@ -29,7 +29,7 @@
#include "host/frontend/vnc_server/vnc_utils.h"
#include "host/libs/screen_connector/screen_connector.h"
-using cvd::vnc::FrameBufferWatcher;
+using cuttlefish::vnc::FrameBufferWatcher;
FrameBufferWatcher::FrameBufferWatcher(BlackBoard* bb)
: bb_{bb}, hwcomposer{bb_} {
@@ -60,7 +60,7 @@
return closed_;
}
-cvd::vnc::Stripe FrameBufferWatcher::Rotated(Stripe stripe) {
+cuttlefish::vnc::Stripe FrameBufferWatcher::Rotated(Stripe stripe) {
if (stripe.orientation == ScreenOrientation::Landscape) {
LOG(FATAL) << "Rotating a landscape stripe, this is a mistake";
}
@@ -92,7 +92,7 @@
return Stripes(stripe.orientation)[stripe.index]->raw_data != stripe.raw_data;
}
-cvd::vnc::StripePtrVec FrameBufferWatcher::StripesNewerThan(
+cuttlefish::vnc::StripePtrVec FrameBufferWatcher::StripesNewerThan(
ScreenOrientation orientation, const SeqNumberVec& seq_numbers) const {
std::lock_guard<std::mutex> guard(stripes_lock_);
const auto& stripes = Stripes(orientation);
@@ -106,12 +106,12 @@
return new_stripes;
}
-cvd::vnc::StripePtrVec& FrameBufferWatcher::Stripes(
+cuttlefish::vnc::StripePtrVec& FrameBufferWatcher::Stripes(
ScreenOrientation orientation) {
return stripes_[static_cast<int>(orientation)];
}
-const cvd::vnc::StripePtrVec& FrameBufferWatcher::Stripes(
+const cuttlefish::vnc::StripePtrVec& FrameBufferWatcher::Stripes(
ScreenOrientation orientation) const {
return stripes_[static_cast<int>(orientation)];
}
diff --git a/host/frontend/vnc_server/frame_buffer_watcher.h b/host/frontend/vnc_server/frame_buffer_watcher.h
index 40ab270..909f092 100644
--- a/host/frontend/vnc_server/frame_buffer_watcher.h
+++ b/host/frontend/vnc_server/frame_buffer_watcher.h
@@ -27,7 +27,7 @@
#include "host/frontend/vnc_server/jpeg_compressor.h"
#include "host/frontend/vnc_server/simulated_hw_composer.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class FrameBufferWatcher {
public:
@@ -73,4 +73,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/jpeg_compressor.cpp b/host/frontend/vnc_server/jpeg_compressor.cpp
index 270283e..c348a9a 100644
--- a/host/frontend/vnc_server/jpeg_compressor.cpp
+++ b/host/frontend/vnc_server/jpeg_compressor.cpp
@@ -22,7 +22,7 @@
#include "host/frontend/vnc_server/vnc_utils.h"
#include "host/libs/screen_connector/screen_connector.h"
-using cvd::vnc::JpegCompressor;
+using cuttlefish::vnc::JpegCompressor;
namespace {
void InitCinfo(jpeg_compress_struct* cinfo, jpeg_error_mgr* err,
@@ -32,7 +32,7 @@
cinfo->image_width = width;
cinfo->image_height = height;
- cinfo->input_components = cvd::ScreenConnector::BytesPerPixel();
+ cinfo->input_components = cuttlefish::ScreenConnector::BytesPerPixel();
cinfo->in_color_space = JCS_EXT_RGBX;
jpeg_set_defaults(cinfo);
@@ -40,7 +40,7 @@
}
} // namespace
-cvd::Message JpegCompressor::Compress(const Message& frame,
+cuttlefish::Message JpegCompressor::Compress(const Message& frame,
int jpeg_quality, std::uint16_t x,
std::uint16_t y, std::uint16_t width,
std::uint16_t height,
@@ -58,7 +58,7 @@
auto row = static_cast<JSAMPROW>(const_cast<std::uint8_t*>(
&frame[(y * stride) +
(cinfo.next_scanline * stride) +
- (x * cvd::ScreenConnector::BytesPerPixel())]));
+ (x * cuttlefish::ScreenConnector::BytesPerPixel())]));
jpeg_write_scanlines(&cinfo, &row, 1);
}
jpeg_finish_compress(&cinfo);
diff --git a/host/frontend/vnc_server/jpeg_compressor.h b/host/frontend/vnc_server/jpeg_compressor.h
index ae3af18..b6ef487 100644
--- a/host/frontend/vnc_server/jpeg_compressor.h
+++ b/host/frontend/vnc_server/jpeg_compressor.h
@@ -22,7 +22,7 @@
#include "host/frontend/vnc_server/vnc_utils.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
// libjpeg-turbo with jpeg_mem_dest (using memory as a destination) is funky.
@@ -49,4 +49,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/keysyms.h b/host/frontend/vnc_server/keysyms.h
index 41ff7c7..ddcc0e4 100644
--- a/host/frontend/vnc_server/keysyms.h
+++ b/host/frontend/vnc_server/keysyms.h
@@ -18,7 +18,7 @@
#include <cstdint>
-namespace cvd {
+namespace cuttlefish {
namespace xk {
constexpr uint32_t BackSpace = 0xff08, Tab = 0xff09, Return = 0xff0d,
@@ -51,4 +51,4 @@
VNCMenu = 0xffed; // VNC seems to translate MENU to this
} // namespace xk
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/main.cpp b/host/frontend/vnc_server/main.cpp
index add9474..58c1da6 100644
--- a/host/frontend/vnc_server/main.cpp
+++ b/host/frontend/vnc_server/main.cpp
@@ -27,9 +27,9 @@
DEFINE_int32(port, 6444, "Port where to listen for connections");
int main(int argc, char* argv[]) {
- cvd::DefaultSubprocessLogging(argv);
+ cuttlefish::DefaultSubprocessLogging(argv);
google::ParseCommandLineFlags(&argc, &argv, true);
- cvd::vnc::VncServer vnc_server(FLAGS_port, FLAGS_agressive);
+ cuttlefish::vnc::VncServer vnc_server(FLAGS_port, FLAGS_agressive);
vnc_server.MainLoop();
}
diff --git a/host/frontend/vnc_server/simulated_hw_composer.cpp b/host/frontend/vnc_server/simulated_hw_composer.cpp
index 7b478f4..811151e 100644
--- a/host/frontend/vnc_server/simulated_hw_composer.cpp
+++ b/host/frontend/vnc_server/simulated_hw_composer.cpp
@@ -23,7 +23,7 @@
DEFINE_int32(frame_server_fd, -1, "");
-using cvd::vnc::SimulatedHWComposer;
+using cuttlefish::vnc::SimulatedHWComposer;
SimulatedHWComposer::SimulatedHWComposer(BlackBoard* bb)
:
@@ -41,7 +41,7 @@
stripe_maker_.join();
}
-cvd::vnc::Stripe SimulatedHWComposer::GetNewStripe() {
+cuttlefish::vnc::Stripe SimulatedHWComposer::GetNewStripe() {
auto s = stripes_.Pop();
#ifdef FUZZ_TEST_VNC
if (random_(engine_)) {
diff --git a/host/frontend/vnc_server/simulated_hw_composer.h b/host/frontend/vnc_server/simulated_hw_composer.h
index 4a51f78..1b6cf87 100644
--- a/host/frontend/vnc_server/simulated_hw_composer.h
+++ b/host/frontend/vnc_server/simulated_hw_composer.h
@@ -28,7 +28,7 @@
#include "host/frontend/vnc_server/blackboard.h"
#include "host/libs/screen_connector/screen_connector.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class SimulatedHWComposer {
public:
@@ -63,4 +63,4 @@
std::shared_ptr<ScreenConnector> screen_connector_;
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/virtual_inputs.cpp b/host/frontend/vnc_server/virtual_inputs.cpp
index f121906..3143a6d 100644
--- a/host/frontend/vnc_server/virtual_inputs.cpp
+++ b/host/frontend/vnc_server/virtual_inputs.cpp
@@ -28,7 +28,7 @@
#include <common/libs/fs/shared_select.h>
#include <host/libs/config/cuttlefish_config.h>
-using cvd::vnc::VirtualInputs;
+using cuttlefish::vnc::VirtualInputs;
DEFINE_int32(touch_fd, -1,
"A fd for a socket where to accept touch connections");
@@ -49,24 +49,24 @@
};
void AddKeyMappings(std::map<uint32_t, uint16_t>* key_mapping) {
- (*key_mapping)[cvd::xk::AltLeft] = KEY_LEFTALT;
- (*key_mapping)[cvd::xk::ControlLeft] = KEY_LEFTCTRL;
- (*key_mapping)[cvd::xk::ShiftLeft] = KEY_LEFTSHIFT;
- (*key_mapping)[cvd::xk::AltRight] = KEY_RIGHTALT;
- (*key_mapping)[cvd::xk::ControlRight] = KEY_RIGHTCTRL;
- (*key_mapping)[cvd::xk::ShiftRight] = KEY_RIGHTSHIFT;
- (*key_mapping)[cvd::xk::MetaLeft] = KEY_LEFTMETA;
- (*key_mapping)[cvd::xk::MetaRight] = KEY_RIGHTMETA;
- (*key_mapping)[cvd::xk::MultiKey] = KEY_COMPOSE;
+ (*key_mapping)[cuttlefish::xk::AltLeft] = KEY_LEFTALT;
+ (*key_mapping)[cuttlefish::xk::ControlLeft] = KEY_LEFTCTRL;
+ (*key_mapping)[cuttlefish::xk::ShiftLeft] = KEY_LEFTSHIFT;
+ (*key_mapping)[cuttlefish::xk::AltRight] = KEY_RIGHTALT;
+ (*key_mapping)[cuttlefish::xk::ControlRight] = KEY_RIGHTCTRL;
+ (*key_mapping)[cuttlefish::xk::ShiftRight] = KEY_RIGHTSHIFT;
+ (*key_mapping)[cuttlefish::xk::MetaLeft] = KEY_LEFTMETA;
+ (*key_mapping)[cuttlefish::xk::MetaRight] = KEY_RIGHTMETA;
+ (*key_mapping)[cuttlefish::xk::MultiKey] = KEY_COMPOSE;
- (*key_mapping)[cvd::xk::CapsLock] = KEY_CAPSLOCK;
- (*key_mapping)[cvd::xk::NumLock] = KEY_NUMLOCK;
- (*key_mapping)[cvd::xk::ScrollLock] = KEY_SCROLLLOCK;
+ (*key_mapping)[cuttlefish::xk::CapsLock] = KEY_CAPSLOCK;
+ (*key_mapping)[cuttlefish::xk::NumLock] = KEY_NUMLOCK;
+ (*key_mapping)[cuttlefish::xk::ScrollLock] = KEY_SCROLLLOCK;
- (*key_mapping)[cvd::xk::BackSpace] = KEY_BACKSPACE;
- (*key_mapping)[cvd::xk::Tab] = KEY_TAB;
- (*key_mapping)[cvd::xk::Return] = KEY_ENTER;
- (*key_mapping)[cvd::xk::Escape] = KEY_ESC;
+ (*key_mapping)[cuttlefish::xk::BackSpace] = KEY_BACKSPACE;
+ (*key_mapping)[cuttlefish::xk::Tab] = KEY_TAB;
+ (*key_mapping)[cuttlefish::xk::Return] = KEY_ENTER;
+ (*key_mapping)[cuttlefish::xk::Escape] = KEY_ESC;
(*key_mapping)[' '] = KEY_SPACE;
(*key_mapping)['!'] = KEY_1;
@@ -166,75 +166,75 @@
(*key_mapping)['}'] = KEY_RIGHTBRACE;
(*key_mapping)['~'] = KEY_GRAVE;
- (*key_mapping)[cvd::xk::F1] = KEY_F1;
- (*key_mapping)[cvd::xk::F2] = KEY_F2;
- (*key_mapping)[cvd::xk::F3] = KEY_F3;
- (*key_mapping)[cvd::xk::F4] = KEY_F4;
- (*key_mapping)[cvd::xk::F5] = KEY_F5;
- (*key_mapping)[cvd::xk::F6] = KEY_F6;
- (*key_mapping)[cvd::xk::F7] = KEY_F7;
- (*key_mapping)[cvd::xk::F8] = KEY_F8;
- (*key_mapping)[cvd::xk::F9] = KEY_F9;
- (*key_mapping)[cvd::xk::F10] = KEY_F10;
- (*key_mapping)[cvd::xk::F11] = KEY_F11;
- (*key_mapping)[cvd::xk::F12] = KEY_F12;
- (*key_mapping)[cvd::xk::F13] = KEY_F13;
- (*key_mapping)[cvd::xk::F14] = KEY_F14;
- (*key_mapping)[cvd::xk::F15] = KEY_F15;
- (*key_mapping)[cvd::xk::F16] = KEY_F16;
- (*key_mapping)[cvd::xk::F17] = KEY_F17;
- (*key_mapping)[cvd::xk::F18] = KEY_F18;
- (*key_mapping)[cvd::xk::F19] = KEY_F19;
- (*key_mapping)[cvd::xk::F20] = KEY_F20;
- (*key_mapping)[cvd::xk::F21] = KEY_F21;
- (*key_mapping)[cvd::xk::F22] = KEY_F22;
- (*key_mapping)[cvd::xk::F23] = KEY_F23;
- (*key_mapping)[cvd::xk::F24] = KEY_F24;
+ (*key_mapping)[cuttlefish::xk::F1] = KEY_F1;
+ (*key_mapping)[cuttlefish::xk::F2] = KEY_F2;
+ (*key_mapping)[cuttlefish::xk::F3] = KEY_F3;
+ (*key_mapping)[cuttlefish::xk::F4] = KEY_F4;
+ (*key_mapping)[cuttlefish::xk::F5] = KEY_F5;
+ (*key_mapping)[cuttlefish::xk::F6] = KEY_F6;
+ (*key_mapping)[cuttlefish::xk::F7] = KEY_F7;
+ (*key_mapping)[cuttlefish::xk::F8] = KEY_F8;
+ (*key_mapping)[cuttlefish::xk::F9] = KEY_F9;
+ (*key_mapping)[cuttlefish::xk::F10] = KEY_F10;
+ (*key_mapping)[cuttlefish::xk::F11] = KEY_F11;
+ (*key_mapping)[cuttlefish::xk::F12] = KEY_F12;
+ (*key_mapping)[cuttlefish::xk::F13] = KEY_F13;
+ (*key_mapping)[cuttlefish::xk::F14] = KEY_F14;
+ (*key_mapping)[cuttlefish::xk::F15] = KEY_F15;
+ (*key_mapping)[cuttlefish::xk::F16] = KEY_F16;
+ (*key_mapping)[cuttlefish::xk::F17] = KEY_F17;
+ (*key_mapping)[cuttlefish::xk::F18] = KEY_F18;
+ (*key_mapping)[cuttlefish::xk::F19] = KEY_F19;
+ (*key_mapping)[cuttlefish::xk::F20] = KEY_F20;
+ (*key_mapping)[cuttlefish::xk::F21] = KEY_F21;
+ (*key_mapping)[cuttlefish::xk::F22] = KEY_F22;
+ (*key_mapping)[cuttlefish::xk::F23] = KEY_F23;
+ (*key_mapping)[cuttlefish::xk::F24] = KEY_F24;
- (*key_mapping)[cvd::xk::Keypad0] = KEY_KP0;
- (*key_mapping)[cvd::xk::Keypad1] = KEY_KP1;
- (*key_mapping)[cvd::xk::Keypad2] = KEY_KP2;
- (*key_mapping)[cvd::xk::Keypad3] = KEY_KP3;
- (*key_mapping)[cvd::xk::Keypad4] = KEY_KP4;
- (*key_mapping)[cvd::xk::Keypad5] = KEY_KP5;
- (*key_mapping)[cvd::xk::Keypad6] = KEY_KP6;
- (*key_mapping)[cvd::xk::Keypad7] = KEY_KP7;
- (*key_mapping)[cvd::xk::Keypad8] = KEY_KP8;
- (*key_mapping)[cvd::xk::Keypad9] = KEY_KP9;
- (*key_mapping)[cvd::xk::KeypadMultiply] = KEY_KPASTERISK;
- (*key_mapping)[cvd::xk::KeypadSubtract] = KEY_KPMINUS;
- (*key_mapping)[cvd::xk::KeypadAdd] = KEY_KPPLUS;
- (*key_mapping)[cvd::xk::KeypadDecimal] = KEY_KPDOT;
- (*key_mapping)[cvd::xk::KeypadEnter] = KEY_KPENTER;
- (*key_mapping)[cvd::xk::KeypadDivide] = KEY_KPSLASH;
- (*key_mapping)[cvd::xk::KeypadEqual] = KEY_KPEQUAL;
- (*key_mapping)[cvd::xk::PlusMinus] = KEY_KPPLUSMINUS;
+ (*key_mapping)[cuttlefish::xk::Keypad0] = KEY_KP0;
+ (*key_mapping)[cuttlefish::xk::Keypad1] = KEY_KP1;
+ (*key_mapping)[cuttlefish::xk::Keypad2] = KEY_KP2;
+ (*key_mapping)[cuttlefish::xk::Keypad3] = KEY_KP3;
+ (*key_mapping)[cuttlefish::xk::Keypad4] = KEY_KP4;
+ (*key_mapping)[cuttlefish::xk::Keypad5] = KEY_KP5;
+ (*key_mapping)[cuttlefish::xk::Keypad6] = KEY_KP6;
+ (*key_mapping)[cuttlefish::xk::Keypad7] = KEY_KP7;
+ (*key_mapping)[cuttlefish::xk::Keypad8] = KEY_KP8;
+ (*key_mapping)[cuttlefish::xk::Keypad9] = KEY_KP9;
+ (*key_mapping)[cuttlefish::xk::KeypadMultiply] = KEY_KPASTERISK;
+ (*key_mapping)[cuttlefish::xk::KeypadSubtract] = KEY_KPMINUS;
+ (*key_mapping)[cuttlefish::xk::KeypadAdd] = KEY_KPPLUS;
+ (*key_mapping)[cuttlefish::xk::KeypadDecimal] = KEY_KPDOT;
+ (*key_mapping)[cuttlefish::xk::KeypadEnter] = KEY_KPENTER;
+ (*key_mapping)[cuttlefish::xk::KeypadDivide] = KEY_KPSLASH;
+ (*key_mapping)[cuttlefish::xk::KeypadEqual] = KEY_KPEQUAL;
+ (*key_mapping)[cuttlefish::xk::PlusMinus] = KEY_KPPLUSMINUS;
- (*key_mapping)[cvd::xk::SysReq] = KEY_SYSRQ;
- (*key_mapping)[cvd::xk::LineFeed] = KEY_LINEFEED;
- (*key_mapping)[cvd::xk::Home] = KEY_HOME;
- (*key_mapping)[cvd::xk::Up] = KEY_UP;
- (*key_mapping)[cvd::xk::PageUp] = KEY_PAGEUP;
- (*key_mapping)[cvd::xk::Left] = KEY_LEFT;
- (*key_mapping)[cvd::xk::Right] = KEY_RIGHT;
- (*key_mapping)[cvd::xk::End] = KEY_END;
- (*key_mapping)[cvd::xk::Down] = KEY_DOWN;
- (*key_mapping)[cvd::xk::PageDown] = KEY_PAGEDOWN;
- (*key_mapping)[cvd::xk::Insert] = KEY_INSERT;
- (*key_mapping)[cvd::xk::Delete] = KEY_DELETE;
- (*key_mapping)[cvd::xk::Pause] = KEY_PAUSE;
- (*key_mapping)[cvd::xk::KeypadSeparator] = KEY_KPCOMMA;
- (*key_mapping)[cvd::xk::Yen] = KEY_YEN;
- (*key_mapping)[cvd::xk::Cancel] = KEY_STOP;
- (*key_mapping)[cvd::xk::Redo] = KEY_AGAIN;
- (*key_mapping)[cvd::xk::Undo] = KEY_UNDO;
- (*key_mapping)[cvd::xk::Find] = KEY_FIND;
- (*key_mapping)[cvd::xk::Print] = KEY_PRINT;
- (*key_mapping)[cvd::xk::VolumeDown] = KEY_VOLUMEDOWN;
- (*key_mapping)[cvd::xk::Mute] = KEY_MUTE;
- (*key_mapping)[cvd::xk::VolumeUp] = KEY_VOLUMEUP;
- (*key_mapping)[cvd::xk::Menu] = KEY_MENU;
- (*key_mapping)[cvd::xk::VNCMenu] = KEY_MENU;
+ (*key_mapping)[cuttlefish::xk::SysReq] = KEY_SYSRQ;
+ (*key_mapping)[cuttlefish::xk::LineFeed] = KEY_LINEFEED;
+ (*key_mapping)[cuttlefish::xk::Home] = KEY_HOME;
+ (*key_mapping)[cuttlefish::xk::Up] = KEY_UP;
+ (*key_mapping)[cuttlefish::xk::PageUp] = KEY_PAGEUP;
+ (*key_mapping)[cuttlefish::xk::Left] = KEY_LEFT;
+ (*key_mapping)[cuttlefish::xk::Right] = KEY_RIGHT;
+ (*key_mapping)[cuttlefish::xk::End] = KEY_END;
+ (*key_mapping)[cuttlefish::xk::Down] = KEY_DOWN;
+ (*key_mapping)[cuttlefish::xk::PageDown] = KEY_PAGEDOWN;
+ (*key_mapping)[cuttlefish::xk::Insert] = KEY_INSERT;
+ (*key_mapping)[cuttlefish::xk::Delete] = KEY_DELETE;
+ (*key_mapping)[cuttlefish::xk::Pause] = KEY_PAUSE;
+ (*key_mapping)[cuttlefish::xk::KeypadSeparator] = KEY_KPCOMMA;
+ (*key_mapping)[cuttlefish::xk::Yen] = KEY_YEN;
+ (*key_mapping)[cuttlefish::xk::Cancel] = KEY_STOP;
+ (*key_mapping)[cuttlefish::xk::Redo] = KEY_AGAIN;
+ (*key_mapping)[cuttlefish::xk::Undo] = KEY_UNDO;
+ (*key_mapping)[cuttlefish::xk::Find] = KEY_FIND;
+ (*key_mapping)[cuttlefish::xk::Print] = KEY_PRINT;
+ (*key_mapping)[cuttlefish::xk::VolumeDown] = KEY_VOLUMEDOWN;
+ (*key_mapping)[cuttlefish::xk::Mute] = KEY_MUTE;
+ (*key_mapping)[cuttlefish::xk::VolumeUp] = KEY_VOLUMEUP;
+ (*key_mapping)[cuttlefish::xk::Menu] = KEY_MENU;
+ (*key_mapping)[cuttlefish::xk::VNCMenu] = KEY_MENU;
}
void InitInputEvent(struct input_event* evt, uint16_t type, uint16_t code,
@@ -280,7 +280,7 @@
private:
template<size_t num_events>
- void SendEvents(cvd::SharedFD socket, struct input_event (&event_buffer)[num_events]) {
+ void SendEvents(cuttlefish::SharedFD socket, struct input_event (&event_buffer)[num_events]) {
std::lock_guard<std::mutex> lock(socket_mutex_);
if (!socket->IsOpen()) {
// This is unlikely as it would only happen between the start of the vnc
@@ -312,35 +312,35 @@
}
void ClientConnectorLoop() {
- auto touch_server = cvd::SharedFD::Dup(FLAGS_touch_fd);
+ auto touch_server = cuttlefish::SharedFD::Dup(FLAGS_touch_fd);
close(FLAGS_touch_fd);
FLAGS_touch_fd = -1;
- auto keyboard_server = cvd::SharedFD::Dup(FLAGS_keyboard_fd);
+ auto keyboard_server = cuttlefish::SharedFD::Dup(FLAGS_keyboard_fd);
close(FLAGS_keyboard_fd);
FLAGS_keyboard_fd = -1;
LOG(DEBUG) << "Input socket host accepting connections...";
while (1) {
- cvd::SharedFDSet read_set;
+ cuttlefish::SharedFDSet read_set;
read_set.Set(touch_server);
read_set.Set(keyboard_server);
- cvd::Select(&read_set, nullptr, nullptr, nullptr);
+ cuttlefish::Select(&read_set, nullptr, nullptr, nullptr);
{
std::lock_guard<std::mutex> lock(socket_mutex_);
if (read_set.IsSet(touch_server)) {
- touch_socket_ = cvd::SharedFD::Accept(*touch_server);
+ touch_socket_ = cuttlefish::SharedFD::Accept(*touch_server);
LOG(DEBUG) << "connected to touch";
}
if (read_set.IsSet(keyboard_server)) {
- keyboard_socket_ = cvd::SharedFD::Accept(*keyboard_server);
+ keyboard_socket_ = cuttlefish::SharedFD::Accept(*keyboard_server);
LOG(DEBUG) << "connected to keyboard";
}
}
}
}
- cvd::SharedFD touch_socket_;
- cvd::SharedFD keyboard_socket_;
+ cuttlefish::SharedFD touch_socket_;
+ cuttlefish::SharedFD keyboard_socket_;
std::thread client_connector_;
std::mutex socket_mutex_;
};
diff --git a/host/frontend/vnc_server/virtual_inputs.h b/host/frontend/vnc_server/virtual_inputs.h
index 7aca3eb..c22de15 100644
--- a/host/frontend/vnc_server/virtual_inputs.h
+++ b/host/frontend/vnc_server/virtual_inputs.h
@@ -21,7 +21,7 @@
#include <map>
#include <mutex>
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class VirtualInputs {
@@ -41,4 +41,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/vnc_client_connection.cpp b/host/frontend/vnc_server/vnc_client_connection.cpp
index 8e2e32c..7e9b6df 100644
--- a/host/frontend/vnc_server/vnc_client_connection.cpp
+++ b/host/frontend/vnc_server/vnc_client_connection.cpp
@@ -39,10 +39,10 @@
#include "host/libs/config/cuttlefish_config.h"
#include "host/libs/screen_connector/screen_connector.h"
-using cvd::Message;
-using cvd::vnc::Stripe;
-using cvd::vnc::StripePtrVec;
-using cvd::vnc::VncClientConnection;
+using cuttlefish::Message;
+using cuttlefish::vnc::Stripe;
+using cuttlefish::vnc::StripePtrVec;
+using cuttlefish::vnc::VncClientConnection;
struct ScreenRegionView {
using Pixel = uint32_t;
@@ -130,7 +130,7 @@
((0x1 << ScreenRegionView::kGreenBits) - 1);
}
} // namespace
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
bool operator==(const VncClientConnection::FrameBufferUpdateRequest& lhs,
const VncClientConnection::FrameBufferUpdateRequest& rhs) {
@@ -143,7 +143,7 @@
return !(lhs == rhs);
}
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
VncClientConnection::VncClientConnection(
ClientSocket client, std::shared_ptr<VirtualInputs> virtual_inputs,
@@ -258,7 +258,7 @@
void VncClientConnection::SendServerInit() {
const std::string server_name = HostName();
std::lock_guard<std::mutex> guard(m_);
- auto server_init = cvd::CreateMessage(
+ auto server_init = cuttlefish::CreateMessage(
static_cast<std::uint16_t>(ScreenWidth()),
static_cast<std::uint16_t>(ScreenHeight()), pixel_format_.bits_per_pixel,
pixel_format_.depth, pixel_format_.big_endian, pixel_format_.true_color,
@@ -272,7 +272,7 @@
Message VncClientConnection::MakeFrameBufferUpdateHeader(
std::uint16_t num_stripes) {
- return cvd::CreateMessage(std::uint8_t{0}, // message-type
+ return cuttlefish::CreateMessage(std::uint8_t{0}, // message-type
std::uint8_t{}, // padding
std::uint16_t{num_stripes});
}
@@ -280,7 +280,7 @@
void VncClientConnection::AppendRawStripeHeader(Message* frame_buffer_update,
const Stripe& stripe) {
static constexpr int32_t kRawEncoding = 0;
- cvd::AppendToMessage(frame_buffer_update, std::uint16_t{stripe.x},
+ cuttlefish::AppendToMessage(frame_buffer_update, std::uint16_t{stripe.x},
std::uint16_t{stripe.y}, std::uint16_t{stripe.width},
std::uint16_t{stripe.height}, kRawEncoding);
}
@@ -292,11 +292,11 @@
constexpr size_t kJpegSizeThreeByteMax = 4194303;
if (jpeg_size <= kJpegSizeOneByteMax) {
- cvd::AppendToMessage(frame_buffer_update,
+ cuttlefish::AppendToMessage(frame_buffer_update,
static_cast<std::uint8_t>(jpeg_size));
} else if (jpeg_size <= kJpegSizeTwoByteMax) {
auto sz = static_cast<std::uint32_t>(jpeg_size);
- cvd::AppendToMessage(frame_buffer_update,
+ cuttlefish::AppendToMessage(frame_buffer_update,
static_cast<std::uint8_t>((sz & 0x7F) | 0x80),
static_cast<std::uint8_t>((sz >> 7) & 0xFF));
} else {
@@ -305,7 +305,7 @@
<< kJpegSizeThreeByteMax;
}
const auto sz = static_cast<std::uint32_t>(jpeg_size);
- cvd::AppendToMessage(frame_buffer_update,
+ cuttlefish::AppendToMessage(frame_buffer_update,
static_cast<std::uint8_t>((sz & 0x7F) | 0x80),
static_cast<std::uint8_t>(((sz >> 7) & 0x7F) | 0x80),
static_cast<std::uint8_t>((sz >> 14) & 0xFF));
@@ -353,7 +353,7 @@
void VncClientConnection::AppendJpegStripeHeader(Message* frame_buffer_update,
const Stripe& stripe) {
static constexpr std::uint8_t kJpegEncoding = 0x90;
- cvd::AppendToMessage(frame_buffer_update, stripe.x, stripe.y, stripe.width,
+ cuttlefish::AppendToMessage(frame_buffer_update, stripe.x, stripe.y, stripe.width,
stripe.height, kTightEncoding, kJpegEncoding);
AppendJpegSize(frame_buffer_update, stripe.jpeg_data.size());
}
@@ -411,7 +411,7 @@
void VncClientConnection::SendDesktopSizeUpdate() {
static constexpr int32_t kDesktopSizeEncoding = -223;
- client_.SendNoSignal(cvd::CreateMessage(
+ client_.SendNoSignal(cuttlefish::CreateMessage(
std::uint8_t{0}, // message-type,
std::uint8_t{}, // padding
std::uint16_t{1}, // one pseudo rectangle
@@ -574,13 +574,13 @@
return false;
}
switch (key) {
- case cvd::xk::Right:
- case cvd::xk::F12:
+ case cuttlefish::xk::Right:
+ case cuttlefish::xk::F12:
DLOG(INFO) << "switching to portrait";
SetScreenOrientation(ScreenOrientation::Portrait);
break;
- case cvd::xk::Left:
- case cvd::xk::F11:
+ case cuttlefish::xk::Left:
+ case cuttlefish::xk::F11:
DLOG(INFO) << "switching to landscape";
SetScreenOrientation(ScreenOrientation::Landscape);
break;
@@ -599,18 +599,18 @@
auto key = uint32_tAt(&msg[3]);
bool key_down = msg[0];
switch (key) {
- case cvd::xk::ControlLeft:
- case cvd::xk::ControlRight:
+ case cuttlefish::xk::ControlLeft:
+ case cuttlefish::xk::ControlRight:
control_key_down_ = key_down;
break;
- case cvd::xk::MetaLeft:
- case cvd::xk::MetaRight:
+ case cuttlefish::xk::MetaLeft:
+ case cuttlefish::xk::MetaRight:
meta_key_down_ = key_down;
break;
- case cvd::xk::F5:
- key = cvd::xk::Menu;
+ case cuttlefish::xk::F5:
+ key = cuttlefish::xk::Menu;
break;
- case cvd::xk::F7:
+ case cuttlefish::xk::F7:
virtual_inputs_->PressPowerButton(key_down);
return;
default:
diff --git a/host/frontend/vnc_server/vnc_client_connection.h b/host/frontend/vnc_server/vnc_client_connection.h
index 9f4fb96..4a378ca 100644
--- a/host/frontend/vnc_server/vnc_client_connection.h
+++ b/host/frontend/vnc_server/vnc_client_connection.h
@@ -30,7 +30,7 @@
#include "host/frontend/vnc_server/virtual_inputs.h"
#include "host/frontend/vnc_server/vnc_utils.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class VncClientConnection {
@@ -170,4 +170,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/vnc_server.cpp b/host/frontend/vnc_server/vnc_server.cpp
index f9778a7..85c6e09 100644
--- a/host/frontend/vnc_server/vnc_server.cpp
+++ b/host/frontend/vnc_server/vnc_server.cpp
@@ -25,7 +25,7 @@
#include "host/frontend/vnc_server/vnc_client_connection.h"
#include "host/frontend/vnc_server/vnc_utils.h"
-using cvd::vnc::VncServer;
+using cuttlefish::vnc::VncServer;
VncServer::VncServer(int port, bool aggressive)
: server_(port),
diff --git a/host/frontend/vnc_server/vnc_server.h b/host/frontend/vnc_server/vnc_server.h
index 66e17e0..75b1332 100644
--- a/host/frontend/vnc_server/vnc_server.h
+++ b/host/frontend/vnc_server/vnc_server.h
@@ -29,7 +29,7 @@
#include "host/frontend/vnc_server/vnc_client_connection.h"
#include "host/frontend/vnc_server/vnc_utils.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
class VncServer {
@@ -54,4 +54,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/frontend/vnc_server/vnc_utils.h b/host/frontend/vnc_server/vnc_utils.h
index 7a80518..83a12a2 100644
--- a/host/frontend/vnc_server/vnc_utils.h
+++ b/host/frontend/vnc_server/vnc_utils.h
@@ -25,7 +25,7 @@
#include "common/libs/tcp_socket/tcp_socket.h"
#include "host/libs/config/cuttlefish_config.h"
-namespace cvd {
+namespace cuttlefish {
namespace vnc {
// TODO(haining) when the hwcomposer gives a sequence number type, use that
@@ -64,4 +64,4 @@
};
} // namespace vnc
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index 6539bd3..5486e1b 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -198,7 +198,7 @@
std::string DefaultEnvironmentPath(const char* environment_key,
const char* default_value,
const char* subpath) {
- return cvd::StringFromEnv(environment_key, default_value) + "/" + subpath;
+ return cuttlefish::StringFromEnv(environment_key, default_value) + "/" + subpath;
}
Json::Value* CuttlefishConfig::MutableInstanceSpecific::Dictionary() {
@@ -298,7 +298,7 @@
void CuttlefishConfig::SetPath(const std::string& key,
const std::string& path) {
if (!path.empty()) {
- (*dictionary_)[key] = cvd::AbsolutePath(path);
+ (*dictionary_)[key] = cuttlefish::AbsolutePath(path);
}
}
@@ -387,11 +387,11 @@
}
std::string CuttlefishConfig::InstanceSpecific::kernel_log_pipe_name() const {
- return cvd::AbsolutePath(PerInstanceInternalPath("kernel-log-pipe"));
+ return cuttlefish::AbsolutePath(PerInstanceInternalPath("kernel-log-pipe"));
}
std::string CuttlefishConfig::InstanceSpecific::console_pipe_name() const {
- return cvd::AbsolutePath(PerInstanceInternalPath("console-pipe"));
+ return cuttlefish::AbsolutePath(PerInstanceInternalPath("console-pipe"));
}
bool CuttlefishConfig::deprecated_boot_completed() const {
@@ -403,32 +403,32 @@
}
std::string CuttlefishConfig::InstanceSpecific::access_kregistry_path() const {
- return cvd::AbsolutePath(PerInstancePath("access-kregistry"));
+ return cuttlefish::AbsolutePath(PerInstancePath("access-kregistry"));
}
std::string CuttlefishConfig::InstanceSpecific::pstore_path() const {
- return cvd::AbsolutePath(PerInstancePath("pstore"));
+ return cuttlefish::AbsolutePath(PerInstancePath("pstore"));
}
std::string CuttlefishConfig::InstanceSpecific::console_path() const {
- return cvd::AbsolutePath(PerInstancePath("console"));
+ return cuttlefish::AbsolutePath(PerInstancePath("console"));
}
std::string CuttlefishConfig::InstanceSpecific::logcat_path() const {
- return cvd::AbsolutePath(PerInstancePath("logcat"));
+ return cuttlefish::AbsolutePath(PerInstancePath("logcat"));
}
std::string CuttlefishConfig::InstanceSpecific::launcher_monitor_socket_path()
const {
- return cvd::AbsolutePath(PerInstancePath("launcher_monitor.sock"));
+ return cuttlefish::AbsolutePath(PerInstancePath("launcher_monitor.sock"));
}
std::string CuttlefishConfig::InstanceSpecific::launcher_log_path() const {
- return cvd::AbsolutePath(PerInstancePath("launcher.log"));
+ return cuttlefish::AbsolutePath(PerInstancePath("launcher.log"));
}
std::string CuttlefishConfig::InstanceSpecific::sdcard_path() const {
- return cvd::AbsolutePath(PerInstancePath("sdcard.img"));
+ return cuttlefish::AbsolutePath(PerInstancePath("sdcard.img"));
}
std::string CuttlefishConfig::InstanceSpecific::mobile_bridge_name() const {
@@ -1100,7 +1100,7 @@
// the config file if the CUTTLEFISH_CONFIG_FILE env variable is present.
// Returns nullptr if there was an error loading from file
/*static*/ CuttlefishConfig* CuttlefishConfig::BuildConfigImpl() {
- auto config_file_path = cvd::StringFromEnv(kCuttlefishConfigEnvVarName,
+ auto config_file_path = cuttlefish::StringFromEnv(kCuttlefishConfigEnvVarName,
vsoc::GetGlobalConfigFileLink());
auto ret = new CuttlefishConfig();
if (ret) {
@@ -1119,10 +1119,10 @@
}
/*static*/ bool CuttlefishConfig::ConfigExists() {
- auto config_file_path = cvd::StringFromEnv(kCuttlefishConfigEnvVarName,
+ auto config_file_path = cuttlefish::StringFromEnv(kCuttlefishConfigEnvVarName,
vsoc::GetGlobalConfigFileLink());
- auto real_file_path = cvd::AbsolutePath(config_file_path.c_str());
- return cvd::FileExists(real_file_path);
+ auto real_file_path = cuttlefish::AbsolutePath(config_file_path.c_str());
+ return cuttlefish::FileExists(real_file_path);
}
CuttlefishConfig::CuttlefishConfig() : dictionary_(new Json::Value()) {}
@@ -1134,7 +1134,7 @@
CuttlefishConfig& CuttlefishConfig::operator=(CuttlefishConfig&&) = default;
bool CuttlefishConfig::LoadFromFile(const char* file) {
- auto real_file_path = cvd::AbsolutePath(file);
+ auto real_file_path = cuttlefish::AbsolutePath(file);
if (real_file_path.empty()) {
LOG(ERROR) << "Could not get real path for file " << file;
return false;
@@ -1160,7 +1160,7 @@
std::string CuttlefishConfig::AssemblyPath(
const std::string& file_name) const {
- return cvd::AbsolutePath(assembly_dir() + "/" + file_name);
+ return cuttlefish::AbsolutePath(assembly_dir() + "/" + file_name);
}
std::string CuttlefishConfig::composite_disk_path() const {
@@ -1229,15 +1229,15 @@
}
std::string DefaultHostArtifactsPath(const std::string& file_name) {
- return (cvd::StringFromEnv("ANDROID_HOST_OUT",
- cvd::StringFromEnv("HOME", ".")) +
+ return (cuttlefish::StringFromEnv("ANDROID_HOST_OUT",
+ cuttlefish::StringFromEnv("HOME", ".")) +
"/") +
file_name;
}
std::string DefaultGuestImagePath(const std::string& file_name) {
- return (cvd::StringFromEnv("ANDROID_PRODUCT_OUT",
- cvd::StringFromEnv("HOME", "."))) +
+ return (cuttlefish::StringFromEnv("ANDROID_PRODUCT_OUT",
+ cuttlefish::StringFromEnv("HOME", "."))) +
file_name;
}
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index da4df8c..47e9f57 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -25,7 +25,7 @@
class Value;
}
-namespace cvd {
+namespace cuttlefish {
constexpr char kLogcatSerialMode[] = "serial";
constexpr char kLogcatVsockMode[] = "vsock";
}
diff --git a/host/libs/config/fetcher_config.cpp b/host/libs/config/fetcher_config.cpp
index adbc7ea..0a50ff1 100644
--- a/host/libs/config/fetcher_config.cpp
+++ b/host/libs/config/fetcher_config.cpp
@@ -27,7 +27,7 @@
#include "common/libs/utils/files.h"
-namespace cvd {
+namespace cuttlefish {
namespace {
@@ -110,7 +110,7 @@
}
bool FetcherConfig::LoadFromFile(const std::string& file) {
- auto real_file_path = cvd::AbsolutePath(file);
+ auto real_file_path = cuttlefish::AbsolutePath(file);
if (real_file_path.empty()) {
LOG(ERROR) << "Could not get real path for file " << file;
return false;
@@ -213,4 +213,4 @@
return "";
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/config/fetcher_config.h b/host/libs/config/fetcher_config.h
index 825fbc6..fe252e9 100644
--- a/host/libs/config/fetcher_config.h
+++ b/host/libs/config/fetcher_config.h
@@ -23,7 +23,7 @@
class Value;
}
-namespace cvd {
+namespace cuttlefish {
// Order in enum is not guaranteed to be stable, serialized as a string.
enum FileSource {
@@ -82,4 +82,4 @@
std::string FindCvdFileWithSuffix(const std::string& suffix) const;
};
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/config/kernel_args.cpp b/host/libs/config/kernel_args.cpp
index ba1ab0e..158f789 100644
--- a/host/libs/config/kernel_args.cpp
+++ b/host/libs/config/kernel_args.cpp
@@ -90,7 +90,7 @@
kernel_cmdline.push_back("androidboot.tombstone_transmit=0");
}
- if (config.logcat_mode() == cvd::kLogcatVsockMode && instance.logcat_port()) {
+ if (config.logcat_mode() == cuttlefish::kLogcatVsockMode && instance.logcat_port()) {
kernel_cmdline.push_back(concat("androidboot.vsock_logcat_port=", instance.logcat_port()));
}
diff --git a/host/libs/config/logging.cpp b/host/libs/config/logging.cpp
index 7ff88c7..c56a31c 100644
--- a/host/libs/config/logging.cpp
+++ b/host/libs/config/logging.cpp
@@ -22,7 +22,7 @@
using android::base::SetLogger;
-namespace cvd {
+namespace cuttlefish {
void DefaultSubprocessLogging(char* argv[]) {
::android::base::InitLogging(argv, android::base::StderrLogger);
@@ -40,4 +40,4 @@
}
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/config/logging.h b/host/libs/config/logging.h
index f66ed1e..5d57c6f 100644
--- a/host/libs/config/logging.h
+++ b/host/libs/config/logging.h
@@ -15,8 +15,8 @@
#pragma once
-namespace cvd {
+namespace cuttlefish {
void DefaultSubprocessLogging(char* argv[]);
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/screen_connector/screen_connector.cpp b/host/libs/screen_connector/screen_connector.cpp
index 132a894..f5eae7e 100644
--- a/host/libs/screen_connector/screen_connector.cpp
+++ b/host/libs/screen_connector/screen_connector.cpp
@@ -22,7 +22,7 @@
#include "host/libs/screen_connector/socket_based_screen_connector.h"
#include "host/libs/screen_connector/wayland_screen_connector.h"
-namespace cvd {
+namespace cuttlefish {
ScreenConnector* ScreenConnector::Get(int frames_fd) {
auto config = vsoc::CuttlefishConfig::Get();
@@ -37,4 +37,4 @@
}
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/screen_connector/screen_connector.h b/host/libs/screen_connector/screen_connector.h
index 3a0e0e2..5e0f5cd 100644
--- a/host/libs/screen_connector/screen_connector.h
+++ b/host/libs/screen_connector/screen_connector.h
@@ -22,7 +22,7 @@
#include "common/libs/utils/size_utils.h"
#include "host/libs/config/cuttlefish_config.h"
-namespace cvd {
+namespace cuttlefish {
using FrameCallback = std::function<void(std::uint32_t /*frame_number*/,
std::uint8_t* /*frame_pixels*/)>;
@@ -62,4 +62,4 @@
ScreenConnector() = default;
};
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/host/libs/screen_connector/socket_based_screen_connector.cpp b/host/libs/screen_connector/socket_based_screen_connector.cpp
index dec73a2..d7d2168 100644
--- a/host/libs/screen_connector/socket_based_screen_connector.cpp
+++ b/host/libs/screen_connector/socket_based_screen_connector.cpp
@@ -20,7 +20,7 @@
#include "common/libs/fs/shared_fd.h"
-namespace cvd {
+namespace cuttlefish {
SocketBasedScreenConnector::SocketBasedScreenConnector(int frames_fd) {
screen_server_thread_ =
@@ -102,4 +102,4 @@
}
new_frame_cond_var_.notify_all();
}
-} // namespace cvd
+} // namespace cuttlefish
diff --git a/host/libs/screen_connector/socket_based_screen_connector.h b/host/libs/screen_connector/socket_based_screen_connector.h
index 0ed8414..1163e85 100644
--- a/host/libs/screen_connector/socket_based_screen_connector.h
+++ b/host/libs/screen_connector/socket_based_screen_connector.h
@@ -25,7 +25,7 @@
#include <thread>
#include <vector>
-namespace cvd {
+namespace cuttlefish {
class SocketBasedScreenConnector : public ScreenConnector {
public:
@@ -51,4 +51,4 @@
std::thread screen_server_thread_;
};
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/host/libs/screen_connector/wayland_screen_connector.cpp b/host/libs/screen_connector/wayland_screen_connector.cpp
index 4725e85..7713214 100644
--- a/host/libs/screen_connector/wayland_screen_connector.cpp
+++ b/host/libs/screen_connector/wayland_screen_connector.cpp
@@ -25,7 +25,7 @@
#include "host/libs/wayland/wayland_server.h"
-namespace cvd {
+namespace cuttlefish {
WaylandScreenConnector::WaylandScreenConnector(int frames_fd) {
int wayland_fd = fcntl(frames_fd, F_DUPFD_CLOEXEC, 3);
@@ -45,4 +45,4 @@
return true;
}
-} // namespace cvd
\ No newline at end of file
+} // namespace cuttlefish
\ No newline at end of file
diff --git a/host/libs/screen_connector/wayland_screen_connector.h b/host/libs/screen_connector/wayland_screen_connector.h
index 537bb31..a3ab518 100644
--- a/host/libs/screen_connector/wayland_screen_connector.h
+++ b/host/libs/screen_connector/wayland_screen_connector.h
@@ -22,7 +22,7 @@
#include "host/libs/wayland/wayland_server.h"
-namespace cvd {
+namespace cuttlefish {
class WaylandScreenConnector : public ScreenConnector {
public:
diff --git a/host/libs/vm_manager/crosvm_manager.cpp b/host/libs/vm_manager/crosvm_manager.cpp
index 637e829..e37f788 100644
--- a/host/libs/vm_manager/crosvm_manager.cpp
+++ b/host/libs/vm_manager/crosvm_manager.cpp
@@ -42,9 +42,9 @@
.PerInstanceInternalPath("crosvm_control.sock");
}
-cvd::SharedFD AddTapFdParameter(cvd::Command* crosvm_cmd,
+cuttlefish::SharedFD AddTapFdParameter(cuttlefish::Command* crosvm_cmd,
const std::string& tap_name) {
- auto tap_fd = cvd::OpenTapInterface(tap_name);
+ auto tap_fd = cuttlefish::OpenTapInterface(tap_name);
if (tap_fd->IsOpen()) {
crosvm_cmd->AddParameter("--tap-fd=", tap_fd);
} else {
@@ -54,17 +54,17 @@
return tap_fd;
}
-bool ReleaseDhcpLeases(const std::string& lease_path, cvd::SharedFD tap_fd) {
- auto lease_file_fd = cvd::SharedFD::Open(lease_path, O_RDONLY);
+bool ReleaseDhcpLeases(const std::string& lease_path, cuttlefish::SharedFD tap_fd) {
+ auto lease_file_fd = cuttlefish::SharedFD::Open(lease_path, O_RDONLY);
if (!lease_file_fd->IsOpen()) {
LOG(ERROR) << "Could not open leases file \"" << lease_path << '"';
return false;
}
bool success = true;
- auto dhcp_leases = cvd::ParseDnsmasqLeases(lease_file_fd);
+ auto dhcp_leases = cuttlefish::ParseDnsmasqLeases(lease_file_fd);
for (auto& lease : dhcp_leases) {
std::uint8_t dhcp_server_ip[] = {192, 168, 96, (std::uint8_t) (vsoc::ForCurrentInstance(1) * 4 - 3)};
- if (!cvd::ReleaseDhcp4(tap_fd, lease.mac_address, lease.ip_address, dhcp_server_ip)) {
+ if (!cuttlefish::ReleaseDhcp4(tap_fd, lease.mac_address, lease.ip_address, dhcp_server_ip)) {
LOG(ERROR) << "Failed to release " << lease;
success = false;
} else {
@@ -76,7 +76,7 @@
bool Stop() {
auto config = vsoc::CuttlefishConfig::Get();
- cvd::Command command(config->crosvm_binary());
+ cuttlefish::Command command(config->crosvm_binary());
command.AddParameter("stop");
command.AddParameter(GetControlSocketPath(config));
@@ -108,7 +108,7 @@
// fresh machine after a boot will fail because the Nvidia EGL library will fork to run the
// nvidia-modprobe command and the main Crosvm process will abort after receiving the exit signal
// of the forked child which is interpreted as a failure.
- cvd::Command modprobe_cmd("/usr/bin/nvidia-modprobe");
+ cuttlefish::Command modprobe_cmd("/usr/bin/nvidia-modprobe");
modprobe_cmd.AddParameter("--modeset");
modprobe_cmd.Start().Wait();
@@ -134,7 +134,7 @@
std::vector<std::string> CrosvmManager::ConfigureBootDevices() {
// PCI domain 0, bus 0, device 1, function 0
// TODO There is no way to control this assignment with crosvm (yet)
- if (cvd::HostArch() == "x86_64") {
+ if (cuttlefish::HostArch() == "x86_64") {
return { "androidboot.boot_devices=pci0000:00/0000:00:01.0" };
} else {
return { "androidboot.boot_devices=10000.pci" };
@@ -144,9 +144,9 @@
CrosvmManager::CrosvmManager(const vsoc::CuttlefishConfig* config)
: VmManager(config) {}
-std::vector<cvd::Command> CrosvmManager::StartCommands() {
+std::vector<cuttlefish::Command> CrosvmManager::StartCommands() {
auto instance = config_->ForDefaultInstance();
- cvd::Command crosvm_cmd(config_->crosvm_binary(), [](cvd::Subprocess* proc) {
+ cuttlefish::Command crosvm_cmd(config_->crosvm_binary(), [](cuttlefish::Subprocess* proc) {
auto stopped = Stop();
if (stopped) {
return true;
@@ -194,12 +194,12 @@
crosvm_cmd.AddParameter("--rw-pmem-device=", instance.access_kregistry_path());
crosvm_cmd.AddParameter("--pstore=path=", instance.pstore_path(), ",size=",
- cvd::FileSize(instance.pstore_path()));
+ cuttlefish::FileSize(instance.pstore_path()));
if (config_->enable_sandbox()) {
- const bool seccomp_exists = cvd::DirectoryExists(config_->seccomp_policy_dir());
+ const bool seccomp_exists = cuttlefish::DirectoryExists(config_->seccomp_policy_dir());
const std::string& var_empty_dir = vsoc::kCrosvmVarEmptyDir;
- const bool var_empty_available = cvd::DirectoryExists(var_empty_dir);
+ const bool var_empty_available = cuttlefish::DirectoryExists(var_empty_dir);
if (!var_empty_available || !seccomp_exists) {
LOG(FATAL) << var_empty_dir << " is not an existing, empty directory."
<< "seccomp-policy-dir, " << config_->seccomp_policy_dir()
@@ -221,8 +221,8 @@
// Redirect standard input to a pipe for the console forwarder host process
// to handle.
- cvd::SharedFD console_in_rd, console_in_wr;
- if (!cvd::SharedFD::Pipe(&console_in_rd, &console_in_wr)) {
+ cuttlefish::SharedFD console_in_rd, console_in_wr;
+ if (!cuttlefish::SharedFD::Pipe(&console_in_rd, &console_in_wr)) {
LOG(ERROR) << "Failed to create console pipe for crosvm's stdin: "
<< console_in_rd->StrError();
return {};
@@ -237,8 +237,8 @@
// This fd will only be read from, but it's open with write access as well to
// keep the pipe open in case the subprocesses exit.
- cvd::SharedFD console_out_rd =
- cvd::SharedFD::Open(console_pipe_name.c_str(), O_RDWR);
+ cuttlefish::SharedFD console_out_rd =
+ cuttlefish::SharedFD::Open(console_pipe_name.c_str(), O_RDWR);
if (!console_out_rd->IsOpen()) {
LOG(ERROR) << "Failed to open console fifo for reads: "
<< console_out_rd->StrError();
@@ -251,24 +251,24 @@
crosvm_cmd.AddParameter("--serial=num=2,type=file,path=", console_pipe_name,
",stdin=true");
- crosvm_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdIn,
+ crosvm_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdIn,
console_in_rd);
- cvd::Command console_cmd(config_->console_forwarder_binary());
+ cuttlefish::Command console_cmd(config_->console_forwarder_binary());
console_cmd.AddParameter("--console_in_fd=", console_in_wr);
console_cmd.AddParameter("--console_out_fd=", console_out_rd);
- cvd::SharedFD log_out_rd, log_out_wr;
- if (!cvd::SharedFD::Pipe(&log_out_rd, &log_out_wr)) {
+ cuttlefish::SharedFD log_out_rd, log_out_wr;
+ if (!cuttlefish::SharedFD::Pipe(&log_out_rd, &log_out_wr)) {
LOG(ERROR) << "Failed to create log pipe for crosvm's stdout/stderr: "
<< console_in_rd->StrError();
return {};
}
- crosvm_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdOut,
+ crosvm_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdOut,
log_out_wr);
- crosvm_cmd.RedirectStdIO(cvd::Subprocess::StdIOChannel::kStdErr,
+ crosvm_cmd.RedirectStdIO(cuttlefish::Subprocess::StdIOChannel::kStdErr,
log_out_wr);
- cvd::Command log_tee_cmd(vsoc::DefaultHostArtifactsPath("bin/log_tee"));
+ cuttlefish::Command log_tee_cmd(vsoc::DefaultHostArtifactsPath("bin/log_tee"));
log_tee_cmd.AddParameter("--process_name=crosvm");
log_tee_cmd.AddParameter("--log_fd_in=", log_out_rd);
@@ -285,7 +285,7 @@
<< "network may not work.";
}
- std::vector<cvd::Command> ret;
+ std::vector<cuttlefish::Command> ret;
ret.push_back(std::move(crosvm_cmd));
ret.push_back(std::move(console_cmd));
ret.push_back(std::move(log_tee_cmd));
diff --git a/host/libs/vm_manager/crosvm_manager.h b/host/libs/vm_manager/crosvm_manager.h
index 848f2ae..2ea9993 100644
--- a/host/libs/vm_manager/crosvm_manager.h
+++ b/host/libs/vm_manager/crosvm_manager.h
@@ -37,7 +37,7 @@
CrosvmManager(const vsoc::CuttlefishConfig* config);
virtual ~CrosvmManager() = default;
- std::vector<cvd::Command> StartCommands() override;
+ std::vector<cuttlefish::Command> StartCommands() override;
};
} // namespace vm_manager
diff --git a/host/libs/vm_manager/qemu_manager.cpp b/host/libs/vm_manager/qemu_manager.cpp
index f08d66c..4ab0e91 100644
--- a/host/libs/vm_manager/qemu_manager.cpp
+++ b/host/libs/vm_manager/qemu_manager.cpp
@@ -56,7 +56,7 @@
bool Stop() {
auto config = vsoc::CuttlefishConfig::Get();
auto monitor_path = GetMonitorPath(config);
- auto monitor_sock = cvd::SharedFD::SocketLocalClient(
+ auto monitor_sock = cuttlefish::SharedFD::SocketLocalClient(
monitor_path.c_str(), false, SOCK_STREAM);
if (!monitor_sock->IsOpen()) {
@@ -112,10 +112,10 @@
QemuManager::QemuManager(const vsoc::CuttlefishConfig* config)
: VmManager(config) {}
-std::vector<cvd::Command> QemuManager::StartCommands() {
+std::vector<cuttlefish::Command> QemuManager::StartCommands() {
auto instance = config_->ForDefaultInstance();
- auto stop = [](cvd::Subprocess* proc) {
+ auto stop = [](cuttlefish::Subprocess* proc) {
auto stopped = Stop();
if (stopped) {
return true;
@@ -127,7 +127,7 @@
bool is_arm = android::base::EndsWith(config_->qemu_binary(), "system-aarch64");
- cvd::Command qemu_cmd(config_->qemu_binary(), stop);
+ cuttlefish::Command qemu_cmd(config_->qemu_binary(), stop);
qemu_cmd.AddParameter("-name");
qemu_cmd.AddParameter("guest=", instance.instance_name(), ",debug-threads=on");
@@ -271,7 +271,7 @@
LogAndSetEnv("QEMU_AUDIO_DRV", "none");
- std::vector<cvd::Command> ret;
+ std::vector<cuttlefish::Command> ret;
ret.push_back(std::move(qemu_cmd));
return ret;
}
diff --git a/host/libs/vm_manager/qemu_manager.h b/host/libs/vm_manager/qemu_manager.h
index 4b04876..a1cbaab 100644
--- a/host/libs/vm_manager/qemu_manager.h
+++ b/host/libs/vm_manager/qemu_manager.h
@@ -35,7 +35,7 @@
QemuManager(const vsoc::CuttlefishConfig* config);
virtual ~QemuManager() = default;
- std::vector<cvd::Command> StartCommands() override;
+ std::vector<cuttlefish::Command> StartCommands() override;
};
} // namespace vm_manager
diff --git a/host/libs/vm_manager/vm_manager.cpp b/host/libs/vm_manager/vm_manager.cpp
index ceea865..df44106 100644
--- a/host/libs/vm_manager/vm_manager.cpp
+++ b/host/libs/vm_manager/vm_manager.cpp
@@ -108,7 +108,7 @@
bool VmManager::UserInGroup(const std::string& group,
std::vector<std::string>* config_commands) {
- if (!cvd::InGroup(group)) {
+ if (!cuttlefish::InGroup(group)) {
LOG(ERROR) << "User must be a member of " << group;
config_commands->push_back("# Add your user to the " + group + " group:");
config_commands->push_back("sudo usermod -aG " + group + " $USER");
@@ -161,7 +161,7 @@
auto in_cvdnetwork = VmManager::UserInGroup("cvdnetwork", config_commands);
// if we're in the virtaccess group this is likely to be a CrOS environment.
- auto is_cros = cvd::InGroup("virtaccess");
+ auto is_cros = cuttlefish::InGroup("virtaccess");
if (is_cros) {
// relax the minimum kernel requirement slightly, as chromeos-4.4 has the
// needed backports to enable vhost_vsock
diff --git a/host/libs/vm_manager/vm_manager.h b/host/libs/vm_manager/vm_manager.h
index a86218c..33995b2 100644
--- a/host/libs/vm_manager/vm_manager.h
+++ b/host/libs/vm_manager/vm_manager.h
@@ -52,7 +52,7 @@
// command_starter function, although it may start more than one. The
// command_starter function allows to customize the way vmm commands are
// started/tracked/etc.
- virtual std::vector<cvd::Command> StartCommands() = 0;
+ virtual std::vector<cuttlefish::Command> StartCommands() = 0;
virtual bool ValidateHostConfiguration(
std::vector<std::string>* config_commands) const;