From bfcd810b792f7ffbb2ec1360c0c2662725fd0362 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Wed, 22 Aug 2012 13:57:25 -0700 Subject: [PATCH] Iteration on multi-user external storage. Define /storage as top-level concept, so that we enforce permissions uniformly. Moves external storage paths from headers to per-device environment variables. Added missing mount flags, and we no longer have adb-specific external storage. Bug: 6925012 Change-Id: Ic7ca953be2f552d3f0ec9e69f89fef751daa1b29 --- adb/adb.c | 10 ---------- include/private/android_filesystem_config.h | 3 --- rootdir/init.rc | 4 +++- toolbox/mount.c | 5 +++++ 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/adb/adb.c b/adb/adb.c index f3251fea2..8b04fda39 100644 --- a/adb/adb.c +++ b/adb/adb.c @@ -1022,16 +1022,6 @@ int adb_main(int is_daemon, int server_port) } #else - // Our external storage path may be different than apps, since - // we aren't able to bind mount after dropping root. - const char* adb_external_storage = getenv("ADB_EXTERNAL_STORAGE"); - if (NULL != adb_external_storage) { - setenv("EXTERNAL_STORAGE", adb_external_storage, 1); - } else { - D("Warning: ADB_EXTERNAL_STORAGE is not set. Leaving EXTERNAL_STORAGE" - " unchanged.\n"); - } - /* don't listen on a port (default 5037) if running in secure mode */ /* don't run as root if we are running in secure mode */ if (should_drop_privileges()) { diff --git a/include/private/android_filesystem_config.h b/include/private/android_filesystem_config.h index db9efbb1a..6521cbe77 100644 --- a/include/private/android_filesystem_config.h +++ b/include/private/android_filesystem_config.h @@ -229,9 +229,6 @@ static struct fs_path_config android_files[] = { { 00644, AID_ROOT, AID_ROOT, 0 }, }; -#define EXTERNAL_STORAGE_SYSTEM "/mnt/shell/sdcard0" -#define EXTERNAL_STORAGE_APP "/storage/sdcard0" - static inline void fs_config(const char *path, int dir, unsigned *uid, unsigned *gid, unsigned *mode) { diff --git a/rootdir/init.rc b/rootdir/init.rc index 1ed13231f..70cf19fc8 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -34,6 +34,7 @@ loglevel 3 export ANDROID_ROOT /system export ANDROID_ASSETS /system/app export ANDROID_DATA /data + export ANDROID_STORAGE /storage export ASEC_MOUNTPOINT /mnt/asec export LOOP_MOUNTPOINT /mnt/obb export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar @@ -56,8 +57,9 @@ loglevel 3 mkdir /cache 0770 system cache mkdir /config 0500 root root - # Directory for shell-visible mount points, like external storage + # See storage config details at http://source.android.com/tech/storage/ mkdir /mnt/shell 0700 shell shell + mkdir /storage 0050 root sdcard_r # Directory for putting things only root should see. mkdir /mnt/secure 0700 root root diff --git a/toolbox/mount.c b/toolbox/mount.c index 27cf3c9aa..b7adce2d9 100644 --- a/toolbox/mount.c +++ b/toolbox/mount.c @@ -49,12 +49,17 @@ static const struct mount_opts options[] = { { "exec", MS_NOEXEC, 0, MS_NOEXEC }, { "move", MS_TYPE, MS_MOVE, 0 }, { "recurse", MS_REC, MS_REC, 0 }, + { "rec", MS_REC, MS_REC, 0 }, { "remount", MS_TYPE, MS_REMOUNT, 0 }, { "ro", MS_RDONLY, MS_RDONLY, 0 }, { "rw", MS_RDONLY, 0, MS_RDONLY }, { "suid", MS_NOSUID, 0, MS_NOSUID }, { "sync", MS_SYNCHRONOUS, MS_SYNCHRONOUS, 0 }, { "verbose", MS_VERBOSE, MS_VERBOSE, 0 }, + { "unbindable", MS_UNBINDABLE, MS_UNBINDABLE, 0 }, + { "private", MS_PRIVATE, MS_PRIVATE, 0 }, + { "slave", MS_SLAVE, MS_SLAVE, 0 }, + { "shared", MS_SHARED, MS_SHARED, 0 }, }; static void add_extra_option(struct extra_opts *extra, char *s)