SCSI add support for POSIX compatible iovectos

This patch defines an scsi_iovec struct which is guaranteed
to be POSIX compatible. It furthermore adds support for
in+out iovectors for bi-directional operations
Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2012-11-23 15:43:00 +01:00
parent 55f76cfb0c
commit e7cc6dc1ca
6 changed files with 74 additions and 49 deletions

View File

@@ -950,6 +950,11 @@ iscsi_report_supported_opcodes_sync(struct iscsi_context *iscsi, int lun,
* task->datain.data will be NULL
*/
EXTERN int scsi_task_add_data_in_buffer(struct scsi_task *task, int len, unsigned char *buf);
EXTERN int scsi_task_add_data_out_buffer(struct scsi_task *task, int len, unsigned char *buf);
struct scsi_iovec;
EXTERN void scsi_task_set_iov_out(struct scsi_task *task, struct scsi_iovec *iov, int niov);
EXTERN void scsi_task_set_iov_in(struct scsi_task *task, struct scsi_iovec *iov, int niov);
/*
* This function is used when you want to cancel a scsi task.

View File

@@ -197,18 +197,20 @@ enum scsi_residual {
SCSI_RESIDUAL_OVERFLOW
};
#if !defined(_SYS_UIO_H) && !defined(CONFIG_IOVEC)
struct iovec {
/* struct scsi_iovec follows the POSIX struct iovec
definition and *MUST* never change. */
struct scsi_iovec {
void *iov_base;
size_t iov_len;
};
#endif
struct scsi_iovector {
struct iovec *iov;
struct scsi_iovec *iov;
int niov;
int nalloc;
size_t size;
size_t offset;
int consumed;
};
struct scsi_task {
@@ -231,9 +233,8 @@ struct scsi_task {
uint32_t cmdsn;
uint32_t lun;
size_t buffers_offset;
int buffers_consumed;
struct scsi_iovector *buffers;
struct scsi_iovector iovector_in;
struct scsi_iovector iovector_out;
};
/* This function will free a scsi task structure.
@@ -723,8 +724,6 @@ EXTERN struct scsi_task *scsi_cdb_report_supported_opcodes(int report_timeouts,
void *scsi_malloc(struct scsi_task *task, size_t size);
EXTERN void scsi_iovector_assign(struct scsi_task *task, struct scsi_iovector *iov);
#ifdef __cplusplus
}
#endif