bximage convert / resize: show source disk image mode

hdimage undoable / volatile: log base disk image mode
vmware4: fixed 'cylinders' calculation
This commit is contained in:
Volker Ruppert 2013-10-27 19:23:59 +00:00
parent 7f19435887
commit 2c779f60da
4 changed files with 27 additions and 2 deletions

View File

@ -2004,6 +2004,8 @@ int undoable_image_t::open(const char* pathname, int flags)
if (mode == BX_HDIMAGE_MODE_UNKNOWN) {
BX_PANIC(("r/o disk image mode not detected"));
return -1;
} else {
BX_INFO(("base image mode = '%s'", hdimage_mode_names[mode]));
}
ro_disk = DEV_hdimage_init_image(mode, 0, NULL);
if (ro_disk == NULL) {
@ -2139,6 +2141,8 @@ int volatile_image_t::open(const char* pathname, int flags)
if (mode == BX_HDIMAGE_MODE_UNKNOWN) {
BX_PANIC(("r/o disk image mode not detected"));
return -1;
} else {
BX_INFO(("base image mode = '%s'", hdimage_mode_names[mode]));
}
ro_disk = DEV_hdimage_init_image(mode, 0, NULL);
if (ro_disk == NULL) {

View File

@ -86,7 +86,7 @@ int vmware4_image_t::open(const char* _pathname, int flags)
is_dirty = 0;
hd_size = header.total_sectors * SECTOR_SIZE;
cylinders = (unsigned)hd_size / (16 * 63);
cylinders = (unsigned)(header.total_sectors / (16 * 63));
heads = 16;
spt = 63;

View File

@ -59,6 +59,8 @@ enum {
#define BX_HDIMAGE_MODE_LAST BX_HDIMAGE_MODE_VPC
#define BX_HDIMAGE_MODE_UNKNOWN -1
extern const char *hdimage_mode_names[];
// definitions for compatibility with Bochs
#ifndef UNUSED
# define UNUSED(x) ((void)x)

View File

@ -81,6 +81,22 @@
const int bx_max_hd_megs = (int)(((1 << BX_MAX_CYL_BITS) - 1) * 16.0 * 63.0 / 2048.0);
const char *hdimage_mode_names[] = {
"flat",
"concat",
"external",
"dll",
"sparse",
"vmware3",
"vmware4",
"undoable",
"growing",
"volatile",
"vvfat",
"vpc",
NULL
};
int bximage_mode;
int bx_hdimage;
int bx_fdsize_idx;
@ -641,8 +657,11 @@ void convert_image(int newimgmode, Bit64u newsize)
if (mode == -1) {
mode = hdimage_detect_image_mode(bx_filename_1);
}
if (mode == BX_HDIMAGE_MODE_UNKNOWN)
if (mode == BX_HDIMAGE_MODE_UNKNOWN) {
fatal("source disk image mode not detected");
} else {
BX_INFO(("source image mode = '%s'", hdimage_mode_names[mode]));
}
source_image = init_image(mode);
if (source_image->open(bx_filename_1, O_RDONLY) < 0)