Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc000489 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Progress towards dynamic storage support.

To support external storage devices that are dynamically added and
removed at runtime, we're changing /mnt and /storage to be tmpfs that
are managed by vold.

To support primary storage being inserted/ejected at runtime in a
multi-user environment, we can no longer bind-mount each user into
place.  Instead, we have a new /storage/self/primary symlink which
is resolved through /mnt/user/n/primary, and which vold updates at
runtime.

Fix small mode bugs in FUSE daemon so it can be safely mounted
visible to all users on device.

Bug: 19993667
Change-Id: I0ebf4d10aba03d73d9a6fa37d4d43766be8a173b
parent c9eccaa5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ on init
    export ANDROID_ASSETS /system/app
    export ANDROID_DATA /data
    export ANDROID_STORAGE /storage
    export EXTERNAL_STORAGE /sdcard
    export ASEC_MOUNTPOINT /mnt/asec
    export LOOP_MOUNTPOINT /mnt/obb
    export BOOTCLASSPATH %BOOTCLASSPATH%
    export SYSTEMSERVERCLASSPATH %SYSTEMSERVERCLASSPATH%
+22 −21
Original line number Diff line number Diff line
@@ -26,9 +26,6 @@ on early-init

    start ueventd

    # create mountpoints
    mkdir /mnt 0775 root system

on init
    sysclktz 0

@@ -62,28 +59,29 @@ on init
    mkdir /cache 0770 system cache
    mkdir /config 0500 root root

    # Mount staging areas for devices managed by vold
    # See storage config details at http://source.android.com/tech/storage/
    mkdir /mnt/shell 0700 shell shell
    mkdir /mnt/media_rw 0700 media_rw media_rw
    mkdir /storage 0751 root sdcard_r
    mkdir /mnt 0755 root system
    mount tmpfs tmpfs /mnt mode=0755,uid=0,gid=1000
    restorecon_recursive /mnt

    # Directory for putting things only root should see.
    mkdir /mnt/secure 0700 root root

    # Directory for staging bindmounts
    mkdir /mnt/secure/staging 0700 root root

    # Directory-target for where the secure container
    # imagefile directory will be bind-mounted
    mkdir /mnt/secure/asec 0700 root root
    mkdir /mnt/asec 0755 root system
    mkdir /mnt/obb 0755 root system
    mkdir /mnt/media_rw 0750 root media_rw
    mkdir /mnt/user 0755 root root
    mkdir /mnt/user/0 0755 root root

    # Secure container public mount points.
    mkdir /mnt/asec  0700 root system
    mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000
    # sdcard_r is GID 1028
    mkdir /storage 0751 root sdcard_r
    mount tmpfs tmpfs /storage mode=0751,uid=0,gid=1028
    restorecon_recursive /storage

    # Filesystem image public mount points.
    mkdir /mnt/obb 0700 root system
    mount tmpfs tmpfs /mnt/obb mode=0755,gid=1000
    # Symlink to keep legacy apps working in multi-user world
    mkdir /storage/self 0751 root sdcard_r
    symlink /storage/self/primary /sdcard
    symlink /mnt/user/0/primary /storage/self/primary

    # memory control cgroup
    mkdir /dev/memcg 0700 root system
@@ -235,6 +233,9 @@ on post-fs-data
    # We restorecon /data in case the userdata partition has been reset.
    restorecon /data

    # Emulated internal storage area
    mkdir /data/media 0770 media_rw media_rw

    # Start bootcharting as soon as possible after the data partition is
    # mounted to collect more data.
    mkdir /data/bootchart 0755 shell shell
+2 −1
Original line number Diff line number Diff line
@@ -471,6 +471,7 @@ static void derive_permissions_locked(struct fuse* fuse, struct node *parent,
        node->perm = PERM_ROOT;
        node->userid = strtoul(node->name, NULL, 10);
        node->gid = multiuser_get_uid(node->userid, AID_SDCARD_R);
        node->mode = 0771;
        break;
    case PERM_ROOT:
        /* Assume masked off by default. */
@@ -741,7 +742,7 @@ static void fuse_init(struct fuse *fuse, int fd, const char *source_path,
         * places user_id at the top directory level, with the actual roots
         * just below that. Shared OBB path is also at top level. */
        fuse->root.perm = PERM_LEGACY_PRE_ROOT;
        fuse->root.mode = 0771;
        fuse->root.mode = 0711;
        fuse->root.gid = AID_SDCARD_R;
        fuse->package_to_appid = hashmapCreate(256, str_hash, str_icase_equals);
        fuse->uid_with_rw = hashmapCreate(128, int_hash, int_equals);