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:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user