Loading init/action.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -18,13 +18,11 @@ #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include "util.h" using android::base::Join; using android::base::StringPrintf; Command::Command(BuiltinFunction f, const std::vector<std::string>& args, int line) : func_(f), args_(args), line_(line) {} Loading Loading @@ -98,10 +96,10 @@ void Action::ExecuteCommand(const Command& command) const { android::base::GetMinimumLogSeverity() <= android::base::DEBUG) { std::string trigger_name = BuildTriggersString(); std::string cmd_str = command.BuildCommandString(); std::string source = StringPrintf(" (%s:%d)", filename_.c_str(), command.line()); LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << source << " returned " << result << " took " << duration_ms << "ms."; LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << " (" << filename_ << ":" << command.line() << ") returned " << result << " took " << duration_ms << "ms."; } } Loading init/builtins.cpp +4 −9 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ #include <android-base/logging.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <bootloader_message/bootloader_message.h> #include <cutils/android_reboot.h> Loading Loading @@ -535,11 +534,10 @@ static int do_mount_all(const std::vector<std::string>& args) { } } std::string prop_name = android::base::StringPrintf("ro.boottime.init.mount_all.%s", prop_post_fix); std::string prop_name = "ro.boottime.init.mount_all."s + prop_post_fix; Timer t; int ret = mount_fstab(fstabfile, mount_mode); property_set(prop_name.c_str(), std::to_string(t.duration_ms()).c_str()); property_set(prop_name, std::to_string(t.duration_ms())); if (import_rc) { /* Paths of .rc files are specified at the 2nd argument and beyond */ Loading Loading @@ -567,9 +565,7 @@ static int do_swapon_all(const std::vector<std::string>& args) { } static int do_setprop(const std::vector<std::string>& args) { const char* name = args[1].c_str(); const char* value = args[2].c_str(); property_set(name, value); property_set(args[1], args[2]); return 0; } Loading Loading @@ -652,8 +648,7 @@ static int do_verity_load_state(const std::vector<std::string>& args) { static void verity_update_property(fstab_rec *fstab, const char *mount_point, int mode, int status) { property_set(android::base::StringPrintf("partition.%s.verified", mount_point).c_str(), android::base::StringPrintf("%d", mode).c_str()); property_set("partition."s + mount_point + ".verified", std::to_string(mode)); } static int do_verity_update_state(const std::vector<std::string>& args) { Loading init/descriptors.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ void DescriptorInfo::CreateAndPublish(const std::string& globalContext) const { std::for_each(publishedName.begin(), publishedName.end(), [] (char& c) { c = isalnum(c) ? c : '_'; }); std::string val = android::base::StringPrintf("%d", fd); std::string val = std::to_string(fd); add_environment(publishedName.c_str(), val.c_str()); // make sure we don't close on exec Loading @@ -74,7 +74,8 @@ SocketInfo::SocketInfo(const std::string& name, const std::string& type, uid_t u } void SocketInfo::Clean() const { unlink(android::base::StringPrintf(ANDROID_SOCKET_DIR "/%s", name().c_str()).c_str()); std::string path = android::base::StringPrintf("%s/%s", ANDROID_SOCKET_DIR, name().c_str()); unlink(path.c_str()); } int SocketInfo::Create(const std::string& context) const { Loading init/init.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <keyutils.h> Loading Loading @@ -71,9 +70,10 @@ #include "util.h" #include "watchdogd.h" using namespace std::string_literals; using android::base::boot_clock; using android::base::GetProperty; using android::base::StringPrintf; struct selabel_handle *sehandle; struct selabel_handle *sehandle_prop; Loading Loading @@ -219,7 +219,7 @@ static int wait_for_coldboot_done_action(const std::vector<std::string>& args) { panic(); } property_set("ro.boottime.init.cold_boot_wait", std::to_string(t.duration_ms()).c_str()); property_set("ro.boottime.init.cold_boot_wait", std::to_string(t.duration_ms())); return 0; } Loading Loading @@ -449,14 +449,14 @@ static void import_kernel_nv(const std::string& key, const std::string& value, b if (for_emulator) { // In the emulator, export any kernel option with the "ro.kernel." prefix. property_set(StringPrintf("ro.kernel.%s", key.c_str()).c_str(), value.c_str()); property_set("ro.kernel." + key, value); return; } if (key == "qemu") { strlcpy(qemu, value.c_str(), sizeof(qemu)); } else if (android::base::StartsWith(key, "androidboot.")) { property_set(StringPrintf("ro.boot.%s", key.c_str() + 12).c_str(), value.c_str()); property_set("ro.boot." + key.substr(12), value); } } Loading Loading @@ -487,7 +487,7 @@ static void export_kernel_boot_props() { }; for (size_t i = 0; i < arraysize(prop_map); i++) { std::string value = GetProperty(prop_map[i].src_prop, ""); property_set(prop_map[i].dst_prop, (!value.empty()) ? value.c_str() : prop_map[i].default_value); property_set(prop_map[i].dst_prop, (!value.empty()) ? value : prop_map[i].default_value); } } Loading @@ -511,8 +511,7 @@ static void process_kernel_dt() { android::base::ReadFileToString(file_name, &dt_file); std::replace(dt_file.begin(), dt_file.end(), ',', '.'); std::string property_name = StringPrintf("ro.boot.%s", dp->d_name); property_set(property_name.c_str(), dt_file.c_str()); property_set("ro.boot."s + dp->d_name, dt_file); } } Loading Loading @@ -1002,7 +1001,7 @@ int main(int argc, char** argv) { static constexpr uint32_t kNanosecondsPerMillisecond = 1e6; uint64_t start_ms = start_time.time_since_epoch().count() / kNanosecondsPerMillisecond; setenv("INIT_STARTED_AT", StringPrintf("%" PRIu64, start_ms).c_str(), 1); setenv("INIT_STARTED_AT", std::to_string(start_ms).c_str(), 1); char* path = argv[0]; char* args[] = { path, nullptr }; Loading init/property_service.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <bootimg.h> #include <fs_mgr.h> Loading @@ -56,8 +55,6 @@ #include "init.h" #include "util.h" using android::base::StringPrintf; #define PERSISTENT_PROPERTY_DIR "/data/property" #define RECOVERY_MOUNT_POINT "/recovery" Loading Loading @@ -714,7 +711,7 @@ void load_recovery_id_prop() { boot_img_hdr hdr; if (android::base::ReadFully(fd, &hdr, sizeof(hdr))) { std::string hex = bytes_to_hex(reinterpret_cast<uint8_t*>(hdr.id), sizeof(hdr.id)); property_set("ro.recovery_id", hex.c_str()); property_set("ro.recovery_id", hex); } else { PLOG(ERROR) << "error reading /recovery"; } Loading Loading
init/action.cpp +3 −5 Original line number Diff line number Diff line Loading @@ -18,13 +18,11 @@ #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include "util.h" using android::base::Join; using android::base::StringPrintf; Command::Command(BuiltinFunction f, const std::vector<std::string>& args, int line) : func_(f), args_(args), line_(line) {} Loading Loading @@ -98,10 +96,10 @@ void Action::ExecuteCommand(const Command& command) const { android::base::GetMinimumLogSeverity() <= android::base::DEBUG) { std::string trigger_name = BuildTriggersString(); std::string cmd_str = command.BuildCommandString(); std::string source = StringPrintf(" (%s:%d)", filename_.c_str(), command.line()); LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << source << " returned " << result << " took " << duration_ms << "ms."; LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << " (" << filename_ << ":" << command.line() << ") returned " << result << " took " << duration_ms << "ms."; } } Loading
init/builtins.cpp +4 −9 Original line number Diff line number Diff line Loading @@ -43,7 +43,6 @@ #include <android-base/logging.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <bootloader_message/bootloader_message.h> #include <cutils/android_reboot.h> Loading Loading @@ -535,11 +534,10 @@ static int do_mount_all(const std::vector<std::string>& args) { } } std::string prop_name = android::base::StringPrintf("ro.boottime.init.mount_all.%s", prop_post_fix); std::string prop_name = "ro.boottime.init.mount_all."s + prop_post_fix; Timer t; int ret = mount_fstab(fstabfile, mount_mode); property_set(prop_name.c_str(), std::to_string(t.duration_ms()).c_str()); property_set(prop_name, std::to_string(t.duration_ms())); if (import_rc) { /* Paths of .rc files are specified at the 2nd argument and beyond */ Loading Loading @@ -567,9 +565,7 @@ static int do_swapon_all(const std::vector<std::string>& args) { } static int do_setprop(const std::vector<std::string>& args) { const char* name = args[1].c_str(); const char* value = args[2].c_str(); property_set(name, value); property_set(args[1], args[2]); return 0; } Loading Loading @@ -652,8 +648,7 @@ static int do_verity_load_state(const std::vector<std::string>& args) { static void verity_update_property(fstab_rec *fstab, const char *mount_point, int mode, int status) { property_set(android::base::StringPrintf("partition.%s.verified", mount_point).c_str(), android::base::StringPrintf("%d", mode).c_str()); property_set("partition."s + mount_point + ".verified", std::to_string(mode)); } static int do_verity_update_state(const std::vector<std::string>& args) { Loading
init/descriptors.cpp +3 −2 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ void DescriptorInfo::CreateAndPublish(const std::string& globalContext) const { std::for_each(publishedName.begin(), publishedName.end(), [] (char& c) { c = isalnum(c) ? c : '_'; }); std::string val = android::base::StringPrintf("%d", fd); std::string val = std::to_string(fd); add_environment(publishedName.c_str(), val.c_str()); // make sure we don't close on exec Loading @@ -74,7 +74,8 @@ SocketInfo::SocketInfo(const std::string& name, const std::string& type, uid_t u } void SocketInfo::Clean() const { unlink(android::base::StringPrintf(ANDROID_SOCKET_DIR "/%s", name().c_str()).c_str()); std::string path = android::base::StringPrintf("%s/%s", ANDROID_SOCKET_DIR, name().c_str()); unlink(path.c_str()); } int SocketInfo::Create(const std::string& context) const { Loading
init/init.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <keyutils.h> Loading Loading @@ -71,9 +70,10 @@ #include "util.h" #include "watchdogd.h" using namespace std::string_literals; using android::base::boot_clock; using android::base::GetProperty; using android::base::StringPrintf; struct selabel_handle *sehandle; struct selabel_handle *sehandle_prop; Loading Loading @@ -219,7 +219,7 @@ static int wait_for_coldboot_done_action(const std::vector<std::string>& args) { panic(); } property_set("ro.boottime.init.cold_boot_wait", std::to_string(t.duration_ms()).c_str()); property_set("ro.boottime.init.cold_boot_wait", std::to_string(t.duration_ms())); return 0; } Loading Loading @@ -449,14 +449,14 @@ static void import_kernel_nv(const std::string& key, const std::string& value, b if (for_emulator) { // In the emulator, export any kernel option with the "ro.kernel." prefix. property_set(StringPrintf("ro.kernel.%s", key.c_str()).c_str(), value.c_str()); property_set("ro.kernel." + key, value); return; } if (key == "qemu") { strlcpy(qemu, value.c_str(), sizeof(qemu)); } else if (android::base::StartsWith(key, "androidboot.")) { property_set(StringPrintf("ro.boot.%s", key.c_str() + 12).c_str(), value.c_str()); property_set("ro.boot." + key.substr(12), value); } } Loading Loading @@ -487,7 +487,7 @@ static void export_kernel_boot_props() { }; for (size_t i = 0; i < arraysize(prop_map); i++) { std::string value = GetProperty(prop_map[i].src_prop, ""); property_set(prop_map[i].dst_prop, (!value.empty()) ? value.c_str() : prop_map[i].default_value); property_set(prop_map[i].dst_prop, (!value.empty()) ? value : prop_map[i].default_value); } } Loading @@ -511,8 +511,7 @@ static void process_kernel_dt() { android::base::ReadFileToString(file_name, &dt_file); std::replace(dt_file.begin(), dt_file.end(), ',', '.'); std::string property_name = StringPrintf("ro.boot.%s", dp->d_name); property_set(property_name.c_str(), dt_file.c_str()); property_set("ro.boot."s + dp->d_name, dt_file); } } Loading Loading @@ -1002,7 +1001,7 @@ int main(int argc, char** argv) { static constexpr uint32_t kNanosecondsPerMillisecond = 1e6; uint64_t start_ms = start_time.time_since_epoch().count() / kNanosecondsPerMillisecond; setenv("INIT_STARTED_AT", StringPrintf("%" PRIu64, start_ms).c_str(), 1); setenv("INIT_STARTED_AT", std::to_string(start_ms).c_str(), 1); char* path = argv[0]; char* args[] = { path, nullptr }; Loading
init/property_service.cpp +1 −4 Original line number Diff line number Diff line Loading @@ -45,7 +45,6 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <bootimg.h> #include <fs_mgr.h> Loading @@ -56,8 +55,6 @@ #include "init.h" #include "util.h" using android::base::StringPrintf; #define PERSISTENT_PROPERTY_DIR "/data/property" #define RECOVERY_MOUNT_POINT "/recovery" Loading Loading @@ -714,7 +711,7 @@ void load_recovery_id_prop() { boot_img_hdr hdr; if (android::base::ReadFully(fd, &hdr, sizeof(hdr))) { std::string hex = bytes_to_hex(reinterpret_cast<uint8_t*>(hdr.id), sizeof(hdr.id)); property_set("ro.recovery_id", hex.c_str()); property_set("ro.recovery_id", hex); } else { PLOG(ERROR) << "error reading /recovery"; } Loading