bootctrl: enforce synchronous write operation am: 354f3c6d2e am: 82c49b1cb9 am: 6389448ba1
Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs101/+/15641057 Change-Id: I2d2be339ada8f7dd8296c74e872a433c3352050f
This commit is contained in:
commit
c7fd307c7c
1 changed files with 3 additions and 3 deletions
|
@ -162,7 +162,7 @@ static bool DevInfoSync() {
|
||||||
return false;
|
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);
|
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 boot_lun_path =
|
||||||
std::string("/sys/devices/platform/") + boot_dev + "/pixel/boot_lun_enabled";
|
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) {
|
if (fd < 0) {
|
||||||
// Try old path for kernels < 5.4
|
// Try old path for kernels < 5.4
|
||||||
// TODO: remove once kernel 4.19 support is deprecated
|
// TODO: remove once kernel 4.19 support is deprecated
|
||||||
std::string boot_lun_path =
|
std::string boot_lun_path =
|
||||||
std::string("/sys/devices/platform/") + boot_dev + "/attributes/boot_lun_enabled";
|
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) {
|
if (fd < 0) {
|
||||||
_hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
|
_hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
|
||||||
return Void();
|
return Void();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue