PDP11, VAX: Fix VHD Differencing disk parent locator descriptors and removed deprecated descriptor types
This commit is contained in:
parent
b2134a01cf
commit
3b1b7d6aaf
1 changed files with 23 additions and 51 deletions
74
sim_disk.c
74
sim_disk.c
|
@ -3516,32 +3516,22 @@ for (i=0; i < strlen(RelativeParentVHDPath); i++)
|
||||||
RelativeParentVHDPathUnicode[i*2] = RelativeParentVHDPath[i];
|
RelativeParentVHDPathUnicode[i*2] = RelativeParentVHDPath[i];
|
||||||
hVHD->Dynamic.ParentTimeStamp = ParentTimeStamp;
|
hVHD->Dynamic.ParentTimeStamp = ParentTimeStamp;
|
||||||
memcpy (hVHD->Dynamic.ParentUniqueID, ParentFooter.UniqueID, sizeof (hVHD->Dynamic.ParentUniqueID));
|
memcpy (hVHD->Dynamic.ParentUniqueID, ParentFooter.UniqueID, sizeof (hVHD->Dynamic.ParentUniqueID));
|
||||||
hVHD->Dynamic.ParentLocatorEntries[7].PlatformDataSpace = NtoHl (BytesPerSector);
|
/* There are two potential parent locators on current vhds */
|
||||||
hVHD->Dynamic.ParentLocatorEntries[7].Reserved = 0;
|
memcpy (hVHD->Dynamic.ParentLocatorEntries[0].PlatformCode, "W2ku", 4);
|
||||||
hVHD->Dynamic.ParentLocatorEntries[7].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
hVHD->Dynamic.ParentLocatorEntries[0].PlatformDataSpace = NtoHl (BytesPerSector);
|
||||||
++LocatorsWritten;
|
hVHD->Dynamic.ParentLocatorEntries[0].PlatformDataLength = NtoHl ((uint32)(2*strlen(FullParentVHDPath)));
|
||||||
memcpy (hVHD->Dynamic.ParentLocatorEntries[6].PlatformCode, "Wi2k", 4);
|
hVHD->Dynamic.ParentLocatorEntries[0].Reserved = 0;
|
||||||
hVHD->Dynamic.ParentLocatorEntries[6].PlatformDataSpace = NtoHl (BytesPerSector);
|
hVHD->Dynamic.ParentLocatorEntries[0].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
||||||
hVHD->Dynamic.ParentLocatorEntries[6].Reserved = 0;
|
|
||||||
hVHD->Dynamic.ParentLocatorEntries[6].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
|
||||||
++LocatorsWritten;
|
++LocatorsWritten;
|
||||||
if (RelativeMatch) {
|
if (RelativeMatch) {
|
||||||
memcpy (hVHD->Dynamic.ParentLocatorEntries[7].PlatformCode, "Wi2r", 4);
|
memcpy (hVHD->Dynamic.ParentLocatorEntries[1].PlatformCode, "W2ru", 4);
|
||||||
hVHD->Dynamic.ParentLocatorEntries[7].PlatformDataLength = NtoHl ((uint32)(strlen(RelativeParentVHDPath)));
|
hVHD->Dynamic.ParentLocatorEntries[1].PlatformDataSpace = NtoHl (BytesPerSector);
|
||||||
memcpy (hVHD->Dynamic.ParentLocatorEntries[5].PlatformCode, "W2ru", 4);
|
hVHD->Dynamic.ParentLocatorEntries[1].PlatformDataLength = NtoHl ((uint32)(2*strlen(RelativeParentVHDPath)));
|
||||||
hVHD->Dynamic.ParentLocatorEntries[5].PlatformDataSpace = NtoHl (BytesPerSector);
|
hVHD->Dynamic.ParentLocatorEntries[1].Reserved = 0;
|
||||||
hVHD->Dynamic.ParentLocatorEntries[5].PlatformDataLength = NtoHl ((uint32)(2*strlen(RelativeParentVHDPath)));
|
hVHD->Dynamic.ParentLocatorEntries[1].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
||||||
hVHD->Dynamic.ParentLocatorEntries[5].Reserved = 0;
|
|
||||||
hVHD->Dynamic.ParentLocatorEntries[5].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
|
||||||
++LocatorsWritten;
|
++LocatorsWritten;
|
||||||
}
|
}
|
||||||
memcpy (hVHD->Dynamic.ParentLocatorEntries[4].PlatformCode, "W2ku", 4);
|
hVHD->Dynamic.TableOffset = NtoHll (((LocatorPosition+LocatorsWritten*BytesPerSector + VHD_DATA_BLOCK_ALIGNMENT - 1)/VHD_DATA_BLOCK_ALIGNMENT)*VHD_DATA_BLOCK_ALIGNMENT);
|
||||||
hVHD->Dynamic.ParentLocatorEntries[4].PlatformDataSpace = NtoHl (BytesPerSector);
|
|
||||||
hVHD->Dynamic.ParentLocatorEntries[4].PlatformDataLength = NtoHl ((uint32)(2*strlen(FullParentVHDPath)));
|
|
||||||
hVHD->Dynamic.ParentLocatorEntries[4].Reserved = 0;
|
|
||||||
hVHD->Dynamic.ParentLocatorEntries[4].PlatformDataOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
|
||||||
++LocatorsWritten;
|
|
||||||
hVHD->Dynamic.TableOffset = NtoHll (LocatorPosition+LocatorsWritten*BytesPerSector);
|
|
||||||
hVHD->Dynamic.Checksum = NtoHl (CalculateVhdFooterChecksum (&hVHD->Dynamic, sizeof(hVHD->Dynamic)));
|
hVHD->Dynamic.Checksum = NtoHl (CalculateVhdFooterChecksum (&hVHD->Dynamic, sizeof(hVHD->Dynamic)));
|
||||||
hVHD->Footer.Checksum = 0;
|
hVHD->Footer.Checksum = 0;
|
||||||
hVHD->Footer.DiskType = NtoHl (VHD_DT_Differencing);
|
hVHD->Footer.DiskType = NtoHl (VHD_DT_Differencing);
|
||||||
|
@ -3580,39 +3570,21 @@ if (WriteFilePosition (hVHD->File,
|
||||||
Status = errno;
|
Status = errno;
|
||||||
goto Cleanup_Return;
|
goto Cleanup_Return;
|
||||||
}
|
}
|
||||||
if (hVHD->Dynamic.ParentLocatorEntries[7].PlatformDataLength)
|
if (hVHD->Dynamic.ParentLocatorEntries[0].PlatformDataLength)
|
||||||
if (WriteFilePosition (hVHD->File,
|
|
||||||
RelativeParentVHDPath,
|
|
||||||
BytesPerSector,
|
|
||||||
NULL,
|
|
||||||
NtoHll (hVHD->Dynamic.ParentLocatorEntries[7].PlatformDataOffset))) {
|
|
||||||
Status = errno;
|
|
||||||
goto Cleanup_Return;
|
|
||||||
}
|
|
||||||
if (hVHD->Dynamic.ParentLocatorEntries[6].PlatformDataLength)
|
|
||||||
if (WriteFilePosition (hVHD->File,
|
|
||||||
FullParentVHDPath,
|
|
||||||
BytesPerSector,
|
|
||||||
NULL,
|
|
||||||
NtoHll (hVHD->Dynamic.ParentLocatorEntries[6].PlatformDataOffset))) {
|
|
||||||
Status = errno;
|
|
||||||
goto Cleanup_Return;
|
|
||||||
}
|
|
||||||
if (hVHD->Dynamic.ParentLocatorEntries[5].PlatformDataLength)
|
|
||||||
if (WriteFilePosition (hVHD->File,
|
|
||||||
RelativeParentVHDPathUnicode,
|
|
||||||
BytesPerSector,
|
|
||||||
NULL,
|
|
||||||
NtoHll (hVHD->Dynamic.ParentLocatorEntries[5].PlatformDataOffset))) {
|
|
||||||
Status = errno;
|
|
||||||
goto Cleanup_Return;
|
|
||||||
}
|
|
||||||
if (hVHD->Dynamic.ParentLocatorEntries[4].PlatformDataLength)
|
|
||||||
if (WriteFilePosition (hVHD->File,
|
if (WriteFilePosition (hVHD->File,
|
||||||
FullParentVHDPathUnicode,
|
FullParentVHDPathUnicode,
|
||||||
BytesPerSector,
|
BytesPerSector,
|
||||||
NULL,
|
NULL,
|
||||||
NtoHll (hVHD->Dynamic.ParentLocatorEntries[4].PlatformDataOffset))) {
|
NtoHll (hVHD->Dynamic.ParentLocatorEntries[0].PlatformDataOffset))) {
|
||||||
|
Status = errno;
|
||||||
|
goto Cleanup_Return;
|
||||||
|
}
|
||||||
|
if (hVHD->Dynamic.ParentLocatorEntries[1].PlatformDataLength)
|
||||||
|
if (WriteFilePosition (hVHD->File,
|
||||||
|
RelativeParentVHDPathUnicode,
|
||||||
|
BytesPerSector,
|
||||||
|
NULL,
|
||||||
|
NtoHll (hVHD->Dynamic.ParentLocatorEntries[1].PlatformDataOffset))) {
|
||||||
Status = errno;
|
Status = errno;
|
||||||
goto Cleanup_Return;
|
goto Cleanup_Return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue