History log of /system/core/adb/file_sync_service.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
792581f1835a425432632bca052deb478276f25f 03-Apr-2018 Elliott Hughes <enh@google.com> Support /odm and /product in "adb remount" and "adb sync".

Bug: http://b/77587036
Test: `adb remount` and `adb sync` still work on hikey

(cherry picked from commit 57e97cb7aac9873745ca14dcb005d61fda6a65d0)

Change-Id: Ie49d703dac04e2fb8eda420b9253b8d45b6e1479
/system/core/adb/file_sync_service.cpp
65b8d749f71d7962831e87600dd6137566c3c281 27-Nov-2017 Nick Kralevich <nnk@google.com> Standarize on VFS_CAP_REVISION_2

In https://github.com/torvalds/linux/commit/8db6c34f1dbc8 , namespaced
file capabilities were introduced. That change updated VFS_CAP_REVISION
from VFS_CAP_REVISION_2 to VFS_CAP_REVISION_3.

Android code is written assuming v2 capabilities, and the code will
break if we naively try to treat a v2 structure as a v3 structure.
So don't even try.

Android kernels prior to v4.14 will not support this extended capability
structure, so attempting to set such capabilities will ultimately fail.

With 8db6c34f1dbc8, it appears that attempting to read a v3 capabilities
xattr will always downgrade the capability to a v2 capability, so it
really doesn't make sense to look for a v3 capability.

Android capabilities are only created at /system and /vendor filesystem
creation time by host tools. Android processes, within or outside a
namespace, are not permitted CAP_SETFCAP
(https://android-review.googlesource.com/c/platform/system/sepolicy/+/547801/1/public/domain.te
line 1101). So we should never have to deal with a v3 capability other
than those that might appear on the /system / /vendor partition at a
future date by a future author.

Bug: 69617725
Test: build/test/boot/CTS passes
Change-Id: I0378b3f1195dc62dbeb771944ab378c881441118
/system/core/adb/file_sync_service.cpp
aaa90cfe0697d77da7a34a1b6d6145dfe9f904f6 29-Aug-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "adb: Use kernel aio for functionfs."
1d6c01b53d4b40476225f7e074cbd7c4d50dda04 28-Aug-2017 Josh Gao <jmgao@google.com> adbd: don't spin if file sync read fails.

Bug: http://b/64508974
Test: mma
Change-Id: Ifba6a9dea3138b6d2a62c91cc0532f63986c048a
/system/core/adb/file_sync_service.cpp
ecee434faea553dd190550355bf2ecfde2794059 18-Jul-2017 Jerry Zhang <zhangjerry@google.com> adb: Use kernel aio for functionfs.

This method works around the downsides of
ENDPOINT_ALLOC, namely that it is not affected
by memory fragmentation and it uses an upstream
interface.

Also add libasyncio to provide the necessary syscalls
to both adb and mtp.

Add some small optimizations to file_sync.

Bug: 37916658
Test: run adb push/pull
Change-Id: If3b3be02b5e2d4f9cffec1b8ddc02a5768a51a1f
/system/core/adb/file_sync_service.cpp
58021d15c94eb6a81d2673634956b5374af6a1e5 24-Feb-2017 Colin Cross <ccross@android.com> Move adb_dirname and adb_basename to libbase

adb already provides an implementation of dirname and basename that
take and produce std::strings, move it into libbase so it can be
used in the implementation of GetExecutableDirectory.

Test: out/host/linux-x86/nativetest64/adb_test/adb_test
Test: out/host/linux-x86/nativetest64/libbase_test/libbase_test
Test: adb shell /data/nativetest64/libbase_test/libbase_test64
Change-Id: Ideb1627607b14562121316d4ed27fa6fb0930684
/system/core/adb/file_sync_service.cpp
fd12aaa8c13e6af5e342f24f9af41f32b05eba9b 22-Nov-2016 Josh Gao <jmgao@google.com> adb: add tracing to file_sync_service.cpp.

