Merge "updater: Don't append newline when calling uiPrint()." am: 58cb690eac

am: 08224f745c

Change-Id: I15e03a6cd11aa65e111db124b08fe567509256ab
This commit is contained in:
Tao Bao
2017-03-30 19:29:57 +00:00
committed by android-build-merger
2 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -18,6 +18,7 @@
#include <errno.h> #include <errno.h>
#include <dirent.h> #include <dirent.h>
#include <fcntl.h> #include <fcntl.h>
#include <inttypes.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <pthread.h> #include <pthread.h>
#include <stdarg.h> #include <stdarg.h>
@@ -1831,7 +1832,7 @@ Value* CheckFirstBlockFn(const char* name, State* state,
uint16_t mount_count = *reinterpret_cast<uint16_t*>(&block0_buffer[0x400+0x34]); uint16_t mount_count = *reinterpret_cast<uint16_t*>(&block0_buffer[0x400+0x34]);
if (mount_count > 0) { if (mount_count > 0) {
uiPrintf(state, "Device was remounted R/W %d times\n", mount_count); uiPrintf(state, "Device was remounted R/W %" PRIu16 " times", mount_count);
uiPrintf(state, "Last remount happened on %s", ctime(&mount_time)); uiPrintf(state, "Last remount happened on %s", ctime(&mount_time));
} }
+8 -8
View File
@@ -181,8 +181,8 @@ Value* MountFn(const char* name, State* state, const std::vector<std::unique_ptr
if (mount(location.c_str(), mount_point.c_str(), fs_type.c_str(), if (mount(location.c_str(), mount_point.c_str(), fs_type.c_str(),
MS_NOATIME | MS_NODEV | MS_NODIRATIME, mount_options.c_str()) < 0) { MS_NOATIME | MS_NODEV | MS_NODIRATIME, mount_options.c_str()) < 0) {
uiPrintf(state, "%s: failed to mount %s at %s: %s\n", name, location.c_str(), uiPrintf(state, "%s: Failed to mount %s at %s: %s", name, location.c_str(), mount_point.c_str(),
mount_point.c_str(), strerror(errno)); strerror(errno));
return StringValue(""); return StringValue("");
} }
@@ -231,12 +231,12 @@ Value* UnmountFn(const char* name, State* state, const std::vector<std::unique_p
scan_mounted_volumes(); scan_mounted_volumes();
MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point.c_str()); MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point.c_str());
if (vol == nullptr) { if (vol == nullptr) {
uiPrintf(state, "unmount of %s failed; no such volume\n", mount_point.c_str()); uiPrintf(state, "Failed to unmount %s: No such volume", mount_point.c_str());
return nullptr; return nullptr;
} else { } else {
int ret = unmount_mounted_volume(vol); int ret = unmount_mounted_volume(vol);
if (ret != 0) { if (ret != 0) {
uiPrintf(state, "unmount of %s failed (%d): %s\n", mount_point.c_str(), ret, strerror(errno)); uiPrintf(state, "Failed to unmount %s: %s", mount_point.c_str(), strerror(errno));
} }
} }
@@ -699,15 +699,15 @@ Value* ApplyPatchCheckFn(const char* name, State* state, const std::vector<std::
return StringValue(result == 0 ? "t" : ""); return StringValue(result == 0 ? "t" : "");
} }
// This is the updater side handler for ui_print() in edify script. Contents // This is the updater side handler for ui_print() in edify script. Contents will be sent over to
// will be sent over to the recovery side for on-screen display. // the recovery side for on-screen display.
Value* UIPrintFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) { Value* UIPrintFn(const char* name, State* state, const std::vector<std::unique_ptr<Expr>>& argv) {
std::vector<std::string> args; std::vector<std::string> args;
if (!ReadArgs(state, argv, &args)) { if (!ReadArgs(state, argv, &args)) {
return ErrorAbort(state, kArgsParsingFailure, "%s() Failed to parse the argument(s)", name); return ErrorAbort(state, kArgsParsingFailure, "%s(): Failed to parse the argument(s)", name);
} }
std::string buffer = android::base::Join(args, "") + "\n"; std::string buffer = android::base::Join(args, "");
uiPrint(state, buffer); uiPrint(state, buffer);
return StringValue(buffer); return StringValue(buffer);
} }