aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu2016-08-05 20:00:04 -0500
committerTianjie Xu2016-09-01 13:33:25 -0500
commit7b0ad9c638176dc364dabb65b363536055a0ea9c (patch)
tree73848b33067169c72788f517063c3d9659e783c0 /recovery-persist.cpp
parent818394869d36b9db1bf4984585a062d4bb91310f (diff)
downloadplatform-bootable-recovery-7b0ad9c638176dc364dabb65b363536055a0ea9c.tar.gz
platform-bootable-recovery-7b0ad9c638176dc364dabb65b363536055a0ea9c.tar.xz
platform-bootable-recovery-7b0ad9c638176dc364dabb65b363536055a0ea9c.zip
Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Diffstat (limited to 'recovery-persist.cpp')
-rw-r--r--recovery-persist.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/recovery-persist.cpp b/recovery-persist.cpp
index 25df03f4..b0ec141c 100644
--- a/recovery-persist.cpp
+++ b/recovery-persist.cpp
@@ -14,8 +14,6 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#define LOG_TAG "recovery-persist"
18
19// 17//
20// Strictly to deal with reboot into system after OTA after /data 18// Strictly to deal with reboot into system after OTA after /data
21// mounts to pull the last pmsg file data and place it 19// mounts to pull the last pmsg file data and place it
@@ -40,10 +38,9 @@
40 38
41#include <string> 39#include <string>
42 40
43#include <android/log.h> /* Android Log Priority Tags */
44#include <android-base/file.h> 41#include <android-base/file.h>
45#include <log/log.h> 42#include <android-base/logging.h>
46#include <log/logger.h> /* Android Log packet format */ 43
47#include <private/android_logger.h> /* private pmsg functions */ 44#include <private/android_logger.h> /* private pmsg functions */
48 45
49static const char *LAST_LOG_FILE = "/data/misc/recovery/last_log"; 46static const char *LAST_LOG_FILE = "/data/misc/recovery/last_log";
@@ -57,14 +54,16 @@ static const int KEEP_LOG_COUNT = 10;
57// close a file, log an error if the error indicator is set 54// close a file, log an error if the error indicator is set
58static void check_and_fclose(FILE *fp, const char *name) { 55static void check_and_fclose(FILE *fp, const char *name) {
59 fflush(fp); 56 fflush(fp);
60 if (ferror(fp)) SLOGE("%s %s", name, strerror(errno)); 57 if (ferror(fp)) {
58 PLOG(ERROR) << "Error in " << name;
59 }
61 fclose(fp); 60 fclose(fp);
62} 61}
63 62
64static void copy_file(const char* source, const char* destination) { 63static void copy_file(const char* source, const char* destination) {
65 FILE* dest_fp = fopen(destination, "w"); 64 FILE* dest_fp = fopen(destination, "w");
66 if (dest_fp == nullptr) { 65 if (dest_fp == nullptr) {
67 SLOGE("%s %s", destination, strerror(errno)); 66 PLOG(ERROR) << "Can't open " << destination;
68 } else { 67 } else {
69 FILE* source_fp = fopen(source, "r"); 68 FILE* source_fp = fopen(source, "r");
70 if (source_fp != nullptr) { 69 if (source_fp != nullptr) {
@@ -157,7 +156,7 @@ int main(int argc, char **argv) {
157 static const char mounts_file[] = "/proc/mounts"; 156 static const char mounts_file[] = "/proc/mounts";
158 FILE *fp = fopen(mounts_file, "r"); 157 FILE *fp = fopen(mounts_file, "r");
159 if (!fp) { 158 if (!fp) {
160 SLOGV("%s %s", mounts_file, strerror(errno)); 159 PLOG(ERROR) << "failed to open " << mounts_file;
161 } else { 160 } else {
162 char *line = NULL; 161 char *line = NULL;
163 size_t len = 0; 162 size_t len = 0;