If the base image of an undoable/volatile mode image has a builtin geometry,

the toplevel image inherits the base image settings.
This commit is contained in:
Volker Ruppert 2018-03-31 17:07:44 +00:00
parent 1855f22d2b
commit 1aab0f9e31
2 changed files with 24 additions and 0 deletions

View File

@ -2153,6 +2153,14 @@ int undoable_image_t::open(const char* pathname, int flags)
return -1;
hd_size = ro_disk->hd_size;
if (ro_disk->get_capabilities() & HDIMAGE_HAS_GEOMETRY) {
cylinders = ro_disk->cylinders;
heads = ro_disk->heads;
spt = ro_disk->spt;
caps = HDIMAGE_HAS_GEOMETRY;
} else if (cylinders == 0) {
caps = HDIMAGE_AUTO_GEOMETRY;
}
sect_size = ro_disk->sect_size;
// If not set, we make up the redolog filename from the pathname
@ -2300,6 +2308,14 @@ int volatile_image_t::open(const char* pathname, int flags)
return -1;
hd_size = ro_disk->hd_size;
if (ro_disk->get_capabilities() & HDIMAGE_HAS_GEOMETRY) {
cylinders = ro_disk->cylinders;
heads = ro_disk->heads;
spt = ro_disk->spt;
caps = HDIMAGE_HAS_GEOMETRY;
} else if (cylinders == 0) {
caps = HDIMAGE_AUTO_GEOMETRY;
}
sect_size = ro_disk->sect_size;
// If not set, use pathname as template

View File

@ -539,6 +539,9 @@ class undoable_image_t : public device_image_t
// written (count).
ssize_t write(const void* buf, size_t count);
// Get image capabilities
virtual Bit32u get_capabilities() {return caps;}
#ifndef BXIMAGE
// Save/restore support
bx_bool save_state(const char *backup_fname);
@ -549,6 +552,7 @@ class undoable_image_t : public device_image_t
redolog_t *redolog; // Redolog instance
device_image_t *ro_disk; // Read-only base disk instance
char *redolog_name; // Redolog name
Bit32u caps;
};
@ -578,6 +582,9 @@ class volatile_image_t : public device_image_t
// written (count).
ssize_t write(const void* buf, size_t count);
// Get image capabilities
virtual Bit32u get_capabilities() {return caps;}
#ifndef BXIMAGE
// Save/restore support
bx_bool save_state(const char *backup_fname);
@ -589,6 +596,7 @@ class volatile_image_t : public device_image_t
device_image_t *ro_disk; // Read-only base disk instance
char *redolog_name; // Redolog name
char *redolog_temp; // Redolog temporary file name
Bit32u caps;
};