[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [linux-2.6.18-xen] pvSCSI: Add white list to SCSI command emulation
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1215088540 -3600 # Node ID 9c4a15e54814161d8909dd68e288bba50fe5c221 # Parent 999b88699ca41f85f0f7a35d86126d5ae7997522 pvSCSI: Add white list to SCSI command emulation Add "white list" control to SCSI command emulation. Current setting allows following mandatory and safe commands. TEST UNIT READY REZERO UNIT REQUEST SENSE FORMAT UNIT READ BLOCK LIMITS READ(06) WRITE(06) WRITE FILEMARKS SPACE INQUIRY ERASE MODE SENSE(06) SEND DIAGNOSTIC READ CAPACITY READ(10) WRITE(10) REPORT LUN Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx> Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx> --- drivers/xen/scsiback/emulate.c | 83 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 76 insertions(+), 7 deletions(-) diff -r 999b88699ca4 -r 9c4a15e54814 drivers/xen/scsiback/emulate.c --- a/drivers/xen/scsiback/emulate.c Thu Jul 03 11:03:53 2008 +0100 +++ b/drivers/xen/scsiback/emulate.c Thu Jul 03 13:35:40 2008 +0100 @@ -93,7 +93,7 @@ static void scsiback_mk_sense_buffer(uin data[13] = asq; } -static void resp_not_supported_cmd(pending_req_t *pending_req) +static void resp_not_supported_cmd(pending_req_t *pending_req, void *data) { scsiback_mk_sense_buffer(pending_req->sense_buffer, ILLEGAL_REQUEST, INVALID_OPCODE, 0); @@ -270,7 +270,7 @@ int __pre_do_emulation(pending_req_t *pe 1: non emulation or should call native driver after modifing the request buffer. */ - return (bitmap[op_code] & VSCSIIF_NEED_CMD_EXEC); + return !!(bitmap[op_code] & VSCSIIF_NEED_CMD_EXEC); } void scsiback_rsp_emulation(pending_req_t *pending_req) @@ -308,16 +308,14 @@ void scsiback_emulation_init(void) /* Initialize to default state */ for (i = 0; i < VSCSI_MAX_SCSI_OP_CODE; i++) { - bitmap[i] = VSCSIIF_NEED_CMD_EXEC; - pre_function[i] = NULL; + bitmap[i] = (VSCSIIF_NEED_EMULATE_REQBUF | + VSCSIIF_NEED_EMULATE_RSPBUF); + pre_function[i] = resp_not_supported_cmd; post_function[i] = NULL; /* means, - no need for pre-emulation - no need for post-emulation - call native driver - - (Current setting is black-list bases, white-list - bases may be appropriate for security.) */ } @@ -325,6 +323,77 @@ void scsiback_emulation_init(void) Register appropriate functions below as you need. (See scsi/scsi.h for definition of SCSI op_code.) */ + + /* + This command is Non emulation. + */ + bitmap[TEST_UNIT_READY] = VSCSIIF_NEED_CMD_EXEC; + pre_function[TEST_UNIT_READY] = NULL; + post_function[TEST_UNIT_READY] = NULL; + + bitmap[REZERO_UNIT] = VSCSIIF_NEED_CMD_EXEC; + pre_function[REZERO_UNIT] = NULL; + post_function[REZERO_UNIT] = NULL; + + bitmap[REQUEST_SENSE] = VSCSIIF_NEED_CMD_EXEC; + pre_function[REQUEST_SENSE] = NULL; + post_function[REQUEST_SENSE] = NULL; + + bitmap[FORMAT_UNIT] = VSCSIIF_NEED_CMD_EXEC; + pre_function[FORMAT_UNIT] = NULL; + post_function[FORMAT_UNIT] = NULL; + + bitmap[READ_BLOCK_LIMITS] = VSCSIIF_NEED_CMD_EXEC; + pre_function[READ_BLOCK_LIMITS] = NULL; + post_function[READ_BLOCK_LIMITS] = NULL; + + bitmap[READ_6] = VSCSIIF_NEED_CMD_EXEC; + pre_function[READ_6] = NULL; + post_function[READ_6] = NULL; + + bitmap[WRITE_6] = VSCSIIF_NEED_CMD_EXEC; + pre_function[WRITE_6] = NULL; + post_function[WRITE_6] = NULL; + + bitmap[WRITE_FILEMARKS] = VSCSIIF_NEED_CMD_EXEC; + pre_function[WRITE_FILEMARKS] = NULL; + post_function[WRITE_FILEMARKS] = NULL; + + bitmap[SPACE] = VSCSIIF_NEED_CMD_EXEC; + pre_function[SPACE] = NULL; + post_function[SPACE] = NULL; + + bitmap[INQUIRY] = VSCSIIF_NEED_CMD_EXEC; + pre_function[INQUIRY] = NULL; + post_function[INQUIRY] = NULL; + + bitmap[ERASE] = VSCSIIF_NEED_CMD_EXEC; + pre_function[ERASE] = NULL; + post_function[ERASE] = NULL; + + bitmap[MODE_SENSE] = VSCSIIF_NEED_CMD_EXEC; + pre_function[MODE_SENSE] = NULL; + post_function[MODE_SENSE] = NULL; + + bitmap[SEND_DIAGNOSTIC] = VSCSIIF_NEED_CMD_EXEC; + pre_function[SEND_DIAGNOSTIC] = NULL; + post_function[SEND_DIAGNOSTIC] = NULL; + + bitmap[READ_CAPACITY] = VSCSIIF_NEED_CMD_EXEC; + pre_function[READ_CAPACITY] = NULL; + post_function[READ_CAPACITY] = NULL; + + bitmap[READ_10] = VSCSIIF_NEED_CMD_EXEC; + pre_function[READ_10] = NULL; + post_function[READ_10] = NULL; + + bitmap[WRITE_10] = VSCSIIF_NEED_CMD_EXEC; + pre_function[WRITE_10] = NULL; + post_function[WRITE_10] = NULL; + + /* + This command is Full emulation. + */ pre_function[REPORT_LUNS] = __report_luns; bitmap[REPORT_LUNS] = (VSCSIIF_NEED_EMULATE_REQBUF | VSCSIIF_NEED_EMULATE_RSPBUF); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |