fix(vhd-lib): fix block table properties & accessors
Fixes #5956
Introduced by 7ef89d504
This commit is contained in:
parent
c62d727cbe
commit
07cc4c853d
@ -23,20 +23,20 @@ export class VhdDirectory extends VhdAbstract {
|
||||
|
||||
set header(header) {
|
||||
super.header = header
|
||||
this.#blocktable = Buffer.alloc(header.maxTableEntries)
|
||||
this.#blockTable = Buffer.alloc(header.maxTableEntries)
|
||||
}
|
||||
|
||||
get header() {
|
||||
return super.header
|
||||
}
|
||||
|
||||
get #blocktable() {
|
||||
assert.notStrictEqual(this.#blockTable, undefined, 'Block table must be initialized before access')
|
||||
get #blockTable() {
|
||||
assert.notStrictEqual(this.#uncheckedBlockTable, undefined, 'Block table must be initialized before access')
|
||||
return this.#uncheckedBlockTable
|
||||
}
|
||||
|
||||
set #blocktable(blocktable) {
|
||||
this.#uncheckedBlockTable = blocktable
|
||||
set #blockTable(blockTable) {
|
||||
this.#uncheckedBlockTable = blockTable
|
||||
}
|
||||
|
||||
static async open(handler, path) {
|
||||
@ -50,7 +50,7 @@ export class VhdDirectory extends VhdAbstract {
|
||||
await vhd.readHeaderAndFooter()
|
||||
return {
|
||||
dispose: () => {},
|
||||
value: vhd
|
||||
value: vhd,
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ export class VhdDirectory extends VhdAbstract {
|
||||
const vhd = new VhdDirectory(handler, path)
|
||||
return {
|
||||
dispose: () => {},
|
||||
value: vhd
|
||||
value: vhd,
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ export class VhdDirectory extends VhdAbstract {
|
||||
const buffer = await this._handler.readFile(this.getChunkPath(partName))
|
||||
|
||||
return {
|
||||
buffer: Buffer.from(buffer)
|
||||
buffer: Buffer.from(buffer),
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ export class VhdDirectory extends VhdAbstract {
|
||||
id: blockId,
|
||||
bitmap: buffer.slice(0, this.bitmapSize),
|
||||
data: buffer.slice(this.bitmapSize),
|
||||
buffer
|
||||
buffer,
|
||||
}
|
||||
}
|
||||
ensureBatSize() {
|
||||
|
@ -4,7 +4,7 @@ import {
|
||||
HEADER_SIZE,
|
||||
PLATFORM_NONE,
|
||||
SECTOR_SIZE,
|
||||
PARENT_LOCATOR_ENTRIES
|
||||
PARENT_LOCATOR_ENTRIES,
|
||||
} from '../_constants'
|
||||
import { computeBatSize, sectorsToBytes, buildHeader, buildFooter, BUF_BLOCK_UNUSED } from './_utils'
|
||||
import { createLogger } from '@xen-orchestra/log'
|
||||
@ -53,13 +53,13 @@ const { debug } = createLogger('vhd-lib:VhdFile')
|
||||
export class VhdFile extends VhdAbstract {
|
||||
#uncheckedBlockTable
|
||||
|
||||
get #blocktable() {
|
||||
get #blockTable() {
|
||||
assert.notStrictEqual(this.#uncheckedBlockTable, undefined, 'Block table must be initialized before access')
|
||||
return this.#uncheckedBlockTable
|
||||
}
|
||||
|
||||
set #blocktable(blocktable) {
|
||||
this.#uncheckedBlockTable = blocktable
|
||||
set #blockTable(blockTable) {
|
||||
this.#uncheckedBlockTable = blockTable
|
||||
}
|
||||
|
||||
get batSize() {
|
||||
@ -89,7 +89,7 @@ export class VhdFile extends VhdAbstract {
|
||||
await vhd.readHeaderAndFooter()
|
||||
return {
|
||||
dispose: () => handler.closeFile(fd),
|
||||
value: vhd
|
||||
value: vhd,
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ export class VhdFile extends VhdAbstract {
|
||||
const vhd = new VhdFile(handler, fd)
|
||||
return {
|
||||
dispose: () => handler.closeFile(fd),
|
||||
value: vhd
|
||||
value: vhd,
|
||||
}
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ export class VhdFile extends VhdAbstract {
|
||||
id: blockId,
|
||||
bitmap: buf.slice(0, this.bitmapSize),
|
||||
data: buf.slice(this.bitmapSize),
|
||||
buffer: buf
|
||||
buffer: buf,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user