本文整理汇总了Python中Block.Block.create方法的典型用法代码示例。如果您正苦于以下问题:Python Block.create方法的具体用法?Python Block.create怎么用?Python Block.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block.Block
的用法示例。
在下文中一共展示了Block.create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, name, create_ts=None, disk_ts=None, mod_ts=None, extension=0, fstype=0):
Block.create(self)
# init fresh hash table
self.hash_size = self.blkdev.block_longs - 56
self.hash_table = []
for i in xrange(self.hash_size):
self.hash_table.append(0)
# timestamps
self.mod_ts = mod_ts
self.disk_ts = disk_ts
self.create_ts = create_ts
# name
self.name = name
# bitmap: blank
self.bitmap_flag = 0xffffffff
self.bitmap_ptrs = []
for i in xrange(25):
self.bitmap_ptrs.append(0)
self.bitmap_ext_blk = 0
# new stuff for DOS6 and DOS7
self.fstype = fstype
self.blocks_used = 0
self.extension = extension
示例2: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, parent, name, data_blocks, extension, byte_size=0, protect=0, comment=None, mod_ts=None, hash_chain=0):
Block.create(self)
self.own_key = self.blk_num
n = len(data_blocks)
self.block_count = n
if n == 0:
self.first_data = 0
else:
self.first_data = data_blocks[0]
self.data_blocks = data_blocks
self.protect = protect
self.protect_flags = ProtectFlags(self.protect)
self.byte_size = byte_size
if comment == None:
self.comment = ''
else:
self.comment = comment
self.mod_ts = mod_ts
self.name = name
self.hash_chain = hash_chain
self.parent = parent
self.extension = extension
self.valid = True
return True
示例3: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, hdr_key, seq_num, data, next_data):
Block.create(self)
self.hdr_key = hdr_key
self.seq_num = seq_num
self.data_size = len(data)
self.next_data = next_data
self.contents = data
示例4: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, parent, data_blocks, extension):
Block.create(self)
self.own_key = self.blk_num
self.block_count = len(data_blocks)
self.data_blocks = data_blocks
self.parent = parent
self.extension = extension
self.valid = True
return True
示例5: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, dos_type=DOS0, root_blk=None, boot_code=None):
Block.create(self)
self._create_data()
self.dos_type = dos_type
self.calc_root_blk = int(self.blkdev.num_blocks / 2)
if root_blk != None:
self.got_root_blk = root_blk
else:
self.got_root_blk = self.calc_root_blk
self.boot_code = boot_code
self.valid = True
示例6: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, parent, records=None, next_cache=0):
Block.create(self)
self.own_key = self.blk_num
self.parent = parent
self.next_cache = next_cache
if records == None:
self.num_records = 0
self.records = []
else:
self.num_records = len(records)
self.records = records
self.valid = True
return True
示例7: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, dos_type=DosType.DOS0, root_blk=None, boot_code=None):
Block.create(self)
self._create_data()
self.dos_type = dos_type
self.valid_dos_type = True
# root blk
self.calc_root_blk = int(self.blkdev.num_blocks / 2)
if root_blk != None:
self.got_root_blk = root_blk
else:
self.got_root_blk = self.calc_root_blk
# create extra blks
self.extra_blks = []
for i in xrange(self.num_extra):
b = Block(self.blkdev, self.blk_num + 1 + i)
b._create_data()
self.extra_blks.append(b)
# setup boot code
return self.set_boot_code(boot_code)
示例8: create
# 需要导入模块: from Block import Block [as 别名]
# 或者: from Block.Block import create [as 别名]
def create(self, parent, name, protect=0, comment=None, mod_ts=None, hash_chain=0, extension=0):
Block.create(self)
self.own_key = self.blk_num
self.protect = protect
if comment == None:
self.comment = ""
else:
self.comment = comment
# timestamps
self.mod_ts = mod_ts
self.name = name
self.hash_chain = hash_chain
self.parent = parent
self.extension = extension
# empty hash table
self.hash_table = []
self.hash_size = self.blkdev.block_longs - 56
for i in xrange(self.hash_size):
self.hash_table.append(0)
self.valid = True
return True