From 48a3c66361158678f476fc7c2eca2bef025eae62 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Tue, 1 Mar 2011 14:03:20 +0100 Subject: Move the SD Card initialization to the core. Change-Id: I2c8fa2a7df3d79ed4222296a93b787994a8ee11d --- android/avd/hardware-properties.ini | 12 +++++------ android/avd/hw-config-defs.h | 14 ++++++------- android/avd/info.c | 41 +++++++++++++++++++++---------------- android/avd/info.h | 2 ++ 4 files changed, 37 insertions(+), 32 deletions(-) (limited to 'android/avd') diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini index 06ac447..8dca7fe 100644 --- a/android/avd/hardware-properties.ini +++ b/android/avd/hardware-properties.ini @@ -136,6 +136,11 @@ default = yes abstract = SD Card support description = Whether the device supports insertion/removal of virtual SD Cards. +name = hw.sdCard.path +type = string +default = +abstract = SD Card image path + # Cache partition name = disk.cachePartition type = boolean @@ -265,10 +270,3 @@ type = string default = abstract = Path to snapshots description = Path to a 'snapshot storage' file, where all snapshots are stored, including the default snapshot. - -# Path to SD Card image file. -name = disk.sdCard.path -type = string -default = -abstract = Path to SD Card image file -description = Path to SD Card image file. Ignored if disk.sdCard is not set to 'yes'. diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h index c3e0a77..3d3ba5e 100644 --- a/android/avd/hw-config-defs.h +++ b/android/avd/hw-config-defs.h @@ -129,6 +129,13 @@ HWCFG_BOOL( "SD Card support", "Whether the device supports insertion/removal of virtual SD Cards.") +HWCFG_STRING( + hw_sdCard_path, + "hw.sdCard.path", + "", + "SD Card image path", + "") + HWCFG_BOOL( disk_cachePartition, "disk.cachePartition", @@ -262,13 +269,6 @@ HWCFG_STRING( "Path to snapshots", "Path to a 'snapshot storage' file, where all snapshots are stored, including the default snapshot.") -HWCFG_STRING( - disk_sdCard_path, - "disk.sdCard.path", - "", - "Path to SD Card image file", - "Path to SD Card image file. Ignored if disk.sdCard is not set to 'yes'.") - #undef HWCFG_INT #undef HWCFG_BOOL #undef HWCFG_DISKSIZE diff --git a/android/avd/info.c b/android/avd/info.c index aad316a..61142ba 100644 --- a/android/avd/info.c +++ b/android/avd/info.c @@ -1130,7 +1130,6 @@ static int _avdInfo_getImagePaths(AvdInfo* i, AvdInfoParams* params ) { int wipeData = (params->flags & AVDINFO_WIPE_DATA) != 0; - int noSdCard = (params->flags & AVDINFO_NO_SDCARD) != 0; int noSnapshots = (params->flags & AVDINFO_NO_SNAPSHOTS) != 0; ImageLoader l[1]; @@ -1184,15 +1183,6 @@ _avdInfo_getImagePaths(AvdInfo* i, AvdInfoParams* params ) imageLoader_lock( l, 0 ); } - /* the SD Card image. unless the user doesn't want to, we're - * going to mount it if available. Note that if the image is - * already used, we must ignore it. - */ - if (!noSdCard) { - imageLoader_loadOptional(l, AVD_IMAGE_SDCARD, - params->forcePaths[AVD_IMAGE_SDCARD]); - } - /* the state snapshot image. Mounting behaviour identical to * SD card. */ @@ -1294,7 +1284,6 @@ static int _avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params ) { int wipeData = (params->flags & AVDINFO_WIPE_DATA) != 0; - int noSdCard = (params->flags & AVDINFO_NO_SDCARD) != 0; int noSnapshots = (params->flags & AVDINFO_NO_SNAPSHOTS) != 0; char temp[PATH_MAX]; @@ -1365,13 +1354,6 @@ _avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params ) /* force the system image to read-only status */ l->pState[0] = IMAGE_STATE_READONLY; - /** SD Card image - **/ - if (!noSdCard) { - imageLoader_set (l, AVD_IMAGE_SDCARD); - imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED); - } - /** State snapshots image **/ if (!noSnapshots) { @@ -1526,6 +1508,29 @@ char* avdInfo_getDefaultCachePath( AvdInfo* i ) return _getFullFilePath(i->contentPath, imageName); } +char* avdInfo_getSdCardPath( AvdInfo* i ) +{ + const char* imageName = _imageFileNames[ AVD_IMAGE_SDCARD ]; + char* path; + + /* Special case, the config.ini can have a SDCARD_PATH entry + * that gives the full path to the SD Card. + */ + if (i->configIni != NULL) { + path = iniFile_getString(i->configIni, SDCARD_PATH, NULL); + if (path != NULL) { + if (path_exists(path)) + return path; + + dwarning("Ignoring invalid SDCard path: %s", path); + AFREE(path); + } + } + + /* Otherwise, simply look into the content directory */ + return _avdInfo_getContentFilePath(i, imageName); +} + char* avdInfo_getSystemInitImagePath( AvdInfo* i ) { diff --git a/android/avd/info.h b/android/avd/info.h index 9410653..38f8a9f 100644 --- a/android/avd/info.h +++ b/android/avd/info.h @@ -136,6 +136,7 @@ const char* avdInfo_getName( AvdInfo* i ); */ char* avdInfo_getKernelPath( AvdInfo* i ); char* avdInfo_getRamdiskPath( AvdInfo* i ); +char* avdInfo_getSdCardPath( AvdInfo* i ); /* This function returns NULL if the cache image file cannot be found. * Use avdInfo_getDefaultCachePath() to retrieve the default path @@ -144,6 +145,7 @@ char* avdInfo_getRamdiskPath( AvdInfo* i ); char* avdInfo_getCachePath( AvdInfo* i ); char* avdInfo_getDefaultCachePath( AvdInfo* i ); + char* avdInfo_getSystemInitImagePath( AvdInfo* i ); char* avdInfo_getDataInitImagePath( AvdInfo* i ); -- cgit v1.1