aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/avd/hardware-properties.ini9
-rw-r--r--android/avd/hw-config-defs.h8
-rw-r--r--android/avd/info.c24
-rw-r--r--android/avd/info.h1
-rw-r--r--android/main-common.c1
-rw-r--r--android/main.c110
6 files changed, 87 insertions, 66 deletions
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 8dca7fe..69abdaa 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -262,11 +262,10 @@ name = disk.dataPartition.size
type = diskSize
default = 0
abstract = Ideal size of data partition
-description = ideal size of data partition. Ignored if smaller than the size of .path (or .initPath). Otherwise, gives the maximum size the partition is allowed to grow dynamically.
-# Path to the snapshots partition.
-name = disk.snapshots.path
+# Path to the snapshots storage file.
+name = disk.snapStorage.path
type = string
default =
-abstract = Path to snapshots
-description = Path to a 'snapshot storage' file, where all snapshots are stored, including the default snapshot.
+abstract = Path to snapshot storage
+description = Path to a 'snapshot storage' file, where all snapshots are stored.
diff --git a/android/avd/hw-config-defs.h b/android/avd/hw-config-defs.h
index 3d3ba5e..6c8ccae 100644
--- a/android/avd/hw-config-defs.h
+++ b/android/avd/hw-config-defs.h
@@ -263,11 +263,11 @@ HWCFG_DISKSIZE(
"ideal size of data partition. Ignored if smaller than the size of .path (or .initPath). Otherwise, gives the maximum size the partition is allowed to grow dynamically.")
HWCFG_STRING(
- disk_snapshots_path,
- "disk.snapshots.path",
+ disk_snapStorage_path,
+ "disk.snapStorage.path",
"",
- "Path to snapshots",
- "Path to a 'snapshot storage' file, where all snapshots are stored, including the default snapshot.")
+ "Path to snapshot storage",
+ "Path to a 'snapshot storage' file, where all snapshots are stored.")
#undef HWCFG_INT
#undef HWCFG_BOOL
diff --git a/android/avd/info.c b/android/avd/info.c
index 61142ba..ca4f0cf 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 noSnapshots = (params->flags & AVDINFO_NO_SNAPSHOTS) != 0;
ImageLoader l[1];
@@ -1183,14 +1182,6 @@ _avdInfo_getImagePaths(AvdInfo* i, AvdInfoParams* params )
imageLoader_lock( l, 0 );
}
- /* the state snapshot image. Mounting behaviour identical to
- * SD card.
- */
- if (!noSnapshots) {
- imageLoader_loadOptional(l, AVD_IMAGE_SNAPSHOTS,
- params->forcePaths[AVD_IMAGE_SNAPSHOTS]);
- }
-
return 0;
}
@@ -1284,7 +1275,6 @@ static int
_avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params )
{
int wipeData = (params->flags & AVDINFO_WIPE_DATA) != 0;
- int noSnapshots = (params->flags & AVDINFO_NO_SNAPSHOTS) != 0;
char temp[PATH_MAX];
char* srcData;
@@ -1354,13 +1344,6 @@ _avdInfo_getBuildImagePaths( AvdInfo* i, AvdInfoParams* params )
/* force the system image to read-only status */
l->pState[0] = IMAGE_STATE_READONLY;
- /** State snapshots image
- **/
- if (!noSnapshots) {
- imageLoader_set (l, AVD_IMAGE_SNAPSHOTS);
- imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED);
- }
-
return 0;
}
@@ -1532,6 +1515,13 @@ char* avdInfo_getSdCardPath( AvdInfo* i )
}
char*
+avdInfo_getSnapStoragePath( AvdInfo* i )
+{
+ const char* imageName = _imageFileNames[ AVD_IMAGE_SNAPSHOTS ];
+ return _avdInfo_getContentFilePath(i, imageName);
+}
+
+char*
avdInfo_getSystemInitImagePath( AvdInfo* i )
{
const char* imageName = _imageFileNames[ AVD_IMAGE_INITSYSTEM ];
diff --git a/android/avd/info.h b/android/avd/info.h
index 38f8a9f..afc71fb 100644
--- a/android/avd/info.h
+++ b/android/avd/info.h
@@ -137,6 +137,7 @@ const char* avdInfo_getName( AvdInfo* i );
char* avdInfo_getKernelPath( AvdInfo* i );
char* avdInfo_getRamdiskPath( AvdInfo* i );
char* avdInfo_getSdCardPath( AvdInfo* i );
+char* avdInfo_getSnapStoragePath( AvdInfo* i );
/* This function returns NULL if the cache image file cannot be found.
* Use avdInfo_getDefaultCachePath() to retrieve the default path
diff --git a/android/main-common.c b/android/main-common.c
index cc478b0..740f59a 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -1039,7 +1039,6 @@ updateHwConfigFromAVD(AndroidHwConfig* hwConfig,
_update_hwconfig_path(&hwConfig->disk_dataPartition_path, avd, AVD_IMAGE_USERDATA);
_update_hwconfig_path(&hwConfig->disk_systemPartition_path, avd, AVD_IMAGE_USERSYSTEM);
_update_hwconfig_path(&hwConfig->disk_dataPartition_path, avd, AVD_IMAGE_INITDATA);
- _update_hwconfig_path(&hwConfig->disk_snapshots_path, avd, AVD_IMAGE_SNAPSHOTS);
if (opts->partition_size) {
char* end;
diff --git a/android/main.c b/android/main.c
index ae0fee6..240574a 100644
--- a/android/main.c
+++ b/android/main.c
@@ -194,7 +194,7 @@ int main(int argc, char **argv)
if (opts->version) {
printf("Android emulator version %s\n"
- "Copyright (C) 2006-2008 The Android Open Source Project and many others.\n"
+ "Copyright (C) 2006-2011 The Android Open Source Project and many others.\n"
"This program is a derivative of the QEMU CPU emulator (www.qemu.org).\n\n",
#if defined ANDROID_BUILD_ID
VERSION_STRING " (build_id " STRINGIFY(ANDROID_BUILD_ID) ")" );
@@ -212,6 +212,10 @@ int main(int argc, char **argv)
exit(0);
}
+ if (opts->snapshot_list) {
+ snapshot_print_and_exit(opts->snapstorage);
+ }
+
sanitizeOptions(opts);
/* Initialization of UI started with -attach-core should work differently
@@ -537,46 +541,81 @@ int main(int argc, char **argv)
/** SNAPSHOT STORAGE HANDLING */
- if (!opts->no_snapstorage) {
- // TODO: This should go to core
- opts->snapstorage = (char*) avdInfo_getImageFile(avd, AVD_IMAGE_SNAPSHOTS);
- if(opts->snapstorage) {
- if (path_exists(opts->snapstorage)) {
- args[n++] = "-hdb";
- args[n++] = opts->snapstorage;
- } else {
- D("no image at '%s', state snapshots disabled", opts->snapstorage);
+ /* Determine snapstorage path. -no-snapstorage disables all snapshotting
+ * support. This means you can't resume a snapshot at load, save it at
+ * exit, or even load/save them dynamically at runtime with the console.
+ */
+ if (opts->no_snapstorage) {
+
+ if (opts->snapshot) {
+ dwarning("ignoring -snapshot option due to the use of -no-snapstorage");
+ opts->snapshot = NULL;
+ }
+
+ if (opts->snapstorage) {
+ dwarning("ignoring -snapstorage option due to the use of -no-snapstorage");
+ opts->snapstorage = NULL;
+ }
+ }
+ else
+ {
+ if (!opts->snapstorage) {
+ opts->snapstorage = avdInfo_getSnapStoragePath(avd);
+ if (opts->snapstorage != NULL) {
+ D("autoconfig: -snapstorage %s", opts->snapstorage);
}
}
- if (!opts->no_snapshot) {
- char* snapshot_name =
- opts->snapshot ? opts->snapshot : "default-boot";
- if (!opts->no_snapshot_load) {
- args[n++] = "-loadvm";
- args[n++] = snapshot_name;
+ if (opts->snapstorage && !path_exists(opts->snapstorage)) {
+ D("no image at '%s', state snapshots disabled", opts->snapstorage);
+ opts->snapstorage = NULL;
+ }
+ }
+
+ /* If we have a valid snapshot storage path */
+
+ if (opts->snapstorage) {
+
+ hw->disk_snapStorage_path = ASTRDUP(opts->snapstorage);
+
+ /* -no-snapshot is equivalent to using both -no-snapshot-load
+ * and -no-snapshot-save. You can still load/save snapshots dynamically
+ * from the console though.
+ */
+ if (opts->no_snapshot) {
+
+ opts->no_snapshot_load = 1;
+ opts->no_snapshot_save = 1;
+
+ if (opts->snapshot) {
+ dwarning("ignoring -snapshot option due to the use of -no-snapshot.");
}
- if (!opts->no_snapshot_save) {
- args[n++] = "-savevm-on-exit";
- args[n++] = snapshot_name;
+ }
+
+ if (!opts->no_snapshot_load || !opts->no_snapshot_save) {
+ if (opts->snapshot == NULL) {
+ opts->snapshot = "default-boot";
+ D("autoconfig: -snapshot %s", opts->snapshot);
}
- } else if (opts->snapshot) {
- dwarning("option '-no-snapshot' overrides '-snapshot', continuing with boot sequence");
- } else if (opts->no_snapshot_load || opts->no_snapshot_save) {
- D("ignoring redundant option(s) '-no-snapshot-load' and/or '-no-snapshot-save' implied by '-no-snapshot'");
}
+
+ /* We still use QEMU command-line options for the following since
+ * they can change from one invokation to the next and don't really
+ * correspond to the hardware configuration itself.
+ */
+ if (!opts->no_snapshot_load) {
+ args[n++] = "-loadvm";
+ args[n++] = ASTRDUP(opts->snapshot);
+ }
+
+ if (!opts->no_snapshot_save) {
+ args[n++] = "-savevm-on-exit";
+ args[n++] = ASTRDUP(opts->snapshot);
+ }
+
if (opts->no_snapshot_update_time) {
args[n++] = "-snapshot-no-time-update";
}
- } else if (opts->snapshot || opts->snapstorage) {
- dwarning("option '-no-snapstorage' overrides '-snapshot' and '-snapstorage', "
- "continuing with full boot, state snapshots are disabled");
- } else if (opts->no_snapshot) {
- D("ignoring redundant option '-no-snapshot' implied by '-no-snapstorage'");
- }
-
- if (opts->snapshot_list) {
- snapshot_print_and_exit(opts->snapstorage);
}
if (!opts->logcat || opts->logcat[0] == 0) {
@@ -585,13 +624,6 @@ int main(int argc, char **argv)
opts->logcat = NULL;
}
-#if 0
- if (opts->console) {
- derror( "option -console is obsolete. please use -shell instead" );
- exit(1);
- }
-#endif
-
/* we always send the kernel messages from ttyS0 to android_kmsg */
{
if (opts->show_kernel) {