From 7e6762d64bd139e77bdf395151d4d58e95c173b4 Mon Sep 17 00:00:00 2001 From: Brian Meagher Date: Wed, 12 Apr 2023 18:51:09 -0700 Subject: [PATCH] Add raw_sense property to Task --- src/iscsi.pyx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/iscsi.pyx b/src/iscsi.pyx index 41725de..5d0efb6 100644 --- a/src/iscsi.pyx +++ b/src/iscsi.pyx @@ -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": @@ -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 @@ -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