Bug: http://b/31289465
Test: systrace
Change-Id: I186675ca0310ace0e1d35561fa0b910417dcedd7
/system/core/adb/file_sync_service.cpp
5a1e3fdaf82aee348b1b22992a8c1d15db38413b 06-Dec-2016 Josh Gao <jmgao@google.com> Revert "Revert "adb: extend sync protocol's stat support.""

This reverts commit afa4b5d6eb45bbee8671a1bb93ea70506fb326e3.

Add functions to translate errno to and from the linux asm-generic
values, since mips has different values.

Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I1a122235f3e793ed10b3bf3ad293388015134150
/system/core/adb/file_sync_service.cpp
afa4b5d6eb45bbee8671a1bb93ea70506fb326e3 05-Dec-2016 Josh Gao <jmgao@google.com> Revert "adb: extend sync protocol's stat support."

This reverts commit d6d5c38469203a63c686517d765a7e6d2bc24656.
/system/core/adb/file_sync_service.cpp
d6d5c38469203a63c686517d765a7e6d2bc24656 22-Nov-2016 Josh Gao <jmgao@google.com> adb: extend sync protocol's stat support.

Extend the file sync protocol to support calling regular stat (instead
of lstat), return error codes, and provide the entire stat struct.

Bug: http://b/33058958
Test: python test_device.py with both old and new adbd
Change-Id: I841123debc380f86194a19e91c97d85160112144
/system/core/adb/file_sync_service.cpp
d0515e71652910c3a46f5cea8be75c0cf9132556 03-Nov-2016 Jin Qian <jinqian@google.com> Set file capabilities after writing file data

File capabilities will be cleared if we set them before writing file data.

Bug: 32543395

Change-Id: I88cc0a0ec23cd6fc6dbe86c93a76914809d7e5f9
/system/core/adb/file_sync_service.cpp
6debf985aa5127b43f1f79a010dc000f733793b8 05-Oct-2016 Mark Salyzyn <salyzyn@google.com> liblog: adb: move security interfaces to private

Test: Compile & adb functioning
Bug: 19235719
Bug: 26552300
Bug: 31289077
Bug: 31456426
Change-Id: I7ad8963bcca3d8b5c37b547c11d163b652d35556
/system/core/adb/file_sync_service.cpp
ff2dcd9af994a23ed483939a416b48bdc10eefd5 29-Sep-2016 Mark Salyzyn <salyzyn@google.com> system/core Replace log/log.h with android/log.h

Should use android/log.h instead of log/log.h as a good example
to all others. Adjust header order to comply with Android Coding
standards.

Test: Compile
Bug: 26552300
Bug: 31289077
Change-Id: I33a8fb4e754d2dc4754d335660c450e0a67190fc
/system/core/adb/file_sync_service.cpp
32c60b4ced8ca0d0eaa3e32f04436a7246ad18f8 08-Jun-2016 Elliott Hughes <enh@google.com> Set file capabilities on adb sync/push.

Bug: http://b/29180022
Change-Id: Ia21ebf0972af41b0a3becc1189ed836fd74ae5c8
/system/core/adb/file_sync_service.cpp
20a96c7d792cf55c76b6291b46480e584face9bf 19-Feb-2016 Josh Gao <jmgao@google.com> adbd: restore the old error handling behavior.

Restore the previous file sync error handling behavior of reporting
failure, and then consuming packets from the other end until receiving a
DONE packet.

Bug: http://b/26816782
Change-Id: I9708f2a36c072547e191fa0b6b42dffc31f8a2f2
/system/core/adb/file_sync_service.cpp
6ad06b9ea944555a55b4a9da858f241ef07121eb 29-Jan-2016 Josh Gao <jmgao@google.com> adb: fix mistaken uses of SendFail in file_sync_service.cpp.

SendFail and SendSyncFail are similarly named, and have the same
prototype. Use `#pragma GCC poison` to prevent use of SendFail in
file_sync_service.cpp, and fix the places where it was used
accidentally.

