Merge "Migrate sdcard0 to shell-accessible location." into jb-mr1-dev

This commit is contained in:
Jeff Brown 2012-08-20 13:15:38 -07:00 committed by Android (Google) Code Review
commit a8c2112be6
3 changed files with 7 additions and 22 deletions

View File

@ -990,26 +990,6 @@ static int should_drop_privileges() {
}
#endif /* !ADB_HOST */
#if !ADB_HOST
/* Give ourselves access to external storage, which is otherwise protected. */
static void mount_external_storage(void) {
// Create private mount namespace for our process
if (unshare(CLONE_NEWNS) == -1) {
fatal_errno("Failed to unshare()");
}
// Mark rootfs as being a slave in our process so that changes
// from parent namespace flow into our process.
if (mount("rootfs", "/", NULL, (MS_SLAVE | MS_REC), NULL) == -1) {
fatal_errno("Failed to mount() rootfs as MS_SLAVE");
}
if (mount(EXTERNAL_STORAGE_SYSTEM, EXTERNAL_STORAGE_APP, "none", MS_BIND, NULL) == -1) {
fatal_errno("Failed to mount() from %s", EXTERNAL_STORAGE_SYSTEM);
}
}
#endif /* !ADB_HOST */
int adb_main(int is_daemon, int server_port)
{
#if !ADB_HOST
@ -1042,7 +1022,9 @@ int adb_main(int is_daemon, int server_port)
}
#else
mount_external_storage();
// Our external storage path may be different than apps, since
// we aren't able to bind mount after dropping root.
setenv("EXTERNAL_STORAGE", getenv("ADB_EXTERNAL_STORAGE"), 1);
/* 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 */

View File

@ -229,7 +229,7 @@ static struct fs_path_config android_files[] = {
{ 00644, AID_ROOT, AID_ROOT, 0 },
};
#define EXTERNAL_STORAGE_SYSTEM "/mnt/secure/sdcard0"
#define EXTERNAL_STORAGE_SYSTEM "/mnt/shell/sdcard0"
#define EXTERNAL_STORAGE_APP "/storage/sdcard0"
static inline void fs_config(const char *path, int dir,

View File

@ -56,6 +56,9 @@ loglevel 3
mkdir /cache 0770 system cache
mkdir /config 0500 root root
# Directory for shell-visible mount points, like external storage
mkdir /mnt/shell 0700 shell shell
# Directory for putting things only root should see.
mkdir /mnt/secure 0700 root root