Add support for UNMAP command and add a simple test for this opcode

This commit is contained in:
Ronnie Sahlberg
2012-04-22 08:09:15 +10:00
parent d71a9d4f95
commit dd5f94b2ca
10 changed files with 260 additions and 2 deletions

View File

@@ -613,6 +613,16 @@ iscsi_modesense6_task(struct iscsi_context *iscsi, int lun, int dbd,
unsigned char alloc_len, iscsi_command_cb cb,
void *private_data);
struct unmap_list {
uint64_t lba;
uint32_t num;
};
EXTERN struct scsi_task *
iscsi_unmap_task(struct iscsi_context *iscsi, int lun, int anchor, int group,
struct unmap_list *list, int list_len,
iscsi_command_cb cb, void *private_data);
/*
* Sync commands for SCSI
@@ -662,6 +672,10 @@ iscsi_verify10_sync(struct iscsi_context *iscsi, int lun,
int vprotect, int dpo, int bytchk,
int blocksize);
EXTERN struct scsi_task *
iscsi_unmap_sync(struct iscsi_context *iscsi, int lun, int anchor, int group,
struct unmap_list *list, int list_len);
/*
* This function is used when the application wants to specify its own buffers to read the data
* from the DATA-IN PDUs into.

View File

@@ -29,6 +29,7 @@ enum scsi_opcode {
SCSI_OPCODE_WRITE10 = 0x2A,
SCSI_OPCODE_VERIFY10 = 0x2F,
SCSI_OPCODE_SYNCHRONIZECACHE10 = 0x35,
SCSI_OPCODE_UNMAP = 0x42,
SCSI_OPCODE_READ16 = 0x88,
SCSI_OPCODE_SERVICE_ACTION_IN = 0x9E,
SCSI_OPCODE_REPORTLUNS = 0xA0,
@@ -561,7 +562,9 @@ EXTERN struct scsi_task *scsi_cdb_synchronizecache10(int lba, int num_blocks,
int syncnv, int immed);
EXTERN struct scsi_task *scsi_cdb_serviceactionin16(enum scsi_service_action_in sa, uint32_t xferlen);
EXTERN struct scsi_task *scsi_cdb_readcapacity16(void);
EXTERN struct scsi_task *scsi_cdb_unmap(int anchor, int group, uint16_t xferlen);
void *scsi_malloc(struct scsi_task *task, size_t size);
#endif /* __scsi_lowlevel_h__ */