Change-Id: I6b9a7e565b76dfab10f8ae38f889d046ad80a403
/system/core/adb/file_sync_service.cpp
d61a25c17204b74b81558cb5d67c347f1e87fef1 11-Jan-2016 Rubin Xu <rubinxu@google.com> ADB security logging

Log adb shell, pull and push operations to the security log.

Bug: 22860162
Change-Id: I5d24e9d51040ae05a41d9fcb079e84351a217bd3
/system/core/adb/file_sync_service.cpp
4f71319df011d796a60a43fc1bc68e16fbf7d321 05-Dec-2015 Elliott Hughes <enh@google.com> Track rename of base/ to android-base/.

Change-Id: Idf9444fece4aa89c93e15640de59a91f6e758ccf
/system/core/adb/file_sync_service.cpp
cc65c3b9f8edc6fb48ffe725376e65fac42851d6 21-Nov-2015 Elliott Hughes <enh@google.com> Fix "adb sync" (and "adb push") error reporting.

This patch ensures that we read any error response from the server if the
server closes the connection. Unfortunately, that's not sufficient to ensure
that we always see the server's error message --- sometimes the data just
gets thrown away because we keep writing without reading. Setting SO_LINGER
avoids this.

Bug: http://b/25230872
Change-Id: I96c019cc72bd139198de79bf29e6536cc462c20f
/system/core/adb/file_sync_service.cpp
45b6fc878ab5ba0f76b6bb1947fe04ac6667c2f5 04-Nov-2015 Josh Gao <jmgao@google.com> adb: make mkdirs/secure_mkdirs do what they say.

Previously, mkdirs/secure_mkdirs wouldn't create a directory at the
specified path, only the ones above it.

Bug: http://b/25459942
Change-Id: I70c94c4b44d90723cb4a063657fc40e5bcb3b10e
/system/core/adb/file_sync_service.cpp
65fe2516b402ed8903f2ce39a86fa0bdc2b263a6 08-Oct-2015 Elliott Hughes <enh@google.com> Use const auto&/auto&& in adb.

Change-Id: I74a7e511302e15e207906f572d181634e0ed5604
/system/core/adb/file_sync_service.cpp
56ece709b093aa7570aa2915fa98682113acc5cb 24-Sep-2015 Yabin Cui <yabinc@google.com> am e4975da3: Merge "Adb: use VLOG() to replace D() for verbose logging."

* commit 'e4975da33326295885f4c606288516d73459c68e':
Adb: use VLOG() to replace D() for verbose logging.
aed3c61c4437ebb05eadfb3bf85d6962c30b9935 23-Sep-2015 Yabin Cui <yabinc@google.com> Adb: use VLOG() to replace D() for verbose logging.

As there are too many D(), we can keep both VLOG() and D() now, and get
rid of D() gradually.

Change-Id: I2f1cb70bcab3e82c99fed939341d03f6b2216076
/system/core/adb/file_sync_service.cpp
7d0b4ada0bf539a0f48b00e211799400aa733f4d 03-Sep-2015 Yabin Cui <yabinc@google.com> am 6562c151: Merge "adb: clean up debug tracing a little."

* commit '6562c1513b2b7bd88da8b1d0c88b89e66b2dcd69':
adb: clean up debug tracing a little.
7a3f8d6691b3fbd8014a98de8455dbcfcc9629e4 03-Sep-2015 Yabin Cui <yabinc@google.com> adb: clean up debug tracing a little.

Always use LOG() for debug tracing.
Remove useless D_lock. I believe it is useless to lock just before and after fprintf.

I verified the log output both on host and on device. The output looks fine to me.

Change-Id: I96ccfe408ff56864361551afe9ad464d197ae104
/system/core/adb/file_sync_service.cpp
4f2015a155175f9da36574a378ce15ed74027ae9 26-Aug-2015 Elliott Hughes <enh@google.com> am 9492db23: am 62643302: Merge "Not all filesystems support setting SELinux labels."

