mirror of
https://github.com/Evolution-X-Devices/device_google_gs201
synced 2026-02-01 05:38:17 +00:00
bootctrl: enforce synchronous write operation
Bug: 263218204 Bug: 197104397 Signed-off-by: Oleg Matcovschi <omatcovschi@google.com> Change-Id: Ifbc612fc40847395ccb751463b1bb15bd3f20657 (cherry picked from commit 354f3c6d2edf302b030ed698bac4c0fd8067f0f4)
This commit is contained in:
committed by
Fernando Lugo
parent
9b1235529a
commit
8b9ae264d8
@@ -162,7 +162,7 @@ static bool DevInfoSync() {
|
||||
return false;
|
||||
}
|
||||
|
||||
android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY));
|
||||
android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY | O_DSYNC));
|
||||
return android::base::WriteFully(fd, &devinfo, sizeof devinfo);
|
||||
}
|
||||
|
||||
@@ -270,13 +270,13 @@ Return<void> BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb
|
||||
|
||||
std::string boot_lun_path =
|
||||
std::string("/sys/devices/platform/") + boot_dev + "/pixel/boot_lun_enabled";
|
||||
int fd = open(boot_lun_path.c_str(), O_RDWR);
|
||||
int fd = open(boot_lun_path.c_str(), O_RDWR | O_DSYNC);
|
||||
if (fd < 0) {
|
||||
// Try old path for kernels < 5.4
|
||||
// TODO: remove once kernel 4.19 support is deprecated
|
||||
std::string boot_lun_path =
|
||||
std::string("/sys/devices/platform/") + boot_dev + "/attributes/boot_lun_enabled";
|
||||
fd = open(boot_lun_path.c_str(), O_RDWR);
|
||||
fd = open(boot_lun_path.c_str(), O_RDWR | O_DSYNC);
|
||||
if (fd < 0) {
|
||||
_hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
|
||||
return Void();
|
||||
|
||||
Reference in New Issue
Block a user