本文整理汇总了Python中FileSystem.FileSystem.get_blk_nums方法的典型用法代码示例。如果您正苦于以下问题:Python FileSystem.get_blk_nums方法的具体用法?Python FileSystem.get_blk_nums怎么用?Python FileSystem.get_blk_nums使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem.FileSystem
的用法示例。
在下文中一共展示了FileSystem.get_blk_nums方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from FileSystem import FileSystem [as 别名]
# 或者: from FileSystem.FileSystem import get_blk_nums [as 别名]
def open(self):
# read RDB
self.rdb = RDBlock(self.rawblk)
if not self.rdb.read():
self.valid = False
return False
# create used block list
self.used_blks = [self.rdb.blk_num]
# read partitions
part_blk = self.rdb.part_list
self.parts = []
num = 0
while part_blk != Block.no_blk:
p = Partition(self.rawblk, part_blk, num, self.rdb.log_drv.cyl_blks, self)
num += 1
if not p.read():
self.valid = False
return False
self.parts.append(p)
# store used block
self.used_blks.append(p.get_blk_num())
# next partition
part_blk = p.get_next_partition_blk()
# read filesystems
fs_blk = self.rdb.fs_list
self.fs = []
num = 0
while fs_blk != PartitionBlock.no_blk:
fs = FileSystem(self.rawblk, fs_blk, num)
num += 1
if not fs.read():
self.valid = False
return False
self.fs.append(fs)
# store used blocks
self.used_blks += fs.get_blk_nums()
# next partition
fs_blk = fs.get_next_fs_blk()
# TODO: add bad block blocks
self.valid = True
self.max_blks = self.rdb.log_drv.rdb_blk_hi + 1
return True