summaryrefslogtreecommitdiff
path: root/adb/daemon/file_sync_service.cpp
diff options
context:
space:
mode:
authorJosh Gao <jmgao@google.com>2020-02-19 13:50:57 -0800
committerJosh Gao <jmgao@google.com>2020-02-19 17:44:38 -0800
commita9b62d545275ca32775a0bc5f004abe03aaa38ad (patch)
tree8e841befacffad8815aef83332abd711a08200a0 /adb/daemon/file_sync_service.cpp
parent2dd81da3b48f37ba82db6dd70b8e22dd688086e0 (diff)
adbd: remove static dependency on libcutils.
We were previously statically linking libcutils into adbd for several different reasons, which were addressed as follows: socket functions: extracted to a statically linked libcutils_network fs_config: wrapped with a shared library on /system ATRACE: deleted the single use in adbd Test: treehugger Change-Id: I821fa174cfcbfa8e29a4be10de4016b817adbaf8
Diffstat (limited to 'adb/daemon/file_sync_service.cpp')
-rw-r--r--adb/daemon/file_sync_service.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/adb/daemon/file_sync_service.cpp b/adb/daemon/file_sync_service.cpp
index d6af7087d..edf5683d3 100644
--- a/adb/daemon/file_sync_service.cpp
+++ b/adb/daemon/file_sync_service.cpp
@@ -40,10 +40,13 @@
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <private/android_filesystem_config.h>
+#include <adbd_fs.h>
+
+// Needed for __android_log_security_bswrite.
#include <private/android_logger.h>
#if defined(__ANDROID__)
+#include <linux/capability.h>
#include <selinux/android.h>
#include <sys/xattr.h>
#endif
@@ -98,7 +101,7 @@ static bool secure_mkdirs(const std::string& path) {
for (const auto& path_component : path_components) {
uid_t uid = -1;
gid_t gid = -1;
- unsigned int mode = 0775;
+ mode_t mode = 0775;
uint64_t capabilities = 0;
if (path_component.empty()) {
@@ -111,7 +114,7 @@ static bool secure_mkdirs(const std::string& path) {
partial_path += path_component;
if (should_use_fs_config(partial_path)) {
- fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
+ adbd_fs_config(partial_path.c_str(), 1, nullptr, &uid, &gid, &mode, &capabilities);
}
if (adb_mkdir(partial_path.c_str(), mode) == -1) {
if (errno != EEXIST) {
@@ -468,9 +471,7 @@ static bool do_send(int s, const std::string& spec, std::vector<char>& buffer) {
gid_t gid = -1;
uint64_t capabilities = 0;
if (should_use_fs_config(path)) {
- unsigned int broken_api_hack = mode;
- fs_config(path.c_str(), 0, nullptr, &uid, &gid, &broken_api_hack, &capabilities);
- mode = broken_api_hack;
+ adbd_fs_config(path.c_str(), 0, nullptr, &uid, &gid, &mode, &capabilities);
}
result = handle_send_file(s, path.c_str(), &timestamp, uid, gid, capabilities, mode, buffer,
@@ -550,7 +551,6 @@ static const char* sync_id_to_name(uint32_t id) {
static bool handle_sync_command(int fd, std::vector<char>& buffer) {
D("sync: waiting for request");
- ATRACE_CALL();
SyncRequest request;
if (!ReadFdExactly(fd, &request, sizeof(request))) {
SendSyncFail(fd, "command read failure");
@@ -569,8 +569,6 @@ static bool handle_sync_command(int fd, std::vector<char>& buffer) {
name[path_length] = 0;
std::string id_name = sync_id_to_name(request.id);
- std::string trace_name = StringPrintf("%s(%s)", id_name.c_str(), name);
- ATRACE_NAME(trace_name.c_str());
D("sync: %s('%s')", id_name.c_str(), name);
switch (request.id) {