当前位置: 首页>>代码示例>>Python>>正文


Python SCSI.writesame10方法代码示例

本文整理汇总了Python中pyscsi.pyscsi.scsi.SCSI.writesame10方法的典型用法代码示例。如果您正苦于以下问题:Python SCSI.writesame10方法的具体用法?Python SCSI.writesame10怎么用?Python SCSI.writesame10使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyscsi.pyscsi.scsi.SCSI的用法示例。


在下文中一共展示了SCSI.writesame10方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from pyscsi.pyscsi.scsi import SCSI [as 别名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import writesame10 [as 别名]
def main():
    dev = MockWriteSame10()
    dev.opcodes = sbc
    s = SCSI(dev)

    data = bytearray(512)

    w = s.writesame10(1024, 27, data)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb[1] == 0
    assert scsi_ba_to_int(cdb[2:6]) == 1024
    assert cdb[6] == 0
    assert scsi_ba_to_int(cdb[7:9]) == 27
    assert cdb[9] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb['wrprotect'] == 0
    assert cdb['anchor'] == 0
    assert cdb['unmap'] == 0
    assert cdb['lba'] == 1024
    assert cdb['group'] == 0
    assert cdb['nb'] == 27

    d = WriteSame10.unmarshall_cdb(WriteSame10.marshall_cdb(cdb))
    assert d == cdb

    w = s.writesame10(65536, 27, data, wrprotect=4, anchor=1, group=19)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb[1] == 0x90
    assert scsi_ba_to_int(cdb[2:6]) == 65536
    assert cdb[6] == 0x13
    assert scsi_ba_to_int(cdb[7:9]) == 27
    assert cdb[9] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb['wrprotect'] == 4
    assert cdb['anchor'] == 1
    assert cdb['unmap'] == 0
    assert cdb['lba'] == 65536
    assert cdb['group'] == 19
    assert cdb['nb'] == 27

    d = WriteSame10.unmarshall_cdb(WriteSame10.marshall_cdb(cdb))
    assert d == cdb

    w = s.writesame10(65536, 27, data, wrprotect=4, unmap=1)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb[1] == 0x88
    assert scsi_ba_to_int(cdb[2:6]) == 65536
    assert cdb[6] == 0
    assert scsi_ba_to_int(cdb[7:9]) == 27
    assert cdb[9] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_10.value
    assert cdb['wrprotect'] == 4
    assert cdb['anchor'] == 0
    assert cdb['unmap'] == 1
    assert cdb['lba'] == 65536
    assert cdb['group'] == 0
    assert cdb['nb'] == 27

    d = WriteSame10.unmarshall_cdb(WriteSame10.marshall_cdb(cdb))
    assert d == cdb
开发者ID:c-r-h,项目名称:python-scsi,代码行数:68,代码来源:test_cdb_writesame10.py


注:本文中的pyscsi.pyscsi.scsi.SCSI.writesame10方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。