Lines Matching refs:err
38 static std::string get_misc_blk_device(std::string* err) { in get_misc_blk_device() argument
41 *err = "failed to read default fstab"; in get_misc_blk_device()
46 *err = "failed to find /misc partition"; in get_misc_blk_device()
54 static bool wait_for_device(const std::string& blk_device, std::string* err) { in wait_for_device() argument
57 err->clear(); in wait_for_device()
63 *err += android::base::StringPrintf("failed to stat %s try %d: %s\n", in wait_for_device()
70 *err += android::base::StringPrintf("failed to stat %s\n", blk_device.c_str()); in wait_for_device()
76 size_t offset, std::string* err) { in read_misc_partition() argument
77 if (!wait_for_device(misc_blk_device, err)) { in read_misc_partition()
82 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in read_misc_partition()
87 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in read_misc_partition()
92 *err = android::base::StringPrintf("failed to read %s: %s", misc_blk_device.c_str(), in read_misc_partition()
100 size_t offset, std::string* err) { in write_misc_partition() argument
103 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in write_misc_partition()
108 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in write_misc_partition()
113 *err = android::base::StringPrintf("failed to write %s: %s", misc_blk_device.c_str(), in write_misc_partition()
118 *err = android::base::StringPrintf("failed to fsync %s: %s", misc_blk_device.c_str(), in write_misc_partition()
125 std::string get_bootloader_message_blk_device(std::string* err) { in get_bootloader_message_blk_device() argument
126 std::string misc_blk_device = get_misc_blk_device(err); in get_bootloader_message_blk_device()
128 if (!wait_for_device(misc_blk_device, err)) return ""; in get_bootloader_message_blk_device()
133 std::string* err) { in read_bootloader_message_from() argument
135 BOOTLOADER_MESSAGE_OFFSET_IN_MISC, err); in read_bootloader_message_from()
138 bool read_bootloader_message(bootloader_message* boot, std::string* err) { in read_bootloader_message() argument
139 std::string misc_blk_device = get_misc_blk_device(err); in read_bootloader_message()
143 return read_bootloader_message_from(boot, misc_blk_device, err); in read_bootloader_message()
147 std::string* err) { in read_bootloader_control_from() argument
149 kBootloaderControlOffset, err); in read_bootloader_control_from()
153 std::string* err) { in write_bootloader_message_to() argument
155 BOOTLOADER_MESSAGE_OFFSET_IN_MISC, err); in write_bootloader_message_to()
158 bool write_bootloader_message(const bootloader_message& boot, std::string* err) { in write_bootloader_message() argument
159 std::string misc_blk_device = get_misc_blk_device(err); in write_bootloader_message()
163 return write_bootloader_message_to(boot, misc_blk_device, err); in write_bootloader_message()
167 std::string* err) { in write_bootloader_control_to() argument
169 kBootloaderControlOffset, err); in write_bootloader_control_to()
172 bool clear_bootloader_message(std::string* err) { in clear_bootloader_message() argument
174 return write_bootloader_message(boot, err); in clear_bootloader_message()
177 bool write_bootloader_message(const std::vector<std::string>& options, std::string* err) { in write_bootloader_message() argument
181 return write_bootloader_message(boot, err); in write_bootloader_message()
184 bool update_bootloader_message(const std::vector<std::string>& options, std::string* err) { in update_bootloader_message() argument
186 if (!read_bootloader_message(&boot, err)) { in update_bootloader_message()
191 return write_bootloader_message(boot, err); in update_bootloader_message()
212 bool write_reboot_bootloader(std::string* err) { in write_reboot_bootloader() argument
214 if (!read_bootloader_message(&boot, err)) { in write_reboot_bootloader()
218 *err = "Bootloader command pending."; in write_reboot_bootloader()
222 return write_bootloader_message(boot, err); in write_reboot_bootloader()
225 bool read_wipe_package(std::string* package_data, size_t size, std::string* err) { in read_wipe_package() argument
226 std::string misc_blk_device = get_misc_blk_device(err); in read_wipe_package()
232 WIPE_PACKAGE_OFFSET_IN_MISC, err); in read_wipe_package()
235 bool write_wipe_package(const std::string& package_data, std::string* err) { in write_wipe_package() argument
236 std::string misc_blk_device = get_misc_blk_device(err); in write_wipe_package()
241 WIPE_PACKAGE_OFFSET_IN_MISC, err); in write_wipe_package()
245 std::string err; in write_reboot_bootloader() local
246 return write_reboot_bootloader(&err); in write_reboot_bootloader()
250 std::string err; in write_bootloader_message() local
251 return write_bootloader_message({options}, &err); in write_bootloader_message()