Skip to content

Commit

Permalink
Merge pull request #8 from bmeagherix/rawsense
Browse files Browse the repository at this point in the history
Add raw_sense property to Task
  • Loading branch information
rosjat authored Mar 22, 2024
2 parents 49609e2 + 7e6762d commit b1c036b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/iscsi.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

from libc.stdlib cimport calloc
from cpython.bytes cimport PyBytes_FromStringAndSize


cdef extern from "iscsi/scsi-lowlevel.h":
Expand All @@ -13,8 +14,12 @@ cdef extern from "iscsi/scsi-lowlevel.h":
SCSI_XFER_READ
SCSI_XFER_WRITE

cdef struct scsi_data:
int size
char *data

cdef struct scsi_task:
pass
scsi_data datain

cdef struct scsi_sense:
pass
Expand Down Expand Up @@ -89,6 +94,9 @@ cdef class Task:
def status(self):
return scsi_task_get_status(self._task, NULL)

@property
def raw_sense(self):
return PyBytes_FromStringAndSize(&self._task.datain.data[2], self._task.datain.size-2)

cdef class Context:
cdef iscsi_context *_ctx
Expand Down

0 comments on commit b1c036b

Please sign in to comment.