示例#1
0
class DNode(Struct):
    __ENDIAN__ = 'little'

    node_type = uint8(enum=constants.ObjectType)
    indirect_blockshift = uint8()
    indirect_levels = uint8()
    num_blockptrs = uint8()
    bonustype = uint8(enum=constants.ObjectType)
    checksum_type = uint8(enum=constants.Checksum)
    compression_type = uint8(enum=constants.Compression)
    _dnode_flags = uint8()  # TODO: dnode flag bitfields
    used_bytes = BitField(_dnode_flags, 1, 0)
    userused = BitField(_dnode_flags, 1, 1)
    spill_blkptr = BitField(_dnode_flags, 1, 3)
    data_sectors = uint16()
    bonuslen = uint16()
    _pad = padding(length=4)
    max_block_id = uint64()
    used = uint64()
    _pad2 = padding(length=4 * 8)
    blkptr = array(Blockptr(), length=num_blockptrs)

    def bonus_length(self, o=None):
        if self.bonuslen != 0 and self.node_type != constants.ObjectType.NONE:
            return self.bonuslen
        elif self.node_type == constants.ObjectType.NONE:
            return 320
        else:
            return self.bonuslen

    bonus = bytestring(length=bonus_length)  # TODO: finish
    _final_pad = padding(length=64)
示例#2
0
class MicroZAPCommon(Struct):
    __ENDIAN__ = 'little'

    _pad = uint16()
    collision = uint32()
    name = nullstring(padded=True, max_length=50)
示例#3
0
class BPObjHeader(Struct):
    __ENDIAN__ = 'little'

    length = uint64()
    unknown = array(uint16(), length=20)
示例#4
0
class Message(pyndata.Struct):
    msg_type = pyndata.uint8()
    msg_length = pyndata.uint16(endian='big')
    payload = pyndata.bytestring(length=msg_length)
示例#5
0
class BitFieldTests(pyndata.Struct):
    real = pyndata.uint16()
    bit1 = pyndata.BitField(real, 4, shift=0)
    bit2 = pyndata.BitField(real, 1, shift=4)
    bit3 = pyndata.BitField(real, 3, shift=5)
    bit4 = pyndata.BitField(real, 8, shift=8)
示例#6
0
class BitField2Tests(pyndata.Struct):
    real = pyndata.uint16()
    bit1 = pyndata.BitField(real, 4)
    bit2 = pyndata.BitField(real, 1)
    bit3 = pyndata.BitField(real, 3)
    bit4 = pyndata.BitField(real, 8)
示例#7
0
class ZNodeACL(pyndata.Struct):
    external_object = pyndata.uint64()
    count = pyndata.uint32()
    version = pyndata.uint16()
    _padding = pyndata.padding(length=2)
    aces = pyndata.array(ZNodeACE, length=count)
示例#8
0
class ZNodeACE(pyndata.Struct):
    who = pyndata.uint32()
    access_mask = pyndata.uint32()
    flags = pyndata.uint16()
    type = pyndata.uint16()
示例#9
0
class e(pyndata.Struct):
    __ENDIAN__ = 'big'

    normal = pyndata.uint16()
    little = pyndata.uint16(endian='little')
    big = pyndata.uint16(endian='big')