Make encryption action an argument to mkdir
FscryptSetDirectoryPolicy no longer tries to infer the action from the
filename. Well mostly; it still assumes top-level directories in /data
should be encrypted unless the mkdir arguments say otherwise, but
it warns.
Bug: 26641735
Test: boot, check log messages
Change-Id: Id6d2cea7fb856f17323897d85cf6190c981b443c
diff --git a/init/check_builtins.cpp b/init/check_builtins.cpp
index 2efaeea..9d23921 100644
--- a/init/check_builtins.cpp
+++ b/init/check_builtins.cpp
@@ -121,22 +121,10 @@
}
Result<void> check_mkdir(const BuiltinArguments& args) {
- if (args.size() >= 4) {
- if (!args[3].empty()) {
- auto uid = DecodeUid(args[3]);
- if (!uid) {
- return Error() << "Unable to decode UID for '" << args[3] << "': " << uid.error();
- }
- }
-
- if (args.size() == 5 && !args[4].empty()) {
- auto gid = DecodeUid(args[4]);
- if (!gid) {
- return Error() << "Unable to decode GID for '" << args[4] << "': " << gid.error();
- }
- }
+ auto options = ParseMkdir(args.args);
+ if (!options) {
+ return options.error();
}
-
return {};
}