summaryrefslogtreecommitdiffstats
path: root/updater
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2021-02-17 22:07:37 +0100
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-02-17 22:07:37 +0100
commitd22186e4b3d33801b94d690322f6ec1a681fcd0b (patch)
tree1efdcea0523416bff1216e7404f17841daf33e5e /updater
parentMerge "[LSC] Add LOCAL_LICENSE_KINDS to bootable/recovery" am: 1055a2f07a am: d9a0aa10ba am: d2b1584e7f (diff)
parentMerge "updater: Do not null terminate mount_flags_list array" am: be54337fab am: 44cea7efc8 (diff)
downloadandroid_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar.gz
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar.bz2
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar.lz
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar.xz
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.tar.zst
android_bootable_recovery-d22186e4b3d33801b94d690322f6ec1a681fcd0b.zip
Diffstat (limited to 'updater')
-rw-r--r--updater/updater_runtime.cpp40
1 files changed, 18 insertions, 22 deletions
diff --git a/updater/updater_runtime.cpp b/updater/updater_runtime.cpp
index e93830505..bac078cf9 100644
--- a/updater/updater_runtime.cpp
+++ b/updater/updater_runtime.cpp
@@ -44,29 +44,25 @@ std::string UpdaterRuntime::FindBlockDeviceName(const std::string_view name) con
return std::string(name);
}
-static struct {
- const char* name;
- unsigned flag;
-} mount_flags_list[] = {
- { "noatime", MS_NOATIME },
- { "noexec", MS_NOEXEC },
- { "nosuid", MS_NOSUID },
- { "nodev", MS_NODEV },
- { "nodiratime", MS_NODIRATIME },
- { "ro", MS_RDONLY },
- { "rw", 0 },
- { "remount", MS_REMOUNT },
- { "bind", MS_BIND },
- { "rec", MS_REC },
- { "unbindable", MS_UNBINDABLE },
- { "private", MS_PRIVATE },
- { "slave", MS_SLAVE },
- { "shared", MS_SHARED },
- { "defaults", 0 },
- { 0, 0 },
-};
-
static bool setMountFlag(const std::string& flag, unsigned* mount_flags) {
+ static constexpr std::pair<const char*, unsigned> mount_flags_list[] = {
+ { "noatime", MS_NOATIME },
+ { "noexec", MS_NOEXEC },
+ { "nosuid", MS_NOSUID },
+ { "nodev", MS_NODEV },
+ { "nodiratime", MS_NODIRATIME },
+ { "ro", MS_RDONLY },
+ { "rw", 0 },
+ { "remount", MS_REMOUNT },
+ { "bind", MS_BIND },
+ { "rec", MS_REC },
+ { "unbindable", MS_UNBINDABLE },
+ { "private", MS_PRIVATE },
+ { "slave", MS_SLAVE },
+ { "shared", MS_SHARED },
+ { "defaults", 0 },
+ };
+
for (const auto& [name, value] : mount_flags_list) {
if (flag == name) {
*mount_flags |= value;