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