remove broken import
This commit is contained in:
@@ -13,8 +13,8 @@ const {
|
||||
} = require('./_constants')
|
||||
const { fuHeader, checksumStruct } = require('./_structs')
|
||||
const assert = require('node:assert')
|
||||
const { NBD_DEFAULT_BLOCK_SIZE } = require('@vates/nbd-client/constants.mjs')
|
||||
|
||||
const NBD_DEFAULT_BLOCK_SIZE = 64 * 1024
|
||||
const MAX_DURATION_BETWEEN_PROGRESS_EMIT = 5e3
|
||||
const MIN_TRESHOLD_PERCENT_BETWEEN_PROGRESS_EMIT = 1
|
||||
|
||||
@@ -35,25 +35,23 @@ exports.createNbdRawStream = function createRawStream(nbdClient) {
|
||||
return stream
|
||||
}
|
||||
|
||||
|
||||
function batContainsBlock(bat, blockId) {
|
||||
const entry = bat.readUInt32BE(blockId * 4)
|
||||
if (entry !== BLOCK_UNUSED) {
|
||||
return [{ blockId, size: DEFAULT_BLOCK_SIZE }]
|
||||
}
|
||||
|
||||
}
|
||||
// one 2MB VHD block is in 32 blocks of 64KB
|
||||
// 32 bits are written in 8 4bytes uint32
|
||||
const EMPTY_NBD_BUFFER = Buffer.alloc(NBD_DEFAULT_BLOCK_SIZE, 0)
|
||||
function cbtContainsBlock(cbt, blockId) {
|
||||
let subBlocks = []
|
||||
const subBlocks = []
|
||||
let hasOne = false
|
||||
for (let i = 0; i < 32; i++) {
|
||||
let position = blockId * 32 + i
|
||||
const bitOffset = position & 7; // in byte
|
||||
const byteIndex = position >> 3; // in buffer
|
||||
const bit = (buffer[byteIndex] >> bitOffset) & 1;
|
||||
const position = blockId * 32 + i
|
||||
const bitOffset = position & 7 // in byte
|
||||
const byteIndex = position >> 3 // in buffer
|
||||
const bit = (cbt[byteIndex] >> bitOffset) & 1
|
||||
if (bit === 1) {
|
||||
subBlocks.push({ blockId: position, size: NBD_DEFAULT_BLOCK_SIZE })
|
||||
hasOne = true
|
||||
|
||||
Reference in New Issue
Block a user