Prepare /data/user/0 and /data/media/obb during initUser0

Prepare these directories during initUser0.  This greatly shortens the
gap between the creation and encryption of /data/user/0, and this makes
it possible to remove init's write access to all directories containing
per-user encrypted directories.

Bug: 156305599
Change-Id: Ibf3d25356e8f0bca70da078c5d2428ae8615240e
diff --git a/Utils.cpp b/Utils.cpp
index 3757c1f..709853c 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1179,6 +1179,12 @@
     }
 }
 
+// Returns true if |path| exists and is a symlink.
+bool IsSymlink(const std::string& path) {
+    struct stat stbuf;
+    return lstat(path.c_str(), &stbuf) == 0 && S_ISLNK(stbuf.st_mode);
+}
+
 // Returns true if |path1| names the same existing file or directory as |path2|.
 bool IsSameFile(const std::string& path1, const std::string& path2) {
     struct stat stbuf1, stbuf2;