Lines 4877-4889
Link Here
|
4877 |
int bus_id, unit_id; |
4877 |
int bus_id, unit_id; |
4878 |
int cyls, heads, secs, translation; |
4878 |
int cyls, heads, secs, translation; |
4879 |
BlockDriverState *bdrv; |
4879 |
BlockDriverState *bdrv; |
|
|
4880 |
BlockDriver *drv = NULL; |
4880 |
int max_devs; |
4881 |
int max_devs; |
4881 |
int index; |
4882 |
int index; |
4882 |
int cache; |
4883 |
int cache; |
4883 |
int bdrv_flags; |
4884 |
int bdrv_flags; |
4884 |
char *params[] = { "bus", "unit", "if", "index", "cyls", "heads", |
4885 |
char *params[] = { "bus", "unit", "if", "index", "cyls", "heads", |
4885 |
"secs", "trans", "media", "snapshot", "file", |
4886 |
"secs", "trans", "media", "snapshot", "file", |
4886 |
"cache", NULL }; |
4887 |
"cache", "format", NULL }; |
4887 |
|
4888 |
|
4888 |
if (check_params(buf, sizeof(buf), params, str) < 0) { |
4889 |
if (check_params(buf, sizeof(buf), params, str) < 0) { |
4889 |
fprintf(stderr, "qemu: unknowm parameter '%s' in '%s'\n", |
4890 |
fprintf(stderr, "qemu: unknowm parameter '%s' in '%s'\n", |
Lines 5051-5056
Link Here
|
5051 |
} |
5052 |
} |
5052 |
} |
5053 |
} |
5053 |
|
5054 |
|
|
|
5055 |
if (get_param_value(buf, sizeof(buf), "format", str)) { |
5056 |
drv = bdrv_find_format(buf); |
5057 |
if (!drv) { |
5058 |
fprintf(stderr, "qemu: '%s' invalid format\n", buf); |
5059 |
return -1; |
5060 |
} |
5061 |
} |
5062 |
|
5054 |
get_param_value(file, sizeof(file), "file", str); |
5063 |
get_param_value(file, sizeof(file), "file", str); |
5055 |
|
5064 |
|
5056 |
/* compute bus and unit according index */ |
5065 |
/* compute bus and unit according index */ |
Lines 5150-5156
Link Here
|
5150 |
bdrv_flags |= BDRV_O_SNAPSHOT; |
5159 |
bdrv_flags |= BDRV_O_SNAPSHOT; |
5151 |
if (!cache) |
5160 |
if (!cache) |
5152 |
bdrv_flags |= BDRV_O_DIRECT; |
5161 |
bdrv_flags |= BDRV_O_DIRECT; |
5153 |
if (bdrv_open(bdrv, file, bdrv_flags) < 0 || qemu_key_check(bdrv, file)) { |
5162 |
if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0 || qemu_key_check(bdrv, file)) { |
5154 |
fprintf(stderr, "qemu: could not open disk image %s\n", |
5163 |
fprintf(stderr, "qemu: could not open disk image %s\n", |
5155 |
file); |
5164 |
file); |
5156 |
return -1; |
5165 |
return -1; |