* commit '9492db23b9feeb589be36fece46e55dc66d7f1dd':
Not all filesystems support setting SELinux labels.
383444085a28cfefcfc1d145462a0d124f373ebd 26-Aug-2015 Elliott Hughes <enh@google.com> Not all filesystems support setting SELinux labels.

Bug: http://b/23530370
Change-Id: Ie4deb3544304754696f049d17b12168cad4a51fd
/system/core/adb/file_sync_service.cpp
39206a08d8780da3b15eddaf26918db2682b84b6 25-Aug-2015 Elliott Hughes <enh@google.com> am 1ce12d39: am 43f43d87: Merge "Move adb\'s selinux_android_restorecon up and check for failures."

* commit '1ce12d397f1f563ee3eac4c1fdb907909d6eeff1':
Move adb's selinux_android_restorecon up and check for failures.
0adc09721fa130bd1246e6dbee3da9ad9bd176b8 25-Aug-2015 Elliott Hughes <enh@google.com> Move adb's selinux_android_restorecon up and check for failures.

Change-Id: Ib3ff282cf52df03f3b9a0abecf0abda99d7df641
/system/core/adb/file_sync_service.cpp
e4baae6d066c7d39af127a2ba1df5e91475db1a9 25-Aug-2015 Elliott Hughes <enh@google.com> am 12d762e1: am e8e272c5: Merge "EINTR is handled by adb_read/unix_read and friends."

* commit '12d762e17694c0137aa7570b4b71536e59643bb0':
EINTR is handled by adb_read/unix_read and friends.
e8e272c525fdfe73e646ff94f8b4d1913016919f 25-Aug-2015 Elliott Hughes <enh@google.com> Merge "EINTR is handled by adb_read/unix_read and friends."
9ccf4bfbde288119e6e90f9ad58351a5d2c59ff9 25-Aug-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of 068ee4d0 to mnc-dev-plus-aosp

Change-Id: If276934797138d13fe8c56711615b477e05ee484
9bc8005e079a1062751b5e9d62afeef3f2407dfb 25-Aug-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of 3ecba7f9 to mnc-dev-plus-aosp

Change-Id: I46452c03bbda9604f2af2e1edce5d48c6865d436
478bca2e728c108158fd68b469b3a48e2a432ad9 25-Aug-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of ba8fc829 to mnc-dev-plus-aosp

Change-Id: Ia4daf846df5a86ebca1b6c8d9e41f1633001836f
7baecbe6a372a23f86de9360ea96d86cbe6280e1 25-Aug-2015 Elliott Hughes <enh@google.com> Fix the fs_config call.

fs_config ORs in bits to the existing mode value.

Change-Id: I23f0655f9c4c8c8dc43ed979f3b519d7c03a11f8
/system/core/adb/file_sync_service.cpp
56bf3098431f18e87bfcd4ccddae3f89fa59120f 25-Aug-2015 Elliott Hughes <enh@google.com> Fix 32-bit build.

fs_config uses "unsigned int" instead of mode_t. Work around this.

Change-Id: I57b97d5bfc1b88089a41b4e8a50f1391b5c5113b
/system/core/adb/file_sync_service.cpp
8fcd8bc046188abe0b0e87754af472d4838b4c50 25-Aug-2015 Elliott Hughes <enh@google.com> EINTR is handled by adb_read/unix_read and friends.

No need to clutter the code with cases that won't happen.

Change-Id: I47c5a2e6170f902d2618719f44492234a4869567
/system/core/adb/file_sync_service.cpp
fdd4e588689327f286dc1d42634bd6c95dc1888e 25-Aug-2015 Elliott Hughes <enh@google.com> Clean up error handling/reporting in file_sync_service.cpp.

In an earlier code review it was pointed out that there was something
very weird about fail_errno. It didn't seem to make sense that we'd
often try to continue after reporting failure. This patch cleans up
all that and assumes that if we've reported failure to the client,
we should stop what we're doing.

