From 0460f697a18fa2ea2b98380e663b7d33d9cbdb00 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Wed, 10 Jun 2015 15:52:04 +0000 Subject: Revert "Zero blocks before BLKDISCARD" This reverts commit 604c583c9dd3d47906b1a57c14a7e9650df7471e. Change-Id: I2b0b283dc3f44bae55c5e9f7231d7c712630c2b5 --- updater/blockimg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/updater/blockimg.c b/updater/blockimg.c index a2786c832..7b8721dbf 100644 --- a/updater/blockimg.c +++ b/updater/blockimg.c @@ -39,6 +39,11 @@ #define BLOCKSIZE 4096 +// Set this to 0 to interpret 'erase' transfers to mean do a +// BLKDISCARD ioctl (the normal behavior). Set to 1 to interpret +// erase to mean fill the region with zeroes. +#define DEBUG_ERASE 0 + #ifndef BLKDISCARD #define BLKDISCARD _IO(0x12,119) #endif @@ -1217,7 +1222,8 @@ static int PerformCommandZero(CommandParameters* params) { } if (params->cmdname[0] == 'z') { - // Update only for the zero command, as the erase command will call this + // Update only for the zero command, as the erase command will call + // this if DEBUG_ERASE is defined. params->written += tgt->size; } @@ -1403,10 +1409,8 @@ static int PerformCommandErase(CommandParameters* params) { struct stat st; uint64_t blocks[2]; - // Always zero the blocks first to work around possibly flaky BLKDISCARD - // Bug: 20881595 - if (PerformCommandZero(params) != 0) { - goto pceout; + if (DEBUG_ERASE) { + return PerformCommandZero(params); } if (!params) { -- cgit v1.2.3 From afc7a78349160743b206ed89aed401c3d2d45761 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 23 Jun 2015 11:12:58 -0700 Subject: Allow sideloading without authentication. Bug: http://b/22025550 Change-Id: I20f09ae442536f924f19ede0abf6a2bcc0a5cedf (cherry picked from commit 9813f5ba57fe7d90d45cb1c2b6f65920ce580e72) --- minadbd/adb_main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/minadbd/adb_main.cpp b/minadbd/adb_main.cpp index f6e240108..7fae99a9a 100644 --- a/minadbd/adb_main.cpp +++ b/minadbd/adb_main.cpp @@ -19,11 +19,12 @@ #include #include -#define TRACE_TAG TRACE_ADB +#define TRACE_TAG TRACE_ADB #include "sysdeps.h" #include "adb.h" +#include "adb_auth.h" #include "transport.h" int adb_main(int is_daemon, int server_port) @@ -35,6 +36,9 @@ int adb_main(int is_daemon, int server_port) // No SIGCHLD. Let the service subproc handle its children. signal(SIGPIPE, SIG_IGN); + // We can't require authentication for sideloading. http://b/22025550. + auth_required = false; + init_transport_registration(); usb_init(); -- cgit v1.2.3 From 9154748cc5398d5606765d67409c3cfcdb8b7ad6 Mon Sep 17 00:00:00 2001 From: caozhiyuan Date: Tue, 19 May 2015 17:21:00 +0800 Subject: Use f_bavail to calculate free space Failures are seen on devices with Linux 3.10. And they are mainly due to this change: https://lwn.net/Articles/546473/ The blocks reserved in this change is not the same thing as what we think are reserved for common usage of root user. And this part is included in free blocks but not in available blocks. Bug: 22118089 Change-Id: I81c9531703298019a4fc11839f28d2cc8b9df34e (cherry picked from commit 3b4977638f48e59d23d7ea2bb6dde78552c257fb) --- applypatch/applypatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applypatch/applypatch.c b/applypatch/applypatch.c index 6f02a38ee..2358d4292 100644 --- a/applypatch/applypatch.c +++ b/applypatch/applypatch.c @@ -662,7 +662,7 @@ size_t FreeSpaceForFile(const char* filename) { printf("failed to statfs %s: %s\n", filename, strerror(errno)); return -1; } - return sf.f_bsize * sf.f_bfree; + return sf.f_bsize * sf.f_bavail; } int CacheSizeCheck(size_t bytes) { -- cgit v1.2.3