@@ -63,6 +63,7 @@ typedef struct BDRVParallelsState {
unsigned int tracks;
unsigned int off_multiplier;
+ unsigned int padding;
} BDRVParallelsState;
@@ -245,6 +246,7 @@ static int parallels_open_xml(BlockDriverState *bs, int flags, Error **errp)
const char *data;
char image_path[PATH_MAX];
Error *local_err = NULL;
+ BDRVParallelsState *s = bs->opaque;
ret = size = bdrv_getlength(bs->file);
if (ret < 0) {
@@ -274,6 +276,19 @@ static int parallels_open_xml(BlockDriverState *bs, int flags, Error **errp)
if (root == NULL) {
goto fail;
}
+
+ data = xml_get_text(root, "Disk_Parameters", "Padding", NULL);
+ if (data != NULL) {
+ char *endptr;
+ unsigned long pad;
+
+ pad = strtoul(data, &endptr, 0);
+ if ((endptr != NULL && *endptr != '\0') || pad > UINT_MAX) {
+ goto fail;
+ }
+ s->padding = (uint32_t)pad;
+ }
+
image = xml_seek(root, "StorageData", "Storage", "Image", NULL);
data = ""; /* make gcc happy */
for (size = 0; image != NULL; image = image->next) {
@@ -375,6 +390,10 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num)
static int parallels_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
+ BDRVParallelsState *s = bs->opaque;
+
+ sector_num += s->padding;
+
while (nb_sectors > 0) {
int64_t position = seek_to_sector(bs, sector_num);
if (position >= 0) {