diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-03-16 10:17:47 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2015-03-30 19:48:38 -0700 |
commit | fc0004894a3ff93382493688bb9ab9af83b74ea4 (patch) | |
tree | e145001c3dd2dae12c628b1e7eefc0cefa2dcc54 | |
parent | c9eccaa58b11af9f5cc73194deac0bc391e6d867 (diff) | |
download | system_core-fc0004894a3ff93382493688bb9ab9af83b74ea4.zip system_core-fc0004894a3ff93382493688bb9ab9af83b74ea4.tar.gz system_core-fc0004894a3ff93382493688bb9ab9af83b74ea4.tar.bz2 |
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
-rw-r--r-- | rootdir/init.environ.rc.in | 2 | ||||
-rw-r--r-- | rootdir/init.rc | 43 | ||||
-rw-r--r-- | sdcard/sdcard.c | 3 |
3 files changed, 25 insertions, 23 deletions
diff --git a/rootdir/init.environ.rc.in b/rootdir/init.environ.rc.in index 0064790..b34ea01 100644 --- a/rootdir/init.environ.rc.in +++ b/rootdir/init.environ.rc.in @@ -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% diff --git a/rootdir/init.rc b/rootdir/init.rc index 70bb59b..9fad0ed 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -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 + 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 + + # sdcard_r is GID 1028 + mkdir /storage 0751 root sdcard_r + mount tmpfs tmpfs /storage mode=0751,uid=0,gid=1028 + restorecon_recursive /storage - # 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 - - # Secure container public mount points. - mkdir /mnt/asec 0700 root system - mount tmpfs tmpfs /mnt/asec mode=0755,gid=1000 - - # 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 diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c index 599236f..2cb41e5 100644 --- a/sdcard/sdcard.c +++ b/sdcard/sdcard.c @@ -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); |