Bug: http://b/23437039
Change-Id: I39c38650ed9f9d5e30adbf68a7545c9e4a6ab812
/system/core/adb/file_sync_service.cpp
201eaa683a5edd79000110e5246353235bb42ab1 24-Aug-2015 Elliott Hughes <enh@google.com> am 5c027334: am 93b9e865: Merge "There are no big endian hosts, grandpa."

* commit '5c027334cce4f0106d5d271d7924eafc752bd584':
There are no big endian hosts, grandpa.
f4465203b618fa57b6669c4d5627f32fb025b73e 24-Aug-2015 Elliott Hughes <enh@google.com> There are no big endian hosts, grandpa.

Change-Id: I6f64f702f919fe4af10d82c5f395a051571815ed
/system/core/adb/file_sync_service.cpp
6b5f77c9bb0923e0072651a52a500c8c10b4d32b 24-Aug-2015 Elliott Hughes <enh@google.com> am c583c511: am 186f1dee: Merge "adb sync cleanup."

* commit 'c583c5112bb6634114cd9759c1cfbad61a13b397':
adb sync cleanup.
aa2454919098ee14cd232669f1e7dbb33ed07ccf 03-Aug-2015 Elliott Hughes <enh@google.com> adb sync cleanup.

We can double the speed of "adb sync" (on N9) if we increase SYNC_DATA_MAX
from 64KiB to 256KiB. This change doesn't do that, because I still haven't
managed to plumb through the information about whether we're a new adb/adbd
to file_sync_client.cpp and file_sync_service.cpp. But this is already a big
change with a lot of cleanup, so let's do the cleanup and worry about the
intended change another day...

