mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2025-01-16 02:32:52 +00:00
Added count of free sectors based on VTOC allocation table
This commit is contained in:
parent
68469e8e92
commit
efb0d6ef28
@ -92,10 +92,10 @@ class Dos33VTOC(VTOC):
|
|||||||
# so we need to reorder them using numpy's indexing before stuffing
|
# so we need to reorder them using numpy's indexing before stuffing
|
||||||
# them into the sector map
|
# them into the sector map
|
||||||
self.sector_map[0:self.max_sectors] = bits[self.vtoc_bit_reorder_index]
|
self.sector_map[0:self.max_sectors] = bits[self.vtoc_bit_reorder_index]
|
||||||
log.debug("vtoc before: %s" % self.sector_map[0:35*16])
|
log.debug("vtoc before: %s (%d free)" % (self.sector_map[0:35*16], self.num_free_sectors))
|
||||||
|
|
||||||
def calc_bitmap(self):
|
def calc_bitmap(self):
|
||||||
log.debug("vtoc after: %s" % self.sector_map[0:35*16])
|
log.debug("vtoc after: %s (%d free)" % (self.sector_map[0:35*16], self.num_free_sectors))
|
||||||
|
|
||||||
# reverse the process from above, so swap the order of every 16 bits,
|
# reverse the process from above, so swap the order of every 16 bits,
|
||||||
# turn them into bytes, then stuff them back into the vtoc. The bit
|
# turn them into bytes, then stuff them back into the vtoc. The bit
|
||||||
|
@ -224,6 +224,11 @@ class VTOC(BaseSectorList):
|
|||||||
if segments is not None:
|
if segments is not None:
|
||||||
self.parse_segments(segments)
|
self.parse_segments(segments)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def num_free_sectors(self):
|
||||||
|
free = np.where(self.sector_map == 1)[0]
|
||||||
|
return len(free)
|
||||||
|
|
||||||
def parse_segments(self, segments):
|
def parse_segments(self, segments):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user