當前位置: 首頁>>代碼示例>>Python>>正文


Python SCSI.blocksize方法代碼示例

本文整理匯總了Python中pyscsi.pyscsi.scsi.SCSI.blocksize方法的典型用法代碼示例。如果您正苦於以下問題:Python SCSI.blocksize方法的具體用法?Python SCSI.blocksize怎麽用?Python SCSI.blocksize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyscsi.pyscsi.scsi.SCSI的用法示例。


在下文中一共展示了SCSI.blocksize方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: main

# 需要導入模塊: from pyscsi.pyscsi.scsi import SCSI [as 別名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import blocksize [as 別名]
def main():
    dev = MockWrite12()
    dev.opcodes = sbc
    s = SCSI(dev)
    s.blocksize = 512

    data = bytearray(27 * 512)

    w = s.write12(1024, 27, data)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_12.value
    assert cdb[1] == 0
    assert scsi_ba_to_int(cdb[2:6]) == 1024
    assert scsi_ba_to_int(cdb[6:10]) == 27
    assert cdb[10] == 0
    assert cdb[11] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
    assert cdb['wrprotect'] == 0
    assert cdb['dpo'] == 0
    assert cdb['fua'] == 0
    assert cdb['lba'] == 1024
    assert cdb['group'] == 0
    assert cdb['tl'] == 27

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

    w = s.write12(65536, 27, data, wrprotect=2, dpo=1, fua=1, group=19)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_12.value
    assert cdb[1] == 0x58
    assert scsi_ba_to_int(cdb[2:6]) == 65536
    assert scsi_ba_to_int(cdb[6:10]) == 27
    assert cdb[10] == 0x13
    assert cdb[11] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_12.value
    assert cdb['wrprotect'] == 2
    assert cdb['dpo'] == 1
    assert cdb['fua'] == 1
    assert cdb['lba'] == 65536
    assert cdb['group'] == 19
    assert cdb['tl'] == 27

    d = Write12.unmarshall_cdb(Write12.marshall_cdb(cdb))
    assert d == cdb
開發者ID:Katana-Steel,項目名稱:python-scsi,代碼行數:49,代碼來源:test_cdb_write12.py

示例2: main

# 需要導入模塊: from pyscsi.pyscsi.scsi import SCSI [as 別名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import blocksize [as 別名]
def main():
    dev = MockRead16()
    dev.opcodes = sbc
    s = SCSI(dev)
    s.blocksize = 512

    r = s.read16(1024, 27)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_16.value
    assert cdb[1] == 0
    assert scsi_ba_to_int(cdb[2:10]) == 1024
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0
    assert cdb[15] == 0
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_16.value
    assert cdb['rdprotect'] == 0
    assert cdb['dpo'] == 0
    assert cdb['fua'] == 0
    assert cdb['rarc'] == 0
    assert cdb['lba'] == 1024
    assert cdb['group'] == 0
    assert cdb['tl'] == 27

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

    r = s.read16(1024, 27, rdprotect=2, dpo=1, fua=1, rarc=1, group=19)
    cdb = r.cdb
    assert cdb[0] == s.device.opcodes.READ_16.value
    assert cdb[1] == 0x5c
    assert scsi_ba_to_int(cdb[2:10]) == 1024
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0x13
    assert cdb[15] == 0
    cdb = r.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.READ_16.value
    assert cdb['rdprotect'] == 2
    assert cdb['dpo'] == 1
    assert cdb['fua'] == 1
    assert cdb['rarc'] == 1
    assert cdb['lba'] == 1024
    assert cdb['group'] == 19
    assert cdb['tl'] == 27

    d = Read16.unmarshall_cdb(Read16.marshall_cdb(cdb))
    assert d == cdb
開發者ID:Katana-Steel,項目名稱:python-scsi,代碼行數:49,代碼來源:test_cdb_read16.py

示例3: main

# 需要導入模塊: from pyscsi.pyscsi.scsi import SCSI [as 別名]
# 或者: from pyscsi.pyscsi.scsi.SCSI import blocksize [as 別名]
def main():
    dev = MockWriteSame16()
    dev.opcodes = sbc
    s = SCSI(dev)
    s.blocksize = 512
    data = bytearray(512)

    w = s.writesame16(1024, 27, data)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb[1] == 0
    assert scsi_ba_to_int(cdb[2:10]) == 1024
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0
    assert cdb[15] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb['wrprotect'] == 0
    assert cdb['anchor'] == 0
    assert cdb['unmap'] == 0
    assert cdb['ndob'] == 0
    assert cdb['lba'] == 1024
    assert cdb['group'] == 0
    assert cdb['nb'] == 27

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

    w = s.writesame16(65536, 27, data, wrprotect=4, anchor=1, group=19)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb[1] == 0x90
    assert scsi_ba_to_int(cdb[2:10]) == 65536
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0x13
    assert cdb[15] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb['wrprotect'] == 4
    assert cdb['anchor'] == 1
    assert cdb['unmap'] == 0
    assert cdb['ndob'] == 0
    assert cdb['lba'] == 65536
    assert cdb['group'] == 19
    assert cdb['nb'] == 27

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

    w = s.writesame16(65536, 27, data, wrprotect=4, unmap=1, ndob=1)
    cdb = w.cdb
    assert cdb[0] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb[1] == 0x89
    assert scsi_ba_to_int(cdb[2:10]) == 65536
    assert scsi_ba_to_int(cdb[10:14]) == 27
    assert cdb[14] == 0
    assert cdb[15] == 0
    cdb = w.unmarshall_cdb(cdb)
    assert cdb['opcode'] == s.device.opcodes.WRITE_SAME_16.value
    assert cdb['wrprotect'] == 4
    assert cdb['anchor'] == 0
    assert cdb['unmap'] == 1
    assert cdb['ndob'] == 1
    assert cdb['lba'] == 65536
    assert cdb['group'] == 0
    assert cdb['nb'] == 27

    d = WriteSame16.unmarshall_cdb(WriteSame16.marshall_cdb(cdb))
    assert d == cdb
開發者ID:Katana-Steel,項目名稱:python-scsi,代碼行數:71,代碼來源:test_cdb_writesame16.py


注:本文中的pyscsi.pyscsi.scsi.SCSI.blocksize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。