This change does improve performance somewhat by halving the number of
lstat(2) calls made on the client side, and ensuring that most packets are
sent with a single write. This has the pleasing result of making the null
sync on an AOSP N9 go from just over 300ms to around 100ms, which means it
now seems instantaneous (https://en.wikipedia.org/wiki/Mental_chronometry).

Change-Id: If9f6d4c1f93ec752b95f71211bbbb1c513045166
/system/core/adb/file_sync_service.cpp
e0b43a17852081c2fe1c0d2207006e421ffcc74b 31-Jul-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of 4e90b0ae to mnc-dev-plus-aosp

Change-Id: Iff0f469f09a0ad442db5b593345eaf52c3ca8104
5c74270f95107952a893584d02b33f9a79f6b3c4 31-Jul-2015 Elliott Hughes <enh@google.com> More adb cleanup.

This removes adb_dirstart and adb_dirstop. It also fixes a couple of memory
leaks by switching to std::string. This also fixes the bug in the previous
change --- mkdirs is given input like "/system/bin/sh" and only expected to
create "/system/bin". In a later change, we should remove mkdirs and only
expose the intended "unlink && mkdirs && create" functionality.

Change-Id: I30289dc1b3dff575cc1b158d993652178f587552
/system/core/adb/file_sync_service.cpp
d2117974e4c22ff6b8967c3b5cd2d497a6ffc856 31-Jul-2015 Elliott Hughes <enh@google.com> resolved conflicts for merge of 486645ee to mnc-dev-plus-aosp

Change-Id: I027a4de6e4ebae3bee6b7d2e56bd39c284b8a062
47d67c96ec991ef1690b4c07188335cbc4bfa2aa 06-May-2015 Alex Vallée <avallee@chromium.org> Write mkdirs in more idiomatic C++ style.

~ Rewrote mkdirs to be in C++ style.
~ Replaced adb_dir{start,stop} with std::string params and (r)find.
+ Added test for mkdirs.

Also make base/test_utils.h public and support temporary directories
as well as files.

Change-Id: I6fcbdc5e0099f3359d3aac6b00c436f250ca1329
/system/core/adb/file_sync_service.cpp
24419f3c2e5b821e8f3efcfef32c9d530f0bd0d9 28-Jul-2015 Elliott Hughes <enh@google.com> am ce2047a9: am 1a706865: Merge "Fix const-ness of strrchr callers."

* commit 'ce2047a947eaf3c02e39c22a7b461e8a0acd87f2':
Fix const-ness of strrchr callers.
3e7048c027ffa081d2fea84b661a6da895a9f1fb 28-Jul-2015 Elliott Hughes <enh@google.com> Fix const-ness of strrchr callers.

This causes build failures in google3 where they use GCC. glibc only
provides const-correct overloads for string functions for GCC >= 4.4,
but clang -- which is what we use -- pretends to be GCC 4.2.

Change-Id: I2a054823ea6201ebcea46d5e77b80a975eefc622
/system/core/adb/file_sync_service.cpp
df33ffadd29ed02d87e87515626b673eac67f735 09-Jul-2015 Thierry Strudel <tstrudel@google.com> fs_config: replace getenv('OUT') by new fs_config parameter

Using a getenv('OUT') in such a deep down function is a wrong design
choice. Replacing with explicit parameter that may be NULL in case
device specific files can be accessed from /.
Since TARGET_COPY_OUT_SYSTEM may be defined to something different than
system we also ensure that we use a path relative to TARGET_OUT to
compute path to fs_config_* files.

Bug: 21989305
Bug: 22048934
Change-Id: Id91bc183b29beac7379d1117ad83bd3346e6897b
Signed-off-by: Thierry Strudel <tstrudel@google.com>
/system/core/adb/file_sync_service.cpp
3313426fad9eaaf53017cdbde889ebcec91358ec 19-Mar-2015 Dan Albert <danalbert@google.com> File header cleanup.

* sysdeps.h should always be included first.
* TRACE_TAG needs to be defined before anything is included.
* Some files were missing copyright headers.
* Save precious bytes on my SSD by removing useless whitespace.

Change-Id: I88980e6e00b5be1093806cf286740d9e4a033b94
/system/core/adb/file_sync_service.cpp
ec7a66713144a16361724fe88332b28bbf3f4b3c 16-Mar-2015 Elliott Hughes <enh@google.com> Revert "Revert "adb: support /oem partition""

This reverts commit 6084a0124f868c7ec43f6c415a27a168f27ff694.

The original build breakage is fixed by (a) building the verity
code for eng builds as well as userdebug builds and (b) moving
the exported remount service functions into a new header file.

Change-Id: Ice0c4f97d4db38ab7eb333c7a6e56bbd11123f5b
/system/core/adb/file_sync_service.cpp
6084a0124f868c7ec43f6c415a27a168f27ff694 16-Mar-2015 Dan Albert <danalbert@google.com> Revert "adb: support /oem partition"

This is broken on userdebug builds, and it isn't completely clear why. The declaration for make_block-device_writable in adb.h wasn't updated to match the definition (which uses a std::string instead of a char*). adb.h is currently extern "C", and it isn't clear why this is only broken for userdebug, so I'd like to revert while we investigate.

This reverts commit 81416fdb186070fe4db3ca5fed2e713a4eecaac1.

Change-Id: I47f321574f9f21052e2c7332e8b0f6ef9ab98277
/system/core/adb/file_sync_service.cpp
81416fdb186070fe4db3ca5fed2e713a4eecaac1 03-Nov-2014 Mårten Kongstad <marten.kongstad@sonymobile.com> adb: support /oem partition

Add support for /oem partition in commands 'adb remount' and 'adb sync'.

Change-Id: I5defc74ccaa37feaef74b9268e22b4075f98a59f
/system/core/adb/file_sync_service.cpp
bac3474a8256cb32a29e8d46f78cad95a5502692 26-Feb-2015 Dan Albert <danalbert@google.com> Move adb to C++.

I keep trying to clean things up and needing std::strings. Might as
well just do this now.

usb_linux_client.c is going to stay as C because GCC isn't smart
enough to deal with the designated initializers it uses (though for
some reason it is in C mode).

The Darwin files are staying as C because I don't have a way to test
that they build.

The Windows files are staying as C because while I can actually build
for them, it's slow and painful.

Change-Id: I75367d29205a9049d34460032b3bb36384f43941
/system/core/adb/file_sync_service.cpp